Home

82091 SICL Users Guide

image

Contents

1. what interrupts to handle interrupt on ttl 0 or 7 firing isetintr id I_INTR_TRIG I_TRIG TTLO I_TRIG TTL7 Chapter 3 59 Using SICL Using Asynchronous Events Wait for interrupt to happen 30 second timeout iwaithdlr 30000 if intr T printf Interrupt handler called n else printf ERROR Interrupt handler not called n iclose id child 60 INST id Let the parent get into iwaithdlr sleep 2 ionerror I _ERROR_EXIT id iopen vxi pulse TTLO ivxitrigon id I TRIG TTLO ivxitrigoff id I TRIG TTLO iclose id exit 0 Chapter3 Using SICL Using Error Handlers Using Error Handlers When a SICL function call results in an error it typically returns a special value such as a NULL pointer or a non zero error code SICL provides a convenient mechanism for handling errors SICL allows you to install an error handler for all SICL functions within an application It is important to note that error handlers are per process not per session That is one handler will work for all sessions in a process This allows your application to ignore the return value and simply permits the error procedure to detect errors and recover The error handler is called before the function that generated the error completes The function ionerror is used to install an error handler It is defined as follows int ionerror proc
2. e It reads bufsize number of bytes It finds a byte with the END indicator attached e It finds the current termination character in the read buffer set with itermchr e An error occurs This function acts identically to the i read function except the data is not read directly from the device Instead the data is read from the formatted I O read buffer The advantage to this function over i read is that it can be intermixed with calls to iscanf while iread may not For C programs this function returns zero 0 if successful or a non zero error number if an error occurs IPRINTF ISCANF IPROMPTF IFWRITE ISETBUF TSETUBUP IFLUSH ITERMCHR 224 Chapter 10 C Syntax Description Return Value See Also SICL Language Reference IFWRITE IFWRITE Supported sessions 00005 device interface commander Affected by functions 00 2 0 0 000 ilock itimeout finclude lt sicl h gt int ifwrite id buf datalen end actualcnt INST id char buf unsigned long datalen int end unsigned long actualcnt This function is used to send a block of data to the device via the formatted T O write buffer the same buffer used by iprintf The id argument specifies the session to send the data to when the formatted I O write buffer is flushed The buf argument is a pointer to the data that is to be sent to the specified interface or device Th
3. LAN Software Architecture As the following figure shows the client system contains the LAN client software SICL LAN fileset and the LAN software TCP IP needed to access the server gateway The gateway contains the LAN server software SICL LANSVR fileset LAN TCP IP software and the instrument driver software needed to communicate with the client and to control the instruments or devices connected to it Client System Server Gateway ere Instrument Application LAN Server SICL TCE Instrument LAN Client IP Instrument Firmware Driver TCP LAN Interface IP LAN Interface HP IB bus or other LAN LAN Software Architecture Chapter 8 165 Using SICL with LAN Overview of SICL LAN LAN The LAN software provided with SICL is built on top of standard LAN Networking networking protocols There are two LAN networking protocols provided Protocols with the SICL software You can choose one or both of these protocols when configuring your systems via the iosetup utility to use SICL over LAN The two protocols are as follows e SICL LAN Protocol is a networking protocol developed by HP Agilent which is compatible with all existing SICL LAN products This LAN networking protocol is the default choice in the iosetup utility when you are configuring LAN for SICL TCP IP Instrument Protocol is a networking protocol developed by the VXIbus Consortium based on
4. The device session allows you direct access to a device without worrying about the type of interface to which it is connected The specifics of the interface are hidden from the user Addressing RS 232 Devices To create a device session specify either the interface symbolic name or logical unit followed by a device logical address of 488 in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The device address of 488 tells SICL that you are communicating with an instrument that uses the IEEE 488 2 standard command structure If your instrument does not speak IEEE 488 2 you can still use SICL to communicate with it However some of the SICL functions that work only with device sessions may not operate correctly See the next section titled SICL Function Support with RS 232 Device Sessions The following are example addresses for RS 232 device sessions COM1 488 A RS 232 device connected to COM1 COM2 488 A RS 232 device connected to COM2 146 Chapter 7 Using SICL with RS 232 Communicating with RS 232 Devices Note The previous examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name orlogical unit specified during the configuratio
5. ionerror I_ ERROR EXIT dvm iopen hpib 16 itimeout dvm 10000 iprintf dvm s n MEAS VOLT DC iscanf dvm Slf amp res printf Result is f n res iclose dvm exit 0 62 Chapter3 Note Using SICL Using Error Handlers The following is an ANSI C example of writing and implementing your own error handler errhand2 c This program shows how you can install your own error handler include lt sicl h gt include lt stdio h gt void err handler INST id int error fprintf stderr Error s n igeterrstr error exit 1 main INST dvm double res ionerror err handler dvm iopen hpib 16 itimeout dvm 10000 iprintf dvm Ss n MEAS VOLT DC iscanf dvm Slf amp res printf Result is f n res iclose dvm exit 0 Now if any of the SICL functions result in an error your error routine will be called If an error occurs in iopen the id that is passed to the error handler may not be valid Chapter 3 63 Caution Using SICL Using Locking Using Locking Because SICL allows multiple sessions on the same device or interface the action of opening does not mean you have exclusive use In some cases this is not an issue but should be a consideration if you are concerned with program portability The SICL ilock function is used to lock an interface or device The SICL iunlock function is us
6. C Syntax include lt sicl h gt int ivxibusstatus id request result INST id int request unsigned long result Description The ivxibusstatus function returns the status of the VXI interface This function takes one of the following parameters in the request parameter and returns the status in the resu t parameter I VXI BUS TRIGGER I VXI BUS LADDR I VXI BUS SERVANT AREA I_VXI_BUS_NORMOP I VXI BUS CMDR LADDR I VXI BUS MAN ID I VXI BUS MOD EL ID 366 Returns a bit mask corresponding to the trigger lines which are currently being driven active by a device on the VXI bus Returns the logical address of the VXI interface viewed as a device on the VXI bus Returns the servant area size of this device Returns if in normal operation and a 0 otherwise Returns logical address of this device s commander or 1 if no commander is present either this device is the top level commander or normal operation has not been established Returns the manufacturer s ID of this device Returns the model ID of this device Chapter 10 SICL Language Reference IVXIBUSSTATUS I_VXI_BUS_ PROTOCOL Returns the value stored in this device s protocol register I_VXI_BUS XPROT Returns the value that this device will use to respond to a read protocol word serial command I VXI BUS SHM SIZE Returns the size of VXI memory available on this device For A24 mem
7. IVXIWS Supported sessions 2 0 0 0 cece eect ene device Affected by functions 00 00 0000 ee ilock itimeout finclude lt sicl h gt int ivxiws id wscmd wsresp rpe INST id unsigned short wscmd unsigned short wsresp unsigned short rpe The ivxiws function sends a word serial command to a VXI message based device The wscmd contains the word serial command If wsresp contains zero 0 then this function does not read a word serial response If wsresp is non zero then the function reads a word serial response and stores it in that location If ivxiws executes successfully rpe does not contain valid data If the word serial command errors rpe contains the Read Protocol Error response the ivxiws function returns I_ERR_1O and the wsresp parameter contains invalid data The ivxiws function will always try to read the response data if the wsresp parameter is non zero If you send a word serial command that does not return response data and the wsresp argument is non zero this function will hang or timeout see it imeout waiting for the response For C programs this function returns zero 0 if successful or a non zero error number if an error occurs ITIMEOUT 380 Chapter 10 C Syntax Description Note SICL Language Reference IWAITHDLR IWAITHDLR finclude lt sicl h gt int iwaithdlr timeout long timeout The iwaithdir function causes the process to suspend until
8. If a request is made that cannot be granted due to hardware constraints the process will hang until the desired resources become available To avoid this use the iset lockwait command with the flag parameter set to 0 and thus generate an error instead of waiting for the resources to become available For C programs this function returns zero 0 if successful or a non zero error number if an error occurs ILOCK IUNLOCK IGETLOCK WAIT Chapter 10 351 C Syntax Description Return Value See Also SICL Language Reference ISETSTB ISETSTB Supported sessions 0 0 00 eee cece eee commander Affected by functions 00 000 0 ae ilock itimeout include lt sicl h gt int isetstb id stb INST id unsigned char stb The isetstb function allows the status byte value for this controller to be changed This function is only valid for commander sessions Bit 6 in the stb status byte has special meaning If bit 6 is set then an SRQ notification is given to the remote controller if its identity is known If bit 6 is not set then the SRQ notification is canceled The exact mechanism for sending the SRQ notification is dependent on the interface For C programs this function returns zero 0 if successful or a non zero error number if an error occurs TREADSTB IONSRQ 352 Chapter 10 SICL Language Reference ISETUBUF m ISETUBUF Supported sessions
9. Return Value This function returns zero 0 if successful or a non zero error number if an error occurs See Also IGETDATA 342 Chapter 10 SICL Language Reference ISETINTR ISETINTR Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int isetintr id intnum secval INST id int intnum long secval Description The isetintr function is used to enable interrupt handling for a particular event Installing an interrupt handler only allows you to receive enabled interrupts By default all interrupt events are disabled The intnum parameter specifies the possible causes for interrupts A valid intnum value for any type of session is I_INTR_OFF Turns off all interrupt conditions previously enabled with calls to isetintr A valid intnum value for all device sessions except for GPIB and GPIO which have no device specific interrupts is I_ INTR Individual interfaces may include other interface interrupt conditions See the following information on each interface for more details Valid intnum values for all interface sessions are I_INTR_INTFACT Interrupt when the interface becomes active Enable if secval 0 disable if secval 0 I_INTR_INTFDEACT Interrupt when the interface becomes deactivated Enable if secval 0 disable if secval 0 Chapter 10 343 SICL Language Reference ISETINTR I_INTR_TRIG I INTR Interrupt when a trigger occurs
10. Standard Instrument Control Library User s Guide Notice The information contained in this document is subject to change without notice Test amp Measurement Systems Inc TAMS shall not be liable for any errors contained in this document T4MS makes no warranties of any kind with regard to this document whether express or implied TAMS specifically disclaims the implied warranties of merchantability and fitness for a particular purpose TAMS shall not be liable for any direct indirect special incidental or consequential damages whether based on contract tort or any other legal theory in connection with the furnishing of this document or the use of the information in this document Warranty Information A copy of the specific warranty terms applicable to your Test amp Measurement Systems Inc product and replacement parts can be obtained from your local Sales and Service Office U S Government Restricted Rights The Software and Documentation have been developed entirely at private expense They are delivered and licensed as commercial computer software as defined in DFARS 252 227 7013 Oct 1988 DFARS 252 211 7015 May 1991 or DFARS 252 227 7014 Jun 1995 as a commercial item as defined in FAR 2 101 a or as Restricted computer software as defined in FAR 52 227 19 Jun 1987 or any equivalent agency regulation or contract clause whichever is applicable You have only those rights provided fo
11. exit process if SICL error detected ionerror I ERROR EXIT open HPIB interface session id iopen hpib itimeout id 10000 retrieve HPIB bus status igpibbusstatus id I GPIB BUS REM amp rem igpibbusstatus id I GPIB BUS SRQ amp srq igpibbusstatus id I GPIB BUS NDAC amp ndac igpibbusstatus id I GPIB BUS SYSCTLR amp sysctlr igpibbusstatus id I GPIB BUS ACTCTLR amp actctlr igpibbusstatus id I GPIB BUS TALKER amp talker igpibbusstatus id I GPIB BUS LISTENER amp listener igpibbusstatus id I GPIB BUS ADDR amp addr display bus status printf 5s 5s 5s 5s 5s 58s 5s 5s n REM SRO NDC SYS ACT TLK LTN ADDR printf 2d 5d 5d 5d 5d 5d 5d 6d n rem srq ndac sysctlr actctlr talker listener addr return 0 Chapter 4 Using SICL with GPIB Communicating with GPIB Interfaces The following example program sets up two GPIB instruments over an Communicating interface session and has the instruments communicate with each other with Devices f i via Interface The 3 main parts of this program are as follows Sessions Read the data from the scope get_ data Print some statistics about the data massage data Have the scope send the data to a printer print data hpibintr c This program requires a 54601A digitizing oscilloscope or compatibl
12. printf Ss n buf close device session iclose id Chapter 2 27 Note sicl h DEVICE _ ADDRESS INST ionerror iopen itimeout iprintf ipromptf iclose Getting Started with SICL Reviewing a SICL Program The newline character n in the iprintf and ipromptf functions in the previous example flushes the output buffer to the device and appends an END indicator to the newline Sometimes flushing is needed for the device and it is good practice to include this after each instrument command You can specify when the buffer is flushed with the SICL isetbuf function See Chapter 10 for information on this SICL function The SICL example program includes the following This header file must be included at the beginning of your program to provide the function prototypes and constants defined by SICL This constant is defined specifically for this example It is used to specify the device address This address is then used in the iopen function call This is a type definition defined by SICL It is used to represent a unique identifier that describes a specific device or interface This is a SICL function that installs an error handler that is automatically called if any SICL calls result in an error I ERROR_EXIT specifies that the error message is printed out and the program exited This SICL function creates a device session with the device attached to the address specified i
13. tcpinst 395183 etc inetd conf should contain rpc stream tcp nowait root opt sicl bin siclland 395180 1 siclland l var opt sicl siclland_ log rpc stream tcp nowait root opt sicl bin siclland 395183 1 siclland l var opt sicl siclland_log On Linux etc init d siclland should exist and sbin chkconfig list siclland Should show the service as being turned on for run levels 3 4 and 5 Note that parameters to siclland such as 1 logfile may vary depending on how you would like the server configured If these entries are present ensure that inetd is reconfigured to recognize the new entries by running the following as root On HP UX 111 usr sbin inetd c On Linux sbin service siclland stop sbin service siclland start Chapter 9 199 iopen fails LAN server appears hung Troubleshooting Your SICL Program Troubleshooting SICL over LAN Client and Server iopen fails when you run your application but rpcinfo indicates that the LAN server is ready and waiting Possible Solution Ensure that the requested interface has been configured on the server This is done while running the I O Libraries configuration utility See the O Libraries Installation and Configuration Guide for more information on this configuration The SICL LAN Server appears hung possibly due to a long timeout being set by a client on an operation which will never succeed Possible Solution Login to the LAN server via telnet
14. 393 SICL RUN 390 SICL VXI 391 Flow Control 331 Flushing buffers 50 Format string 50 formatio c example 49 Formatted Data read 223 312 319 read format conversion characters 324 read format modifiers 322 read white space 321 set buffer size 340 set buffer size and location 353 write 225 302 312 write format conversion characters 308 write format flags 306 write format modifiers 304 write special characters 303 Formatted I O 42 Argument modifier 46 Array size 46 Buffers 50 Comma operator 46 Conversion 43 Example 49 Field width 45 Format string 50 iprintf conversion characters 47 iscanf conversion characters 47 Precision 45 Functions GPIO specific 98 HP IB specific 88 iabort 212 iclear 93 148 151 ionsrq 148 152 iprintf 93 148 ipromptf 148 iread 93 151 ireadstb 94 148 iscanf 93 148 iserialmclctrl 153 iserialmclstat 153 iserialstat 153 itermchr 93 itrigger 93 148 151 iwrite 93 151 ixtrig 93 151 LAN specific 186 RS 232 specific 156 VXI MXI specific 141 G Gateways LAN sessions 169 GET HP IB interface sessions 78 GPIB 77 253 active controller 247 Addressing commander sessions 85 Addressing device sessions 72 ATN Attention line control 245 bus address 248 251 bus lines 248 byte order of data 356 change bus address 246 Communicating with commanders 85 Communicating with interfaces 77 Device sessions 72 functions see igpib i
15. Description Note SICL Language Reference IOPEN IOPEN Supported sessions 00005 device interface commander finclude lt sicl h gt INST iopen addr char addr Before using any of the SICL functions the application program must establish a session with the desired interface or device Create a session by using the iopen function This function creates a session and returns a session identifier Note that the session identifier should only be passed as a parameter to other SICL functions It is not designed to be updated manually by you The addr parameter contains the device interface or commander address An application may have multiple sessions open at the same time by creating multiple session identifiers with the iopen function If an error handler has been installed see ionerror and an iopen generates an error before a session has been established the handler will be called with the session identifier set to zero 0 Caution must be used if using the session identifier in an error handler Also it is possible for an iopen to succeed on a device that does not exist In this case other functions such as iread will fail with a nonexistent device error 294 Chapter 10 Creating A Device Session Creating An Interface Session Creating A Commander Session Return Value See Also SICL Language Reference IOPEN To create a device session specify a particular interface name
16. E1482 and VME 122 Enable Error handler 61 Events 54 55 Interrupt events 55 SRQ handlers 54 Enable Asynchronous Event Handlers 272 END Indicator 224 225 260 268 316 357 383 using with iscanf 319 END indicator 50 EOI See GPIB lines errhand c example 62 Error codes 190 Error handlers 61 Creating your own 63 Example 62 Troubleshooting 189 Error messages 190 Error routines 61 I ERROR EXIT 61 444 I ERROR _NO EXIT 61 Errors Codes 190 current handler setting 239 get error code 229 get error message 231 handlers 288 multiple threads 217 230 288 simulate 217 Troubleshooting 192 Events Asynchronous 54 Disable 55 Enable 54 55 Interrupts 55 SRQs 54 Events see Asynchronous Events Examples vximesdev c 108 Catching bus errors 117 errhand c 62 formatio c 49 gpiointr c 96 gpiomeas c 95 hpibdev c 75 hpibintr c 81 hpibstatus c 79 idn c 27 interrupts c 59 locking c 67 nonformatio c 53 serialdev c 149 serialintr c 154 vmeintr 127 vmeintr c 140 vxlintr c 120 vxiregdev c 114 Executing a program 31 F Features SICL 20 Field width 45 FIFO Transfers 300 313 File structure 390 SICL DIAG 396 SICL GPIO 392 SICL HPIB 392 SICL LAN 393 SICL LANSVR 393 SICL MAN 394 SICL MAN GPIO 394 SICL MAN HPIB 394 SICL MAN LAN 395 SICL MAN LANSVR 396 SICL MAN RS232 395 SICL MAN VXI 395 SICL PRG 391 SICL RS232
17. I GPIB BUS SYSCTLR Returns a 1 if the interface is the system controller 0 otherwise I GPIB BUS ACTCTLR Returns a 1 if the interface is the active controller 0 otherwise I_GPIB BUS TALKER Returns a 1 if the interface is addressed to talk 0 otherwise I GPIB BUS LISTENER Returns a 1 if the interface is addressed to listen 0 otherwise Chapter 10 247 SICL Language Reference IGPIBBUSSTATUS I_GPIB BUS ADDR Returns the bus address 0 30 of this interface on the GPIB bus I GPIB BUS LINES Returns the state of various GPIB lines The result is a bit mask with the following bits being significant bit 0 is the least significant bit Bit 0 1 if SRQ line is asserted Bit 1 1if NDAC line is asserted Bit 2 1 if ATN line is asserted Bit 3 1 if DAV line is asserted Bit 4 1if NRFD line is asserted Bit 5 1 if EOI line is asserted Bit 6 1 if IFC line is asserted Bit 7 1 if REN line is asserted Bit 8 1 ifin REMote state Bit 9 1 ifin LLO local lockout mode Bit 10 1 if currently the active controller Bit 11 1 if addressed to talk Bit 12 1 if addressed to listen Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIBPASSCTL IGPIBSENDCMD 248 Chapter 10 SICL Language Reference IGPIBGETT1DELAY IGPIBGETT1IDELAY Supported sessions 0 cece eee ees interface Affec
18. In this mode a computer that is not the controller is acting like a device on the GPIB bus In a commander session the data transfer routines work only when the GPIB interface is not active controller Addressing GPIB Commanders To create a commander session on your GPIB interface specify either the interface symbolic name or logical unit in the addr parameter followed by a comma and the string cmdr in the iopen function The interface symbolic name and logical unit are defined during the system configuration See the V O Libraries Installation and Configuration Guide for information on these values The following are example GPIB addresses for commander sessions hpib cmdr A commander session with the hpib symbolic name hpib2 cmdr A commander session with the hpib2 symbolic name 7 cmdr A commander session with the interface at logical unit 7 The above examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name orlogical unit specified during the configuration The name used in your SICL program must match the logical unit orsymbolic name specified in the system configuration Other possible interface names are GPIB gpib HPIB etc Chapter 4 85 Using SICL with GPIB Communicating with GPIB Commanders The following example opens a commander session the GPIB interface INST hpib hpib iopen
19. LAN and Signal Handling section in Chapter 8 Using SICL with LAN SICL hpib and vxi interfaces use an Unix signal to implement interrupts and SRQs The default SICL signal is SIGUSR2 This signal is managed completely by the SICL library Your application must avoid SICL s signal completely Do not attempt to mask it send it or install a handler for it If your application needs SIGUSR2 for some purpose other than SICL you can instruct SICL to use a different signal This is done with the isetsig function The following example selects signal 29 for SICL use isetsig 29 If you use iset sig you must call it before any other function in your program Also you must pick an alternate signal carefully to avoid conflicting with other Unix resources Chapter 3 57 Protecting I O Calls Against Interrupts Using SICL Using Asynchronous Events It is standard Unix behavior for I O calls like iread and iprintf to be interrupted when the process receives a signal If your process is not expecting to receive signals such I O side effects will probably be masked by the other standard behavior of unexpected signals death of your process If you are expecting signals you may not want them to abort SICL I O operations This can be solved by blocking or ignoring any expected signals while doing VO activity After I O is complete the original signal action can be restored The choice to block or ignore depends on the need of you
20. The file must be opened for writing No other modifiers or flags are valid with this conversion character Data The following table lists the types of data that each of the numeric formats Conversions accept d IEEE 488 2 HEX OCT BIN and NRf formats for example HA 012 B1010 10 10 00 and 1 00E 01 f IEEE 488 2 HEX OCT BIN and NRf formats for example HA 012 B1010 10 10 00 and 1 00E 01 i Integer Data with a leading 0 will be converted as octal data with leading 0x or 0X will be converted as hexadecimal u Unsigned integer Same as i except value is unsigned o Unsigned integer Data will be converted as octal x X Unsigned integer Data will be converted as hexadecimal e g Floating Integers floating point and exponential numbers will be converted into floating point numbers default is float Note that the conversion types i and d are not the same This is also true for f and e g Return Value This function returns the total number of arguments converted by the format string See Also IPRINTF IPROMPTF IFLUSH ISETBUF ISETUBUF TFREAD IFWRITE 328 Chapter 10 SICL Language Reference ISERIALBREAK ey ISERIALBREAK Supported sessions seerkry t ae r oa A eas interface Affected by functions 0 000005 ilock itimeout C Syntax include lt sicl h gt int iserialbreak id INST id Description The iserialbreak function is
21. define some aspects of configuration and sometimes you need to make changes to the default The VXI MXI configuration files specify some site dependent configuration rules and any changes from the default These files reside in the following directories VXI MXI Configuration Files File Name Directory Location vximanuf cf opt sicl vximodel cf opt sicl dynamic cf etc opt sicl vxiLU vmedev cf etc opt sicl vxiLU irgee etc opt sicl vxiLU cmdrsrvt cf etc opt sicl vxiLU names cf etc opt sicl vxiLU oride cf etc opt sicl vxiLU ttltrig cf etc opt sicl vxiLU Where LU is the logical unit of the VXI MXI interface Each file is explained in the following sections Appendix D 413 Customizing your VXI MXI System The VXI MXI Configuration Files The vximanuf cf Configuration File The vximanuf cf file contains a database that cross references the VXI manufacturer id numbers and the name of the manufacturer The ivxirm utility reads the manufacturer id number from the VXI device The ivxisc utility then uses that number and this file to print out the name of the manufacturer If you add a new VXI vendor that is not currently in the file you may want to add an entry to the file The vximodel cf Configuration File The vximodel cf file contains a database that lists a cross reference of manufacturer id model id and VXI device names The ivxirm utility reads the model id number f
22. dest unsigned long cnt int swap int ilblockcopy id src dest cnt swap INST id unsigned char src unsigned char dest unsigned long cnt int swap Note Not supported over LAN Description The three forms of iblockcopy assume three different types of data byte word and long word 8 bit 16 bit and 32 bit The iblockcopy functions copy data from memory on one device to memory on another device They can transfer entire blocks of data The id parameter although specified is normally ignored except to determine an interface specific transfer mechanism such as DMA To prevent using an interface specific mechanism pass a zero 0 for this parameter The svc argument is the starting memory address for the source data The dest argument is the starting memory address for the destination Chapter 10 213 SICL Language Reference IBLOCKCOPY data The cnt argument is the number of transfers bytes words or long words to perform The swap argument is the byte swapping flag If swap is zero no swapping occurs If swap is non zero the function swaps bytes if necessary to change byte ordering from the internal format of the controller to from the VXI big endian byte ordering Note Ifa bus error occurs unexpected results may occur Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IPEEK IPOKE IPOPFIFO IPUSH
23. ivxigettrigroute 369 449 ivxirm utility 425 ivxirminfo 370 ivxisc 421 ivxisc utility 428 ivxiservants 372 ivxitrigoff 373 ivxitrigon 375 ivxitrigroute 360 377 386 ivxiwaitnormop 379 ivxiws 380 iwaithdlr 56 381 iwblockcopy 213 iwpeck 229 296 iwpoke 229 298 iwpopfifo 300 iwpushfifo 313 iwrite 52 151 225 383 GPIO interface sessions 93 HP IB commander sessions 87 HP IB device sessions 74 HP IB interface sessions 78 LAN gatewayed sessions 174 VXI MXI device sessions 130 VXI MXI interface sessions 131 iwrite utility 408 ixtrig 151 359 360 384 GPIO interface sessions 93 HP IB interface sessions 78 L LAN Addressing LAN gatewayed sessions 169 client server 163 Communication sessions 169 Configuration 168 get gateway type 232 hostname 169 interface lock not supported 278 Interface sessions 176 IP address 169 networking protocols 166 Overview 163 Performance 168 Servers 167 450 set timeout 274 SICL functions 186 SICL LAN Protocol 166 Signal handling 184 software architecture 165 TCP IP Instrument Protocol 166 172 timeout value 273 Timeouts 178 timeouts with multiple threads 276 Troubleshooting 195 LAN client definition 163 LAN gatewayed sessions 169 Troubleshooting 195 197 LAN error Bad address 197 Connection refused 201 T O operation timesout 198 iopen fails 197 198 portmapper 201 RPC system error 201
24. logical unit lu information 237 logical unit lu list 238 serial status 336 session 233 294 295 set up serial characteristics 330 unlock 361 Interface sessions 40 Addressing 40 GPIO 92 GPIO addressing 92 GPIO example 95 HP IB communicating 77 HP IB example 79 81 LAN 176 Parallel 92 RS 232 150 RS 232 addressing 150 RS 232 communicating 150 RS 232 example 154 Serial 150 VXI MXI 103 VXI MXI addressing 118 VXI MXI communicating 118 VXI MXI example 120 Interrupt handlers 55 Example 59 Interrupts commander specific 345 347 348 350 data transfer 270 device specific 344 346 347 349 enable and disable 343 GPIB 344 GPIO 346 GPIO example 96 GPIO interface sessions 94 handler 291 handler address 240 HP IB device sessions 74 HP IB interface sessions 78 interface specific 344 346 347 349 multiple threads 382 nesting 272 RS 232 device sessions 148 RS 232 interface sessions 153 serial RS 232 347 set for commander session 344 set for device session 343 set for interface session 343 VME 125 VXI 349 VXI MXI 138 interrupts c example 59 Invalid address 194 Invalid INST 194 ionerror 61 288 ionintr 55 291 LAN interface sessions 177 ionsrq 54 148 152 293 LAN interface sessions 177 iopen 28 226 229 294 iopen fails 194 197 198 IP address 169 ipeek 114 125 296 ipeek utility 405 ipeek 16x 297 i
25. reg 0x0 static void int hndlr INST id long reason long sec printf VME interrupt reason Ox x sec Ox x n reason sec intr 1 140 Chapter 6 Note Using SICL with VXI MXI Summary of VXI MXI Specific Functions Summary of VXI MXI Specific Functions Using these VXI interface specific functions means that the program can not be used on other interfaces and therefore becomes less portable These functions will work over a LAN gatewayed session if the server supports the operation SICL VXI MXI Functions Function Name Action ivxibusstatus ivxigettrigroute ivxirminfo ivxiservants ivxitrigoff ivxitrigon ivxitrigroute ivxiwaitnormop ivxiws Chapter 6 Returns requested bus status information Returns the routing of the requested trigger line Returns information about VXI devices Identifies active servants De asserts VXI trigger line s Asserts VXI trigger line s Routes VXI trigger lines Suspends until normal operation is established Sends a word serial command to a device 141 Using SICL with VXI MXI Summary of VXI MXI Specific Functions 142 Chapter6 Using SICL with RS 232 Using SICL with RS 232 RS 232 is a serial interface that is widely used for instrumentation Although it is slow in comparison to GPIB or VXI its low cost makes it an attractive solution in many situations Because SICL uses the built in RS 232 facilities controlling RS 232 instru
26. see the 3t conversion character to change this feature It also flushes immediately after the write portion of the ipromptf function It may occasionally be flushed at other non deterministic times such as when the buffer fills When the write buffer flushes it sends its contents The read buffer is maintained by the iscanf and the read portion of the ipromptf functions It queues the data received until it is needed by the format string The read buffer is automatically flushed before the write portion of an iprompt f Flushing the read buffer destroys the data in the buffer and guarantees that the next call to iscanf or ipromptf reads data directly rather than data that was previously queued 50 Chapter 3 Note Using SICL Sending I O Commands Flushing the read buffer also includes reading all pending response data from a device If the device is still sending data the flush process will continue to read data from the device until it receives an END indicator from the device See the isetbuf function for other options for buffering data Overview of The following set of functions are related to formatted I O Formatted I O F ifread F ifwrite iprintf P iscanf ipromptf iflush isetbuf isetubuf Chapter 3 Obtains raw data directly from the read formatted I O buffer This is the same buffer that iscanf uses Writes raw data directly to the write formatted I O buffer This is the sam
27. syntax erro 197 Unrecognized symbolic name 197 LAN interface sessions iabort 177 iclear 177 igetluinfo 177 ionintr 177 ionsrq 177 LAN manuals 24 LAN server Appears hung 200 definition 163 Description of 167 LAN gatewayed sessions 169 portmapper error 201 RPC system error 201 siclland daemon 199 Troubleshooting 195 199 LAN HP IB Gateway manual 24 LAN gatewayed sessions 169 idrvrversion 174 iread 174 iwrite 174 LAN to Instrument Gateway 164 Link errors Troubleshooting 192 Linking 29 Archive libraries 400 Listener GPIB 247 Little endian Byte Order 355 LLO See GPIB lines Local Lockout GPIB 248 250 Local Mode 277 Lock 278 commander 279 device 279 hangs due to 278 interface 278 nesting 279 361 unlock 361 wait status 351 Lock actions 65 Locking 64 Example 67 Locking Multi user environment 66 locking c example 67 Lockwait Flag Status 235 Logical Unit address 236 information 237 list 238 M man pages 32 Manuals GPIO Interface 23 HP IB Interface 23 HP UX 23 LAN 24 LAN HP IB Gateway 24 Series 700 Computer 23 Series 700 RS 232 23 SICL 22 VXI MXI 24 Manufacturer id 414 Map memory 280 283 Mapping memory 32 bit access 114 Register based devices 112 VEM devices 126 Memory N get hardware contraint information 286 hardware constraints 282 285 map 280 283 read 296 297 unmap 362 write 298 299 Memory m
28. unsigned long actualcnt Description This function reads raw data from the device or interface specified by id The buf argument is a pointer to the location where the block of data can be stored The bufsize argument is an unsigned long integer containing the size in bytes of the buffer specified in buf The reason argument is a pointer to an integer that on exiting the iread call contains the reason why the read terminated If the reason parameter contains a zero 0 then no termination reason is returned Reasons include I_TERM MAXCNT bufsize characters read I_TERM END END indicator received on last character I_TERM CHR Termination character enabled and received The actualcnt argument is a pointer to an unsigned long integer Upon exit this contains the actual number of bytes read from the device or interface If the actualcnt parameter is NULL then the number of bytes read will not be returned For LAN if the client times out prior to the server the actualcnt returned will be 0 even though the server may have read some data from the device or interface Chapter 10 315 SICL Language Reference IREAD This function reads data from the specified device or interface and stores it in buf up to the maximum number of bytes allowed by bufsize The read terminates only on one of the following conditions e It reads bufsize number of bytes It receives a byte with the END indicator attached e It recei
29. void proc Where void proc id error INST id int error The routine proc is the error handler and is called whenever a SICL error occurs Two special reserved values of proc may be passed to the ionerror function _ERROR_EXIT This value installs a special error handler which will print a diagnostic message and then terminate the process _ERROR_NO EXIT This value installs a special error handler which will print a diagnostic message and then allow the process to continue execution This mechanism has substantial advantages over other I O libraries because error handling code is located away from the center of your application This makes the application easier to read and understand Chapter 3 61 Using SICL Using Error Handlers Error Handler Example Typically in an application error handling code is intermixed with the I O code However with SICL error handling routines no special error handling code is inserted between the I O calls Instead a single line at the top calling ionerror installs an error handler that gets called any time a SICL call results in an error In this example a standard system defined error handler is installed that prints a diagnostic message and exits errhand c This example demonstrates how a SICL error handler can be installed include lt sicl h gt include lt stdio h gt main INST dvm double res
30. 0 0 0 0 30 0 O O O Single Device X X ultiple Devices VME Failed XI Bus 127 Device Logical Addresses 127 130 VXI Bus 130 Device Logical Addresses 130 136 145 147 Slots Ov SLi 22 3 24r E Ge I BO EO LT 12 Empty O O 0 070 0O 0O 07 Single Device X X X X ultiple Devices VME Failed VXI Device Table Name LADD Slot Bus Manufacturer Model v700ctlr 0 0 0 Hewlett Packard E1497 Series 700 Controller vximxi 127 6 0 National Instrum VXI MXI Extender hpvximxi 130 127 Hewlett Packard E1482 VXI MXI Extender pwrmeter 136 3 130 Hewlett Packard E1416 Power Meter 2 4 dev1 145 130 Racal Dana Oxfff0 dvm 147 130 Hewlett Packard E1326 5 1 2 digit DVM MXI device Appendix D 429 Customizing your VXI MXI System ivxisc ivxisc Output example cont VME Device Table Name Bus Slot Space Size No VME cards configured Failed Devices Name Bus Slot Manufacturer Model No FAILED devices detected Protocol Support Msg Based Devices Name CMDR SIG MSTR INT FHS SMP RG EG ERR PI PH TRG 14 I LW ELW 1 3 v700ctlr X X X X X X X pwrmeter X X X X X X X X dev1 X X X Commander Servant Hierarchy v700ctlr pwrmeter dev1 dvm vximxi hpvximxi Memory Map A24 Device Name A32 Device Name No devices mapped into A32 space 430 Appendix D Customizing your VXI MXI System ivxisc ivxisc Output example cont Interrupt Request Lines Handler In
31. 10 C Syntax Description Note Return Value See Also SICL Language Reference ITERMCHR ITERMCHR Supported sessions 0005 device interface commander include lt sicl h gt int itermchr id tchr INST id int tchr By default a successful iread only terminates when it reads bufsize number of characters or it reads a byte with the END indicator The itermchr function permits you to define a termination character condition The tchr argument is the character specifying the termination character If tchr is between 0 and 255 then i read terminates when it reads the specified character If tchr is 1 then no termination character exists and any previous termination character is removed Calling itermchr affects all further calls to iread and ifread until you make another call to itermchr The default termination character is 1 meaning no termination character is defined The iscanf function terminates reading on an END indicator or the termination chqaracter specified by itermchr For C programs this function returns zero 0 if successful or a non zero error number if an error occurs TREAD IFREAD IGETTERMCHR Chapter 10 357 SICL Language Reference ITIMEOUT ITIMEOUT Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int itimeout id tval INST id long tval Description The itimeout function is used t
32. 227 IGE TDEVAD DR e ae eE Geld R E E AE E AE aE ETET 228 IGETERRNO S eae ttai A EE E a a E 229 IG ETERRS TR sig orien E a E T A 231 IGETGATEWAY T YPE ceinen en i e A ART a E 232 IGETINTESES S aE doc vt se vests EER EER 233 IGETINTFETY PE eroinei e a a A EASE 234 IGETEOCKWAF E reiese o e ea E E E E A AE EA 235 IGET rast loins rans aeee En EAA ENE E PA E VE A RAE 236 IGFETLU N O a a a a a A a ESE AE Ea aS a 237 ILG BA M EDI E DE EE A TN 238 IGETONERROR sourit eroa ent a a a an Saa 239 IGETONI N ER retino a AEAN TAR R N AEE A TARE 240 IGETONS RO iia a a aa a a E RS 241 TGETSESSEYR Prunete n a a N AN 242 IGETTERMCHR ioin eia e A N AS G 243 IGETTIMEOUT miea ae E E T EE A AN 244 TGPIBATNG TI ra A A ER EAEE A ORR 245 IGPIBBUSA DDR onsena a n a a i ieee 246 IGPIBBUSSTAT US orirun ee ia a a ES N 247 IGPIBGETTIDELAY vi ciccesisistessbecsescsses ees apat tanna ke aasit eiai ioraa 249 Contents 11 TGPIBLT5O wiscl ress stees a station teenteadeantena edu co senurs E S 250 TGPYBPA SS CT Doessssssasecssaiscaesapusssecsoniessassbevdaisesvtsisiaescsvoenactbuasiosstbseetse 251 IGPIBPPOLL iieii ck eg le Meals rc rea 252 IGPIBPPOLLCONFIG cccccorsssesccosssvescarsessssceneesssecanstsessecsensutsessssuesees 253 TG PIBPPORE RESP ccartns uacauerinaiccac treat a 254 IGPIBRENCTL RC ne eee Pe ie EOE OT Ol SION 255 IGPIBSENDCMD i a Noelia ates este ttl a dactiatte 256 IGPRBSE TTD BE AV otsscia tucxansicilbucala tein tvcediarnt nts tidoutteartaseass
33. 232 Port Allocation and HP UX termio Functions 06 202 Data Received from Instrument is Garbled ce eeeeceeteeteenees 203 Data Lost During Large Transfers 00 0 0 ceceeccecceeeeeceneeeeeeeeeteeaeenee 203 Troubleshooting SICL over GPIO cccescceeseesseeteceteceteeeeeeeeesseneeees 204 Bad Address for iopen ceccecsseeseceteceteeeeceeeceeecseeeecnaeeeeeeneensees 204 Operation Not Supported ccccecccssecsseeseceeeeeeeeseeeeceeeeneeeneeesees 205 ING DEVICE aaneen so rae sont a S cota tase e a E S 206 Contents 10 Generic I O Error ccccccccccccccscccceceesssscesceecessssscesescessesssssesceesessaseesecs 206 Bad Parameter eese n ccvettdgeedetoseuuvlccdeeslesseveleavevebe 207 Where to Find Additional Information 00cccccceecssceseeeeesessseseeseeees 208 10 SICL Language Reference TABOR T resons ias ro eiras aoii aea aaen tea aeea ae aatia 212 TBEOCK COPY mirer a E A T hs Beat thes 213 IBEOEKMOVEX ot iai t RA EAE ER ERE EEEE 215 ICAUSEERR onina eie a e E E E AE 217 TICEFA R e A E A Ee a ea a ea E E 218 ICLOSE AtA A EE E E E E E ta preutiaus 219 IDEREFPTR perea A E E E EEEE 220 FLUSH a aae aa aS aa a E A A a R 221 TE REA D ea E E EA A AEN E e 223 FWRI E errai arrera e anote a ea aa na So aun EE hanai eeo pera Sesoni 225 IGE TADIDRsiancctsintcsteiapostiinssclenascttueceel sees teste ash tines seine ots ARRENE 226 IGETDA TA npon ites cantons oandutonpiurgieaderaagestebendueysesteveaondvsngsadavnass
34. 257 TGPUO ET Rs saccus tes lsstiir itta betecci bs tetas chgrackstacie Ger tachstarbedcCashtentvehst 258 IGPIOGET WIDTH mana n castes cence ee tant Fact ata ay 263 IGPIOSETWIDTH sachet errn rnn 264 IGPIOSTA Tea re a Tee t ra tata NE 266 TELUNUT EA EE EEE Santos oanuaceinavten 269 NIRO ates crate aan eA A E A 271 INTRON ten aa ete cen aiia a n oases 272 ILANGETTIMEOUT i re ton tnt aide ta ates casecnauicla wate 273 MAIEV TE OUT se ier oye nania a aaaea 274 TOCA rare an en Genan aot a tennant ace nese 277 OCK cc fda dette acon hn cere deh eats aac kt 278 TINEA Ds E hietat teu aes cles Daalen Date E EA 280 TNA E E tala hacky uh ok cot cent E E memes he 283 TILA sects oescrs tases sz ccnctatsastetasadtededastdentestdeslanedstnaboriauechaweess 286 TONER OR cose sesstse sexta tan sei om aren a a cao tle 288 TONNER O E EEA ccc te ra dee eae ace cal ee 291 POR ce a ea e a ert e alot 293 IAIN E E E E A 294 Pe A T E A A A A E A 296 IPEEKX8 IPEEKX16 IPEEKX32 innr 297 POK es la hte es E A ea tneedi ua 298 IPOKEX8 IPOKEX16 IPOKEX32 l enn 299 PORRO mer ooren tarutrd me ann a A areata 300 TBR TNR si toutes Sod cae Re fase Assocs tac ceee uae ETE 302 IPROMPI Bo ce sce a a e a Oath Relient 312 AOSE TAO AE Baers Yacish E aeaeeet i ec hia 313 TIRE AD seco A tatsanrectuseade ia thes EENEN 315 READS ID eed case caste a tee rea alte tenet n aa tenets 317 MADIO EEE A teeta E 318 SCAN ino aa a a twit a NE 319 Contents 12 ISERIAL BREAK ciiie
35. 32 bit transfers with the E1489 use I MAP A16 D32 I MAP A24 D32 and1 MAP A32_ D32 in place of I MAP A16 I MAP A24 and I MAP A32 when mapping to D32 devices The suggested argument if non NULL contains a suggested address to begin mapping memory However the function may not always use this suggested address After memory is mapped it may be accessed directly Since this function returns a C pointer you can also use C pointer arithmetic to manipulate the pointer and access memory directly Note that accidentally accessing non existent memory will cause bus errors Refer to Chapter 6 of this manual for an example of trapping bus errors Or see your operating system s programming information for help in trapping bus errors You will probably find this information under the command signal in your operating system s manuals Chapter 10 281 Note Return Value See Also SICL Language Reference IMAP Due to hardware constraints on a given device or interface not all address spaces may be implemented In addition there may be a maximum number of pages that can be simultaneously mapped If a request is made that cannot be granted due to hardware constraints the process will hang until the desired resources become available To avoid this use the isetlockwait command with the flag parameter set to 0 and thus generate an error instead of waiting for the resources to become available You may also use the imapinfo function to
36. C Syntax include lt sicl h gt int ivxitrigroute id in which out which INST id unsigned long in which unsigned long out which Description The ivxitrigroute function routes VXI trigger lines With some VXI interfaces it is possible to route one trigger input to several trigger outputs The in_which parameter may contain only one of the valid trigger values The out_which may contain zero one or several of the following valid trigger values I TRIG ALL I TRIG TTI I TRIG TTI I TRIG TTI I TRIG TTI I TRIG TTI I TRIG TT I TRIG TTI I TRIG TTI I TRIG EC LO L1 i2 L3 L4 L5 L6 L7 I TRIG EC Chapter 10 All standard triggers for this interface that is the bit wise OR of all valid triggers out_which ONLY TTL Trigger Line 0 TTL Trigger Line 1 TTL Trigger Line 2 TTL Trigger Line 3 TTL Trigger Line 4 TTL Trigger Line 5 TTL Trigger Line 6 TTL Trigger Line 7 ECL Trigger Line 0 ECL Trigger Line 1 377 SICL Language Reference IVXITRIGROUTE I TRIG ECL2 ECL Trigger Line 2 I TRIG ECL3 ECL Trigger Line 3 I TRIG EXTO External BNC or SMB Trigger Connector 0 I TRIG EXT1 External BNC or SMB Trigger Connector 1 The in_which parameter may also contain I TRIG CLKO Internal clocks provided by the controller implementation specific I TRIG CLK1 Internal clocks provided by the controller implementation specific I TRIG CLK2 Internal clocks provid
37. Control iclear ireadstb isetstb itrigger e Service Requests igetonsrgq ionsrg Timeouts igettimeout itimeout VXI Specific ivxiws All other functions will work with all VXI MXI devices message based register based etc Use the i peek and i poke functions to communicate with register based devices Interface Sessions The following describes how some SICL functions are implemented for VXI MXI interface sessions iwrite and iread iclear Chapter 6 Not supported for VXI MXI interface sessions and return the ERR _NOTSUPP error Causes the VXI MXI interface to perform a SYSREST on interface sessions Note that this will cause all VXI MXI devices to reset 131 Using SICL with VXI MXI Using SICL Trigger Lines Using SICL Trigger Lines VXI controller can implement a subset of the trigger lines supported by SICL See the documentation that came with your VXI controller for specifics These values may be passed to the ivxitrigorisetintr function Trigger Lines SICL TRIG_TTLO TRIG_TTL1 TRIG_TTL2 TRIG_TTL3 TRIG_TTL4 TRIG_TTLS5 TRIG_TTL6 TRIG_TTL7 TRIG_ECLO TRIG_ECL1 TRIG_ECL2 TRIG_ECL3 TRIG_EXTO TRIG_EXT1 TRIG_EXT2 TRIG_EXT3 TRIG_CLKO TRIG_CLK1 TRIG_CLK2 TRIG_CLK10 TRIG_CLK100 The I TRIG_CLKO is the internal 16 MHz clock This trigger line can ONLY be routed out 132 Chapte
38. ILOCAL and the interface specific chapter in this manual for details of implementation 318 Chapter 10 C Syntax Description Notes on Using iscanf SICL Language Reference ISCANF Supported sessions 00005 device interface commander Affected by functions 0 000005 ilock itimeout include lt sicl h gt int iscanf id format arg arg2 int isscanf buf format arg1 arg2 int ivscanf id format va_list ap int isvscanf buf format va_list ap INST id char buf const char format ptr argl arg2 va_list ap These functions read formatted data convert it and store the results into your args These functions read bytes from the specified device or from buf and convert them using conversion rules contained in the format string The number of args converted is returned The format string contains e White space characters which are spaces tabs or special characters e An ordinary character not which must match the next non white space character read from the device e Format conversion commands Use the white space characters and conversion commands explained later in this section to create the format string s contents e Using itermchr with iscanf The iscanf function only terminates reading on an END indicator or the termination character specified by itermchar Chapter 10 319 SICL Language Reference ISCANF e Using i
39. LAN server See the I O Libraries Installation and Configuration Guide for information The example programs shown in this chapter are also provided in the opt sicl share examples directory This chapter contains the following sections Overview of SICL LAN Considering LAN Configuration and Performance e Communicating with Devices over LAN e Using Timeouts with LAN Using Signal Handling with LAN Summary of LAN Specific Functions 162 Chapter 8 Using SICL with LAN Overview of SICL LAN Overview of SICL LAN The LAN software provided with SICL uses the client server model of computing Client server computing refers to a model where an application the client does not perform all the necessary tasks of the application itself Instead the client makes requests of another computing device the server for certain services Examples that you may have in your workplace include shared file servers print servers or database servers The use of LAN for instrument control also provides other advantages associated with client server computing Resource sharing by multiple applications people within an organization e Distributed control where the computer running the application controlling the devices need not be in the same room or even the same building as the devices themselves As shown in the following figure a LAN client computer system such as a Series 700 HP UX Workstation makes SICL requests over the net
40. The SICL Utilities iwrite iwrite Syntax iwrite s size t timeout e 0 1 v sym_name Description iwrite is the SICL utility for writing data to a device The input of iwrite comes from stdin The write is terminated only when size number of bytes is written or a timeout occurs The sym_name is the SICL symbolic name of the device Note that iwrite is only supported for device addresses The parameter definitions follow s size Specifies the number of bytes to read t timeout Specifies the timeout value in milliseconds e O 1 Set to non zero if the END indicator should be given on the last byte of the block or zero if it should not Note that if this parameter is not specified iwrite will default to giving the END indicator on the last byte of the block Vv Turns on verbose mode Prints the usage of the iwrite program Example iwrite hpib 16 408 Appendix C Customizing your VXI MXI System Customizing your VXI MXI This appendix describes what files you would edit to customize your VXI MXI system Additionally the VXI MXI specific utilities are described This chapter contains the following sections Overview of VXI MXI Configuration The VXI MXI Resource Manager The VXI MXI Configuration Files The VXI MXI Configuration Utilities 410 Appendix D Note These utilities and configuration files are only provided with the SICL VXI Customizing your VXI MXI System Overview of VX
41. The secval parameter contains a bit mask specifying which triggers can cause an interrupt See the ixtrig function s which parameter for a list of valid values Individual interfaces may include other interface interrupt conditions See the following information on each interface for more details Valid intnum values for all commander sessions except RS 232 and GPIO which do not support commander sessions are I INTR STB I_INTR_DEVCLR Interrupt when the commander reads the status byte from this controller Enable if secval 0 disable if secval 0 Interrupt when the commander sends a device clear to this controller on the given interface Enable if secval 0 disable if secval 0 Interrupts on GPIB Device Session Interrupts There are no device specific interrupts GPIB for the GPIB interface GPIB Interface Session Interrupts The interface specific interrupt for the GPIB interface is I INTR_GPIB IFC 344 Interrupt when an interface clear occurs Enable when secval 0 disable when secval 0 This interrupt will be generated regardless of whether this interface is the system controller or not that is regardless of whether this interface generated the IFC or another device on the interface generated the IFC Chapter 10 SICL Language Reference ISETINTR The following are generic interrupts for the GPIB interface I_INTR_INTFACT I_INTR_INTFDEACT Interrupt occurs whenever this controller b
42. VXI devices run the Resource Manager ivxirm without the VME devices installed Then edit the vmedev cf file to specify the appropriate address range This will prevent the Resource Manager ivxirm from assigning the address range used by the VME device to any VXI device The A24 and A32 address range is software programmable for VXI devices When a VME device is accessed via an E1482 VXI MXI Extender Bus you must declare the bus for a given VME device The bus is declared as described in the previous section in the vmedev cf file For devices ina VXI MXI system use the logical address of the E1482 in the mainframe as the bus Additionally since VME devices mapped in A16 address space are required to the use the lower 75 of A16 address space the A16 Window Map Register of the E1482 must be programmed To program this register you must edit the etc opt sicl vxil6 oride cf file to open an A16 122 Chapter 6 Note Using SICL with VXI MXI Communicating with VME Devices address window for the device An entry to this file changes the value SICL writes to the A16 window map register of the E1482 The oride cf file contains the logical address of the VXI MXI Bus Extender card the offset value and the value written to the register See the Register Description appendix of the E1482 user s manual for information on the value that should be placed in the oride cf file When using this appendix it is important to note that SICL
43. _SYMNAME ERR SYNTAX I_ERR_TIMEOUT I_ERR_VERSION Error String No Error Interface is not active Interface not locked Permission denied Out of resources Operation not implemented Operation not supported Generic O S error Arithmetic overflow Invalid parameter Invalid symbolic name Syntax error Timeout occurred Version incompatibility Description No SICL error returned function return value is zero 0 Tried to specify an interface session when it is not active available or does not exist An iunlock was specified when device wasn t locked Access rights violated No more system resources available Call not supported on this implementation The request is valid but not supported on this implementation Operation not supported on this implementation SICL encountered an operating system error Arithmetic overflow The space allocated for data may be smaller than the data read The constant or parameter passed is not valid for this call Symbolic name passed to iopen not recognized Syntax error occurred parsing address passed to iopen Make sure that you have formatted the string properly White space is not allowed A timeout occurred on the read write operation The device may be busy in a bad state or you may need a longer timeout value for that device Check also that you passed the correct address to iopen The iopen call has encountered a SICL library that is newer
44. are trying to communicate with is not responding Or insufficient time was allowed for the operation in which case a longer timeout is needed You may be trying to communicate with a device that is not available on the bus Check the device address iopen fails with an invalid address For example ERROR hpib2 16 Invalid address Possible Solution This error indicates that the address specified is not valid Several things can cause this First of all you may be attempting to communicate with a non existent interface First check that the interface name in the SICL configuration is correct Second you may have an invalid address Check the address limitations See the addressing section in the interface specific chapter Invalid INST when trying to communicate with a session For example ERROR Invalid INST Possible Solution This error indicates that a session for the listed INST is not valid Make sure you opened a communications session using the iopen function 194 Chapter 9 Troubleshooting Your SICL Program Troubleshooting SICL over LAN Client and Server Troubleshooting SICL over LAN Client and Server Before SICL LAN can be expected to function the client must be able to talk to the server over the LAN Use the following techniques to determine whether the problem you are experiencing is a general network problem or is specific to the SICL LAN software e If your application is unable to open a se
45. be used By default VXI processing of the IACK value will be used However if you configure VME IRQ lines and VME Only no VXI processing of the IACK value will be done That is the IACK value will be passed to a SICL interrupt handler directly See the I O Libraries Installation and Configuration Guide for information on configuring for VME Only Also see isetintr in Chapter 10 for information on the VME interrupts Chapter 6 125 Note Using SICL with VXI MXI Communicating with VME Devices VME Example When you have a VME device that requires A16 address space that is accessed via an E1482 VXI MXI Extender Bus card you need to make an entry in the etc opt sicl vxil6 oride cf file to open an A16 address window The following is an example entry that opens a 512 byte window in A16 address space starting at address 0x7000 with the E1482 at logical address 1 1 0xC 0x6770 When you have a VME device that requires A24 or A32 address space you need to make an entry in the etc opt sicl vxil6 vmedev cf file to reserve the appropriate address range The following is an example entry for a VME device in slot 6 of a VXI cardcage The cardcage is accessed by an embedded controller or top level MXI bus The device requires 4096 bytes of A24 address space starting at address 0x400000 and uses IRQ line 3 vmedev1 O 6 A24 0x400000 0x1000 3 Where vmedev1 is the name of the device O is the logical address of the device through whi
46. contents of the u_info structure is implementation dependent The structure can contain any amount of non standard implementation dependent fields However the structure must always contain the above fields If you are programming in C please refer to the sic1 h file to get the exact u_info syntax Note that igetluinfo will return information for valid local interfaces only not remote interfaces being accessed via LAN For C programs this function returns zero 0 if successful or a non zero error number if an error occurs IOPEN IGETLU IGETLULIST Chapter 10 237 C Syntax Description Return Value See Also SICL Language Reference IGETLULIST IGETLULIST include lt sicl h gt int igetlulist lulist int lulist The igetlulist function stores in lulist the logical unit interface address of each valid interface configured for SICL The last element in the list is set to 1 This function can be used with igetluinfo to retrieve information about all local interfaces For C programs this function returns zero 0 if successful or a non zero error number if an error occurs TOPEN IGETLUINFO IGETLU 238 Chapter 10 SICL Language Reference IGETONERROR IGETONERROR C Syntax include lt sicl h gt int igetonerror proc void proc INST int Description The igetonerror function returns the current error handler setting This function stores the
47. determine hardware constraints before making an imap call Remember to iunmap a memory space when you no longer need it The resources may be needed by another process For C programs this function returns a zero 0 if an error occurs or a non zero number if successful This non zero number is the address to begin mapping memory TUNMAP IMAPINFO 282 Chapter 10 SICL Language Reference IMAPX ae Supported sessions 00005 device interface commander Affected by functions 0 000000 eae ilock itimeout C Syntax include lt sicl h gt unsigned long imapx id mapspace pagestart pagecnt INST id int mapspace unsigned int pagestart unsigned int pagecnt Note Not supported over LAN Description The imapx function returns an unsigned long number used in other functions that maps a memory space into your process space The SICL ipeek x and ipoke x functions can then be used to read and write to VXI address space The id argument specifies a VXI interface or device The pagestart argument indicates the page number within the given memory space where the memory mapping starts The pagecnt argument indicates how many pages to use The map_space argument will contain one of the following values I MAP A16 Map in VXI A16 address space 64 Kbyte pages I MAP A24 Map in VXI A24 address space 64 Kbyte pages I MAP A32 Map in VXI A32 address space 64 Kbyte pages I MAP VXIDEV M
48. device Use interface session locks in your own program if these applications may be running simultaneously with your program 64 Chapter3 Using SICL Using Locking Not all SICL routines are affected by locks Some routines that simply set or return session parameters never touch the interface hardware and therefore work without locks Each function defined in Chapter 10 has a section Affected by functions that lists the keyword LOCK if the function is affected by locks Functions without this keyword are not affected Lock Actions If a session tries to perform any SICL function that obeys locks on an interface or device that is currently locked by another session the default action is to suspend the call until the lock is released or if a timeout is set until it times out This action can be changed with the iset lockwait function see Chapter 10 for a full description If the iset Llockwait function is called with the flag parameter set to 0 zero the default action is changed Rather than causing SICL functions to suspend an error will be returned immediately To return to the default action or to suspend and wait for an unlock call the isetlockwait function with the flag set to any non zero value Chapter 3 65 Using SICL Using Locking Locking in a Multi user Environment In a multi user multi process environment where devices are being shared it is a good idea to use locking to help ensure exclusive use of a par
49. enable asynchronous event handlers 272 Error 61 error 288 error handler setting 239 Interrupt 55 interrupt 291 interrupt handler address 240 remove interrupt handler 292 remove SRQ handler 293 service request SRQ 293 SRQ 54 SRQ handler address 241 timeout 381 Wait for 56 wait for 381 Header file sicl h 37 Help Online 32 Hostname LAN 169 HP IB 77 Addressing commander sessions 85 Addressing device sessions 72 Communicating with commanders 85 Communicating with interfaces 77 Device session example 75 Device sessions 72 Interface session example 79 81 Primary address 73 Secondary address 73 SICL functions 88 HP IB commander sessions iread 87 ireadstb 87 iwrite 87 HP IB device sessions iclear 74 Interrupts 74 iread 74 ireadstb 74 itrigger 74 iwrite 74 Service requests 74 HP IB interface manuals 23 HP IB interface sessions iclear 78 Interrupts 78 iread 78 itrigger 78 iwrite 78 ixtrig 78 Service requests 79 HP IB See GPIB hpibdev c example 75 hpibintr c example 81 hpibstatus c example 79 HP UX Signals 57 HP UX 9 Updating SICL to 10 399 HP UX manuals 23 Hung LAN server 200 I T O operation timesout 198 I ERR _NOLOCK 64 I ERROR EXIT 61 I_ERROR_NO EXIT 61 I_ORDER BE 356 I ORDER LE 356 iabort 212 LAN interface sessions 177 ibblockcopy 213 iblockcopy 213 iblockmovex 215 ibpeek 229 296 ibpoke 229 298 ibpopfifo 300 ibpushfifo 3
50. error number See Also ISETINTR IGETONINTR IWAITHDLR IINTROFF IINTRON and the section titled Asynchronous Events and HP UX Signals in Chapter 3 of this manual for protecting I O calls against interrupts 292 Chapter 10 C Syntax Description Return Value See Also SICL Language Reference IONSRQ IONSRQ Supported sessions 00 c cece eee eee ees device interface include lt sicl h gt int ionsrq id proc INST id void proc id INST id Use the ionsrq function to notify an application when an SRQ occurs This function installs the procedure proc as an SRQ handler An SRQ handler is called any time its corresponding interface generates an SRQ Ifan interface device driver receives an SRQ and cannot determine the generating device for example on GPIB it passes the SRQ to all SRQ handlers assigned to the interface Therefore an SRQ handler cannot assume that its corresponding device actually generated an SRQ An SRQ handler should use the ireadstb function to determine whether its corresponding device generated the SRQ It calls proc with the following parameters void proc id INST id To remove an SRQ handler pass a zero 0 as the proc parameter This function returns zero 0 if successful or a non zero error number if an error occurs IGETONSRQ IWAITHDLR IINTROFF INTRON TREADSTB Chapter 10 293 C Syntax
51. example 114 Register Based devices 104 Resource Manager 412 SICL functions 141 VME devices 121 VXI MXI device sessions 103 Example 108 114 iclear 130 ionsrq 130 iread 130 ireadstb 130 itrigger 130 iwrite 130 VXI MXI interface sessions 103 Example 120 iclear 131 ireadiread VXI MXI interface sessions 131 iwrite 131 VXI MXI manuals 24 VXI MXI model number 414 VXI MXI Register Based devices 130 VXI MXI trigger lines 132 vxlinfo Structure 370 vxiintr c example 120 vximanuf cf file 414 vximodel cf file 414 vxiregdev c example 114 455 W Wait for handlers 56 381 for normal VXI operation 379 Wait lock status 351 Word serial Commands VXT 380 Write buffered data 225 formatted data 302 312 memory 298 299 unformatted data 383 456
52. gateway to access the remote interface I_INTF NONE The session is not using a gateway Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also Chapter 8 Using SICL with LAN 232 Chapter 10 C Syntax Description Return Value See Also SICL Language Reference IGETINTFSESS IGETINTFSESS Supported sessions 00 000 cece eee eee ee device commander include lt sicl h gt INST igetintfsess id INST id The igetintfsess function takes the device session specified by id and returns a new session id that refers to an interface session associated with the interface that the device is on Most SICL applications will take advantage of the benefits of device sessions and not want to bother with interface sessions Since some functions only work on device sessions and others only work on interface sessions occasionally it is necessary to perform functions on an interface session when only a device session is available for use An example is to perform an interface clear see iclear from within an SRQ handler see ionsrq In addition multiple calls to iget int fsess with the same id will return the same interface session each time This makes this function useful as a filter taking a device session in and returning an interface session SICL will close the interface session when the device or commander session is closed Therefore
53. handlers GPIO Interface There are specific interface session interrupts that can be used See Session i setintr in Chapter 10 for information on the interface session interrupts Interrupts for GPIO 94 Chapter5 Using SICL with GPIO Communicating with GPIO Interfaces GPIO Interface Session Example gpiomeas c This program does the following Creates GPIO session with timeout and error checking Signals the device with a CTLO pulse Reads the device s response using formatted I O y include lt sicl h gt main INST id interface session id float result data from device log message and exit program on error ionerror I_ ERROR EXIT open GPIO interface session with 10 second timeout xy id iopen gpio itimeout id 10000 setup formatted I O configuration igpiosetwidth id 8 igpioctrl id I _ GPIO READ EOI n monitor the device s PSTS line igpioctrl id I GPIO CHK PSTS 1 signal the device to take a measurement itrigger id get the data iscanf id Sf S t amp result printf Result Sf n result close session iclose id Chapter 5 95 Using SICL with GPIO Communicating with GPIO Interfaces GPIO Interrupts Example gpiointr c This program does the following Creates a GPIO session with error checking Installs interrupt handler amp enables EIR
54. id I BUF READ iscanf id 1f amp res3 iflush id I_BUF_READ Use the t conversion to read to the end of the buffer and discard the characters read if the last character has an END indicator iscanf id 1 t amp resl iscanf id S1f t amp res2 White Space White space characters are spaces tabs or special characters For C C Characters for the white space characters consist of a backslash followed by another C C character The white space characters are t The ASCII TAB character v The ASCII VERTICAL TAB character E The ASCII FORM FEED character space The ASCII space character Chapter 10 321 SICL Language Reference ISCANF Format An iscanf format conversion command begins with a character After the Conversion gt character the optional modifiers appear in this order an assignment Commands suppression character field width a comma and array size comma operator and an argument modifier The command ends with a conversion character conv char ai a argument modifier Y Veale width size The modifiers in a conversion command are field width array Size 322 Chapter 10 An optional assignment suppression character This provides a way to describe an input field to be skipped An input field is defined as a string of non white spa
55. ilantimeout function then the timeouts are adjusted via the following algorithm The SICL timeout which is sent to the server for the current call is adjusted if it is currently infinity 0 In that case it will be set to the Server Timeout value The LAN timeout is adjusted if the SICL timeout plus the Client Timeout Delta is greater than the current LAN timeout In that case the LAN timeout will be set to the SICL timeout plus the Client Timeout Delta The calculated LAN timeout only increases as necessary to meet the needs of the application but never decreases This avoids the overhead of readjusting the LAN timeout every time the application changes the SICL timeout The first iopen call used to set up the server connection uses the Client Timeout Delta specified during the SICL LAN interface configuration for portions of the iopen operation The timeout value for TCP connection establishment is not affected by the Client Timeout Delta 180 Chapter 8 Using SICL with LAN Using Timeouts with LAN To change the defaults do the following 1 Exit any SICL LAN applications which you want to reconfigure 2 As root run the iosetup utility and edit the LAN interface Change the Server Timeout or Client Timeout Delta parameter See the O Libraries Installation and Configuration Guide for information on changing these values 3 Restart the SICL LAN applications When only reconfiguring the LAN interface note that you do no
56. is f n res Trigger to close channel iprintf sw TRIG n Close the multimeter and switch sessions iclose dvm iclose sw Chapter 4 Note Using SICL with GPIB Communicating with GPIB Interfaces Communicating with GPIB Interfaces Interface sessions allow you direct low level control of the interface You must do all the bus maintenance for the interface This also implies that you have considerable knowledge of the interface Additionally when using interface sessions you need to use interface specific functions The use of these functions means that the program can not be used on other interfaces and therefore becomes less portable Addressing GPIB Interfaces To create an interface session on your GPIB system specify either the interface symbolic name or logical unit in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The following are example GPIB interface addresses hpib An interface symbolic name hpib2 An interface symbolic name 7 An interface logical unit The above examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name orlogical unit specified during the configuration The name used in your SICL program mus
57. list of symbolic names to assign VXI devices that have been configured The ivxirm utility reads the model id number from the VXI device and the ivxisc utility uses that information and this file to print out the VXI device symbolic name If you add a new VXI device to your system that is not currently in the database you may want to add an entry to this file The oride cf Configuration File The oride cf file contains values to be written to logical address space for register based instruments This data is written to A16 address space after the resource manager runs but before the system s resources are released This can be used for custom configuration of register based instruments every time the resource manager runs It can also be used to program extender devices like the VXI MXI Bus Extender card See Routing External Trigger Lines on the E1482 VXI MXI Extender Bus Card in Chapter 6 Using SICL with VXI MXI for an example of using this file 416 Appendix D Customizing your VXI MXI System The VXI MXI Configuration Files The ttltrig cf Configuration File The ttltrig cf file contains the mapping of VXI devices to TTL trigger lines for extended VXI MXI systems If you have an extended VXI MXI system and you want your TTL trigger lines to be recognized you must map the TTL trigger line to the source logical address in this file This file can only be used for extended VXI systems See Routing VXI TTL Trigger Lines in a VXI MX
58. memory address for the source FIFO register data The cnt argument is the number of transfers bytes words or longwords to perform The swap argument is the byte swapping flag If swap is zero no swapping 300 Chapter 10 SICL Language Reference IPOPFIFO occurs If swap is non zero the function swaps bytes if necessary to change byte ordering from the internal format of the controller to from the VXI big endian byte ordering Note Ifa bus error occurs unexpected results may occur Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IPEEK IPOKE IPUSHFIFO IMAP Chapter 10 301 C Syntax Description Note SICL Language Reference IPRINTF IPRINTF Supported sessions 00005 device interface commander Affected by functions 0 0000 ilock itimeout finclude lt sicl h gt int iprintf id format arg arg2 int isprintf buf format arg arg2 int ivprintf id format va_list ap int isvprintf buf format va_list ap INST id char buf const char format param argl arg2 va_list ap These functions convert data under the control of the format string The format string specifies how the argument is converted before it is output If the first argument is an INST the data is sent to the device to which the INST refers If the first argument i
59. n oaan aane device interface commander Affected by functions 00 0 0 0 eae ilock itimeout C Syntax include lt sicl h gt int isetubuf id mask size buf INST id int mask int size char buf Description The isetubuf function is used to supply the buffer s used for formatted T O With this function you can specify the size and the address of the formatted I O buffer This function is used to set the size and actions of the read and or write buffers of formatted I O The mask may be one but NOT both of the following flags I_BUF_READ Specifies the read buffer I_BUF_WRITE Specifies the write buffer Setting a size greater than zero creates a buffer of the specified size For write buffers the buffer flushes writes to the device whenever the buffer fills up and for each newline character in the format string For read buffers the buffer is never flushed that is it holds any leftover data for the next iscanf ipromptf call This is the default action Setting a size less than zero creates a buffer of the absolute value of the specified size For write buffers the buffer flushes writes to the device whenever the buffer fills up for each newline character in the format string or at the completion of every iprintf call For read buffers the buffer flushes erases its contents at the end of every iscanf or ipromptf function Chapter 10 353 SICL Language Reference ISETUBUF Note Cal
60. normally has the CMODE bit clear The following example opens all of the lower 48k of A16 address space 1 OxC 0x7800 Mapping VME Memory SICL defaults to byte word and longword supervisory access to simplify programming VXI systems However some VME cards use other modes of access which are not supported in SICL Therefore SICL provides a map parameter that allows you to use the access modes defined in the VME Specification See the VME Specification for information on these access modes Use care when mixing VXI and VME devices You MUST know what VME address space and offset within that address space that VME devices use VME devices cannot use the upper 16K of the A16 address space since this area is reserved for VXI instruments Use the I MAP AM address modifer map space argument in the imap function to specify the map space region address modifer of VME address space See the VMEbus Specifications for information on what value to use as the address modifier Note that if the controller doesn t support specified address mode then the imap call will fail see table in the next section Chapter 6 123 Note Supported Access Modes Using SICL with VXI MXI Communicating with VME Devices The following maps A24 non privileged data access mode prt imap id I MAP AM 0x39 0x20 0x4 0 The following maps A32 non privileged data access mode prt imap id I MAP AM 0x09 0x20 0x40 0 When accessing VME
61. on s and off s This means that simply calling the iintron function may not actually enable interrupts again For example note how the following code enables and disables events lintroff Events Disabled jintron Events Enabled lintroff Events Disabled lintrofft Events Disabled lintron Events STILL Disabled iintron Events NOW Enabled This function returns zero 0 if successful or a non zero error number if an error occurs IONINTR IGETONINTR IONSRQ IGETONSRQ TWAITHDLR IINTROFF ISETINTR 272 Chapter 10 SICL Language Reference ILANGETTIMEOUT ILANGETTIMEOUT Supported sessions 0 0 0 eee eee eens interface C Syntax include lt sicl h gt int ilangettimeout id tval INST id long tval Description The ilangettimeout function stores the current LAN timeout value in tval If the LAN timeout value has not been set via i lantimeout then tval will contain the LAN timeout value calculated by the system Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also ILANTIMEOUT and Chapter 8 Using SICL with LAN Chapter 10 273 C Syntax Description Note SICL Language Reference ILANTIMEOUT ILANTIMEOUT Supported sessions 2 0 0 cece e cece een ences interface finclude lt sicl h gt int ilantimeout id tv
62. operating configuration files This defaults to etc opt sicl vxiLU Where LU is the logical unit number of the VXI interface i Ignore static configuration files The static configuration files contain a set of rules for the resource manager to use during configuration With this option the resource manager ignores the static configuration files and follows only the standard VXI configuration rules p Print the results of the configuration using the ivxisc program t time Delay the seconds specified in time before starting The recommended time is five seconds The VXI Standard requires these five seconds to allow instruments to complete their self test The default is no delay at all v Print a verbose output of the resource manager s actions This is useful for debugging the cardcage configuration D The next argument specifies the directory that contains the ivxisc program This defaults to opt sicl bin Appendix D 425 Customizing your VXI MXI System ivxirm The next argument contains the name of the VXI interface that the resource manager will use to access the VXI bus This argument is provided mainly for controllers which can connect to multiple separate VXI systems through multiple VXI or MXI interfaces This defaults to vxi L Send all messages to a file named rsrcmgr err in the directory for static and operating configuration files M Set the limits for allocation of A24 and A32 memory space to the maximum add
63. options NR1 1 NR2 2 NR3 3 H QQ or B If the 1 argument modifier is present the arg must be a long integer If the h argument modifier is present the arg must be a short integer for C C C Corresponding arg is a double for C C If no flags are given send the number in IEEE 488 2 NR2 floating point format If flags indicate that NR1 format is to be used the arg will be truncated to an integer This argument supports all six flag modifier formatting options NR1 1 NR2 2 NR3 3 CH QQ or B If the 1 argument modifier is present the arg must be a double If the L argument modifier is present the arg must be a long double for C C In C C corresponding arg is a pointer to an arbitrary block of data The data is sent as IEEE 488 2 Definite Length Arbitrary Block Response Data The field width must be present and will specify the number of elements in the data block An asterisk can be used in place of the integer which indicates that two args are used The first is a long used to specify the number of elements The second is the pointer to the data block No byte swapping is performed If the w argument modifier is present the block of data is an array of unsigned short integers The data block is sent to the device as an array of words 16 bits The field width value now corresponds to the number of short integers not bytes Each word will be appropriately byte swapped and padded so that they are
64. options to pass to the linker The E option is a linker option that exports symbols to shared libraries The a option is a linker option that tells the linker which type of library to use in this case archive The 1d1d option links in the d1d library for use by SICL 400 Appendix B The SICL Utilities The SICL Utilities This appendix describes the utilities that are shipped with SICL The following utilities are described in alphabetical order iclear ipeek ipoke iread iwrite 402 Appendix C iclear The SICL Utilities iclear Syntax iclear t timeout v sym_name gt Description iclear performs a device or interface defined clear operation on the Note device or interface specified by the sym_name parameter Sym_name is the SICL address of the device or interface being addressed If sym_name refers to a device then a device clear command will be sent to the device If sym_name refers to an interface then the interface clear command will be sent to that interface The actual functions of the device clear or interface clear are specific to the device or interface For example executing iclear on an GPIB device will result in the DCL command being sent to that device Executing iclear on an GPIB interface will result in the IFC and REN line being pulsed if the interface is system controller and the interface hardware being reset When used on a GPIO interface session iclear
65. or VXI devices via an embedded controller current versions of SICL use the supervisory data address modifiers 0x2D 0x3D and 0x0D for A16 A24 and A32 accesses respectively Some older versions of SICL use the non privileged data address modifiers The following tables list VME access modes supported on VXI controllers VME Controller Mapping Support A16 A24 A32 D08 D16 D32 D08 D16 D32 D08 D16 D32 Supervisory data XxX X X XxX X X XxX X X Non Privilege data 124 Chapter 6 Using SICL with VXI MXI Communicating with VME Devices Reading and Writing to the Device Registers Once you have mapped the memory space use the SICL i peek and i poke functions to communicate with the VME devices With these functions you needed to know which register you want to communicate with and the register s offset See the instrument s user s manual for a description on the registers and register locations The following is an example of using iwpeek id iopen vxi addr imap id I MAP AM 0x39 0x20 0x4 0 reg data iwpeek unsigned short addr 0x00 See Chapter 10 for a complete description of the i peek and i poke functions Unmapping Memory Space Make sure you use the iunmap function to unmap the memory space when it is no longer needed This frees the mapping hardware so it can be used by other processes VME Interrupts There are seven VME interrupt lines that can
66. primary address 9 secondary address 0 and symbolic name hpib The above examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name orlogical unit specified during the configuration The name used in your SICL program must match the logical unit orsymbolic name specified in the system configuration Other possible interface names are GPIB gp ib HPIB etc 72 Chapter 4 Note Using SICL with GPIB Communicating with GPIB Devices SICL supports both primary and secondary addressing on GPIB interfaces Remember that the primary address must be between 0 and 30 and that the secondary address must be between 0 and 30 The primary and secondary addresses correspond to the GPIB primary and secondary addresses If you are using an GPIB Command Module to communicate with VXI devices the secondary address must be specified to select a specific instrument in the cardcage Secondary addresses of 0 1 2 31 correspond to VXI instruments at logical addresses of 0 8 16 248 respectively The following is an example of opening a device session with an GPIB device at bus address 16 INST dmm dmm iopen hpib 16 Chapter 4 73 GPIB Device Session Interrupts GPIB Device Sessions and Service Requests Using SICL with GPIB Communicating with GPIB Devices SICL Function Support with GPIB Dev
67. specific information and therefore are usually provided and distributed by the card manufacturer At the time of writing the instrument manufacturers had not ported any of their drivers to HP UX 11i or Linux For availability information contact the manufacturer of your VXI device You may also contact TAMS for more information Use the vxi interface to program directly to the device s registers with a series of register peeks and pokes This method can be very time consuming and difficult This method is not supported over LAN HP Agilent Command Module When you use an HP Agilent Command Module to communicate with VXI MXI devices you are actually communicating over GPIB The command module interprets the high level SCPI commands for register based instruments and then sends out low level commands over the VXlbus backplane to the instruments See the Using SICL with GPIB chapter for more details on communicating through a command module 109 Note Addressing VXI MXI Register Based Devices Note Using SICL with VXI MXI Communicating with VXI MXI Devices There are also other applications that use SICL as their I O library but have their own methods of communicating with the instruments These applications hide most of the I O complexity behind the user interface To create a device session specify either the interface symbolic name or logical unit anda particular device s address in the addr parameter of the i
68. the igpibsendcmd function For C programs this function returns zero 0 if successful or a non zero error number if an error occurs IGPIBSENDCMD IGPIBRENCTL IWRITE Chapter 10 245 SICL Language Reference IGPIBBUSADDR IGPIBBUSADDR Supported sessions 0 0 cece eee eee ence eens interface Affected by functions 00 0000 0 eee ilock itimeout C Syntax include lt sicl h gt int igpibbusaddr id busaddr INST id int busaddr Description This function changes the interface bus address to busaddr for the GPIB interface associated with the session id Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIBBUSSTATUS 246 Chapter 10 SICL Language Reference IGPIBBUSSTATUS IGPIBBUSSTATUS Supported sessions 0 cece eee eee ees interface C Syntax include lt sicl h gt int igpibbusstatus id request result INST id int request int result Description The igpibbusstatus function returns the status of the GPIB interface This function takes one of the following parameters in the request parameter and returns the status in the resu t parameter I_GPIB BUS REM Returns a 1 if the interface is in remote mode 0 otherwise I_GPIB BUS SRQ Returns a 1 if the SRQ line is asserted 0 otherwise I_GPIB BUS NDAC Returns a 1 if the NDAC line is asserted 0 otherwise
69. the ASCII FORM FEED character Send the ASCII double quote character 303 SICL Language Reference IPRINTF Format An iprintf format conversion command begins with a character After Conversion the character the optional modifiers appear in this order format flags Commands field width a period and precision a comma and array size comma operator and an argument modifier The command ends with a conversion character conv format flags J Ugg bo Eil Iba precision C array argument size modifier The modifiers in a conversion command are format flags field width 304 Zero or more flags in any order that modify the meaning of the conversion character See the following subsection List of format flags for the specific flags you may use An optional minimum field width is an integer such as 8d If the formatted data has fewer characters than field width it will be padded The padded character is dependent on various flags In C C an asterisk may appear for the integer in which case it will take another arg to satisfy this conversion command The next arg will be an integer that will be the field width for example iprintf id d 8 num Chapter 10 precision array Size argument modifier conv char Chapter 10 SICL Language Reference IPRINTF The prec
70. the SCPI command within your SICL output function call and the message based device interprets the SCPI command The register based device typically does not have a processor to interpret high level commands and therefore only accepts binary data Use the following methods to program register based instruments Interpreted SCPI Use the SICL iscpi interface and program using high level SCPI commands I SCPI interprets the high level SCPI commands and sends the data to the instrument Interpeted SCPI drivers for cards are available only for selected operating systems and cards These drivers rely on card specific information and therefore are usually provided and distributed by the card manufacturer At the time of writing the instrument manufacturers had not ported any of their drivers to HP UX 11i or Linux For availability information contact the manufacturer of your VXI device You may also contact TAMS for more information Register programming Do register peeks and pokes and program directly to the device s registers with the vxi interface Chapter6 Note Note Using SICL with VXI MXI Communicating with VXI MXI Devices Interpreted SCPI I SCPI is supported over LAN However register programming imap ipeek ipoke etc is not supported over LAN I SCPI runs on the LAN server if used in a LAN based system Other Products HP Agilent Command Module Use a Command Module to interpret the high lev
71. the SICL LAN Protocol which permits interoperability of LAN software from different vendors that meet the VXIbus Consortium standards Note that this LAN networking protocol may not be implemented with all the SICL LAN products at this time The TCP IP Instrument Protocol on Unix currently supports SICL operations over the LAN to GPIB GPIB and VXI interfaces Also some SICL operations are not supported when using the TCP IP Instrument Protocol See the section titled SICL Function Support with LAN gatewayed Sessions later in this chapter When using either of these networking protocols the LAN software provided with SICL uses the TCP IP protocol suite to pass messages between the LAN client and the LAN server The server accepts device I O requests over the network from the client and then proceeds to execute those I O requests on a local interface such as GPIB You can use both LAN networking protocols with a LAN client To do so simply configure both the SICL LAN Protocol and the TCP IP Instrument Protocol on the LAN client system via the iosetup utility See the O Libraries Installation and Configuration Guide for information on running iosetup Then use the name of the interface supporting the protocol you wish to use in each SICL iopen call of your program See the Communicating with LAN Devices section later in this chapter for details on how to create communications sessions with SICL over LAN using each of these protocols Not
72. the conversion to be applied This is the only required element of a conversion command See the following subsection List of conv chars for the specific conversion characters you may use 305 SICL Language Reference IPRINTF Examples of The following are some examples of conversion commands used in the Format format string and the output that would result from them The output data is Conversion arbitrary Commands Conversion Output Description Command Hd H3A41 format flag 310s str field width 10s str format flag left justify amp field width 6f 21 560000 precision 3d 18731734 comma operator 6ld 132 field width amp argument modifier long 6ld 000132 precision amp argument modifier long seld 61 format flag IEEE 488 2 NR1 SQ2d 61 000000 format flag IEEE 488 2 NR2 3d 6 100000E 01_ format flag IEEE 488 2 NR3 List of The format flags you can use in conversion commands are format flags 1 2 3 H 306 Convert to an NR1 number an IEEE 488 2 format integer with no decimal point Valid only for sd and sf Note that sf values will be truncated to the integer value Convert to an NR2 number an IEEE 488 2 format floating point number with at least one digit to the right of the decimal point Valid only for d and Sf Convert to an NR3 number an IEEE 488 2 format number expressed in exponential notation Valid only for sd and f Convert to an IEEE 488 2 format hexadec
73. zero 0 if successful or a non zero error number if an error occurs See Also IMAP IUNMAP Chapter 10 287 C Syntax Description Note SICL Language Reference IONERROR IONERROR finclude lt sicl h gt int ionerror proc void proc id error INST id int error The ionerror function is used to install a SICL error handler Many of the SICL functions can generate an error When a SICL function errors it typically returns a special value such as a NULL pointer zero or a non zero error code A process can specify a procedure to execute when a SICL error occurs This allows your process to ignore the return value and simply permit the error handler to detect errors and do the appropriate action The error handler procedure executes immediately before the SICL function that generated the error completes its operation There is only one error handler for a given process which handles all errors that occur with any session established by that process On operating systems that support multiple threads the error handler is still per process However the error handler will be called in the context of the thread that caused the error Error handlers are called with the following arguments void proc id error INST id int error The id argument indicates the session that generated the error The error argument indicates the error that occurred See Chapter 9 Troubleshooting Your SICL Program f
74. 0 eee ilock itimeout C Syntax include lt sicl h gt int ivxitrigon id which INST id unsigned long which Description The ivxitrigon function asserts trigger lines and leaves them activated The which parameter uses all of the same values as the ixtrig command namely I TRIG ALL All standard triggers for this interface that is the bitwise OR of all valid triggers I TRIG TTLO TTL Trigger Line 0 I TRIG TTL1 TTL Trigger Line 1 I TRIG TTL2 TTL Trigger Line 2 I TRIG TTL3 TTL Trigger Line 3 I TRIG TTL4 TTL Trigger Line 4 I TRIG TTL5 TTL Trigger Line 5 I_ TRIG TTL6 TTL Trigger Line 6 I TRIG TTL7 TTL Trigger Line 7 I TRIG ECLO ECL Trigger Line 0 I TRIG ECL1 ECL Trigger Line 1 I TRIG ECL2 ECL Trigger Line 2 I TRIG ECL3 ECL Trigger Line 3 I TRIG EXTO External BNC or SMB Trigger Connector 0 I TRIG EXT1 External BNC or SMB Trigger Connector 1 Chapter 10 375 SICL Language Reference IVXITRIGON Any combination of values may be used in which by performing a bit wise OR of the desired values Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IVXITRIGOFF IVXITRIGROUTE IVXIGETTRIGROUTE TXTRIG 376 Chapter 10 SICL Language Reference IVXITRIGROUTE ty IVXITRIGROUTE Supported sessions 0 0 0 cece eee tenes interface Affected by functions 00 0 0 0 eee ilock itimeout
75. 00 iserialctrl intf I SERIAL PARITY I SERIAL PAR NONE iserialctrl intf I SERIAL WIDTH I SERIAL CHAR 8 iserialctrl intf I SERIAL STOP I SERIAL STOP 1 Display previous settings printf Old settings 5ld s ld ld n baudrate parity str databits stopbits close port iclose intf return 0 Chapter 7 155 Using SICL with RS 232 Summary of RS 232 Specific Functions Summary of RS 232 Specific Functions Note Using these RS 232 interface specific functions means that the program can not be used on other interfaces and therefore becomes less portable Function Name Action iserialctrl Sets the following characteristics of the RS 232 interface 156 Chapter 7 Using SICL with RS 232 Summary of RS 232 Specific Functions Request Characteristic Settings ERIAL BAUD Data rate 2400 9600 etc ERIAL PARITY Parity _SERIAL PAR NONE _SERIAL PAR EVEN _SERIAL PAR ODD ERIAL STOP Stop bits frame _SERIAL STOP 1 _
76. 1 Introduction SICL Overview SICL User SICL is intended for instrument I O and C C programmers who are familiar with the HP UX or Linux operating system This manual does not attempt to teach the C programming language or instrument I O concepts Chapter 1 21 Introduction Related Documents Related Documents Other SICL Learning Products 22 I O Libraries Installation and Configuration Guide provides a detailed installation procedure with information on how to configure your system to run SICL SICL Online Help is provided in the form of Unix manual pages man pages SICL Example Programs are provided in the opt sicl share examples directory These examples are designed to help you develop your SICL applications more easily Chapter 1 Introduction Related Documents Other Documentation HP UX 11i Learning Products http docs hp com HP UX lli Installation and Update Guide HP C HP UX Reference Manual HP UX Linker and Libraries User 5 Guide Software Distributor Administration Guide for HP UX lli Managing Systems and Workgroups A Guide for HP UX System Administrators Linux Learning Products Redhat Linux Installation Guide GCC Manuals http www gnu org Linux Network Administrator 5 Guide by Olaf Kirch O Reilly amp Associates VXI Interface Learning Products TAMS 80100B PCI VXI Controller Installation amp Operations Instructions GPIO Interface Learning Products
77. 13 icauseerr 217 iclear 148 151 218 333 GPIO interface sessions 93 HP IB device sessions 74 HP IB interface sessions 78 LAN interface sessions 177 VXI MXI device sessions 130 VXI MXI interface sessions 131 iclear utility 403 iclose 28 219 iderefptr 220 idn c example 27 idrvrversion LAN gatewayed sessions 174 IEEE 488 See GPIB IFC HP IB interface sessions 78 IFC See GPIB lines iflush 221 225 ifread 52 223 termination character 357 ifwrite 52 225 igetaddr 226 igetdata 227 igetdevaddr 228 igeterrorno 229 igeterrstr 231 igetgatewaytype 232 igetintfsess 233 447 igetintftype 234 igetlockwait 235 igetlu 236 igetluinfo 237 LAN interface sessions 177 igetlulist 238 igetonerror 239 igetonintr 240 igetonsrq 241 igetsesstype 242 igettermchr 243 igettimeout 178 244 igpibatnctl 245 igpibbusaddr 246 igpibbusstatus 247 igpibgettldelay 249 igpibllo 250 igpibpassctl 251 igpibppoll 252 igpibppollconfig 253 igpibppollresp 254 igpibrenctl 255 igpibsendcmd 256 359 igpibsett delay 257 igpioctrl 258 ihint 269 iintroff 55 271 iintron 55 272 ilangettimeout 273 ilantimeout 178 274 ilblockcopy 213 ilocal 277 ilock 64 278 ilpeek 229 296 ilpoke 229 298 ilpopfifo 300 ilpushfifo 313 imap 112 229 280 imapinfo 282 285 286 imapx 283 INST 28 Interface address 236 clear 218 close 219 448 get type of 234 interrupts 343 lock 278
78. 152 Installs a service request handler for this session The concept of service request SRQ originates from GPIB On an GPIB interface a device can request service from the controller by asserting a line on the interface bus RS 232 does not have a specific line assigned as a service request line Any transition on the designated service request line will cause an SRQ handler in your program to be called Be sure not to set the SRQ line to CTS or DSR if you are also using that line for hardware flow control Service requests are supported for both device sessions and interface sessions Sets the characteristics of the serial interface The following requests are clarified I SERIAL DUPLEX The duplex setting determines whether data can be sent and received simultaneously Setting full duplex allows simultaneous send and receive data traffic Setting half duplex the default will cause reads and writes to be interleaved so that data is flowing in only one direction at any given time The exception to this is if XON XOFF flow control is used I_SERIAL READ BUFSZ The default read buffer size is 2048 bytes I SERIAL RESET Performs the same function as the iclear function on an interface session except that a break is not sent Chapter 7 Using SICL with RS 232 Communicating with RS 232 Interfaces iserialstat Gets the characteristics of the serial interfac
79. 2 Unmapping memory space 114 125 Unrecognized symbolic name 197 Using Timeouts with LAN 178 Utilities iclear 403 ipeek 405 ipoke 406 U Undefined id 193 U U iproc 423 iread 407 ivxirm 425 ivxisc 428 iwrite 408 VXI MXI 422 Vv Version of SICL Software 365 VME Access modes 124 and the E1482 122 Communicating with devices 121 Declaring Resources 122 Example program 126 Interrupts 125 oride cf file 122 VME devices 415 Example of programming 127 VME interrupts Example 140 vmedev cf 415 Example 126 vmedev cf file 122 vmeintr c example 127 140 VXI bus status 366 DMA transfers 135 information structure 370 interrupts 349 normal operation 379 resource manager 370 send word serial commands 380 servant area 366 servants list of 372 trigger lines 366 trigger assert 375 trigger de assert 373 trigger route lines 377 triggers 360 386 VXI controller trigger lines 132 VXI get trigger information 369 VXI MXI Addressing interfaces sessions 118 Addressing message based device session 106 Addressing register based device session 110 Communication sessions 103 Configuration 410 412 Configuration files 413 Configuration Utilities 422 Interrupts 138 IRQ lines 415 Mapping memory space 112 Message Based devices 104 130 message based programming example 108 Overview of configuration 411 Register programming 112 Register programming
80. 2 device 294 295 get address of 226 get type 242 interface 294 295 open 294 Sessions 38 Addressing GPIO interfaces 92 Addressing HP IB commanders 85 Addressing HP IB devices 72 Addressing LAN gatewayed 169 Addressing RS 232 devices 146 Addressing RS 232 Interfaces 150 Addressing VXI MXI interfaces 118 Addressing VXI MXI message based devices 106 Addressing VXI MXI register based devices 110 Commander 41 Device 39 GPIO interface 92 HP IB 71 HP IB device 72 Interface 40 LAN 169 LAN interface sessions 176 LAN gatewayed sessions 169 Opening 38 Parallel interface 92 RS 232 device 146 RS 232 interface 150 Serial device 146 Serial interface 150 VXI MXI 103 VXI MXI device 103 VXI MXI interface 103 Shared libraries 29 SICL Building HP UX 9 applications 399 Documentation 22 Features 20 File structure 390 Overview 20 User 21 Utilities 402 SICL LAN Networking Protocol 166 sicl h 28 37 sicl_ tl script 399 _siclcleanup C 387 SICL DIAG file structure 396 SICL GPIO file structure 392 SICL HPIB file structure 392 SICL LAN file structure 393 siclland daemon 199 SICL LANSVR file structure 393 SICL MAN file structure 394 SICL MAN GPIO file structure 394 SICL MAN HPIB file structure 394 SICL MAN LAN file structure 395 SICL MAN LANSVR file structure 396 SICL MAN RS232 file structure 395 SICL MAN VXI file structure 395 SICL PRG file structure 391 S
81. 29 Configuration LAN 168 VXI MXI system 410 VXI MXI Utilities 422 Configuration files 413 cemdrsrvt cf 416 dynamic cf 414 irg cf 415 names cf 416 ttltrig cf 417 vmedev cf 415 vximanuf cf 414 vximodel cf 414 Connection refused LAN 201 Conversion Characters 308 324 Conversion characters iprintf 47 iscanf 47 C SCPI 104 communicating 109 D D32 32 bit access 114 Data Transfer direct memory access DMA 269 interrupt driven INTR 269 polling mode POLL 269 set preferred mode 269 DAV See GPIB lines Device address 228 clear 218 close 219 disable front panel 318 get device address 228 get interface of 233 interrupts 343 lock 279 remote mode 318 session 294 295 status byte 317 unlock 361 Device sessions 39 Addressing 39 HP IB 72 HP IB addressing 72 HP IB example 75 LAN communicating 169 LAN gatewayed 169 LAN gatewayed addressing 169 RS 232 146 RS 232 addressing 146 RS 232 example 149 Serial 146 VME devices 121 VXI MXI 103 VXI MXI addressing 106 110 443 VXI MXI communicating 104 VXI MXI example 108 114 VXI MXI register programming 112 Disable Asynchronous Event Handlers 271 Disable events 55 DMA 270 DMaA transfers VXI 135 Documentation GPIO Interface 23 HP UX 23 LAN 24 LAN HP IB Gateway 24 Series 700 Computer 23 Series 700 RS 232 23 SICL 22 VXI MXI 24 dynamic cf file 414 Dynamically configured devices 414 E
82. 3 Using SICL describes the basics of SICL along with some detailed example programs You can find information on communication sessions addressing error handling and more e Chapter 4 Using SICL with GPIB describes communicating over the GPIB interface Example programs are also provided Chapter 5 Using SICL with GPIO describes how to communicate over the GPIO interface Example programs are also provided e Chapter 6 Using SICL with VXI MXI_ provides detailed information about communicating over the VXIbus Chapter 7 Using SICL with RS 232 describes how to communicate over the RS 232 interface Example programs are also provided e Chapter 8 Using SICL with LAN describes how to communicate over a LAN Example programs are also provided e Chapter 9 Troubleshooting Your SICL Program describes some of the most common SICL programming problems and provides hints to help you solve the problems e Chapter 10 SICL Language Reference provides a complete description of all of the available SICL functions and C languag syntax 18 Chapter 1 This guide also contains the following appendices Appendix A The SICL Files summarizes where the SICL files are located on your system Appendix B Updating HP UX 9 SICL Applications describes how to update your SICL applications that were written on HP UX 9 to work on HP UX 11i Appendix C The SICL Utilities describes the SICL utilities that can be used to rea
83. 4 A32 VXIDEV and EXTEND See the imap function in Chapter 10 for a description of these mappings The offset is the offset in bytes from the beginning of the mapped space to the location that is to be written The parameter definitions follow Vv Turns on verbose mode Prints the usage of the ipoke program b Specifies that the register size is a byte 8 bits Ww Specifies that the register size is a word 16 bits default l Specifies that the register size is a long 32 bits ipoke vxi A24 0x200000 1 0x0000 406 Appendix C The SICL Utilities iread iread Syntax iread t timeout c count e end_char v sym_name Description iread is the SICL utility for reading data from devices The output of iread goes to stdout The read is terminated only when count number of bytes is read a timeout occurs a byte is read with the END indicator or the termination character end_char is read These conditions may occur in combination The sym_name is the SICL symbolic name or address of the device that was determined during the interface configuration Note that iread is only supported for device addresses The parameter definitions follow t timeout Specifies the timeout value in milliseconds c count Specifies the number of bytes to read e end_char Defines a termination character for the read v Turns on verbose mode Prints the usage of the iread program Example iread hpib 16 Appendix C 407
84. 48 318 Remote Mode GPIB 247 REN See GPIB lines Resource Manager 410 412 425 Resource Manager VXI 370 Resources Declaring VME 122 Routines Formatted I O Routines 51 rpcinfo troubleshooting 199 201 RS 232 Device sessions 146 Interface sessions 150 Interrupts 148 152 Service requests SRQs 152 SICL functions RS 232 specific 156 RS 232 manuals 23 RS 232 see Serial Running a program 31 Run time errors Invalid address 194 Invalid INST 194 iopen fails 194 Program hangs 194 Timeout occurred 194 Troubleshooting 194 S SCPI 104 Secondary address 73 Send Commands GPIB 256 Serial baud rate 330 Device sessions 146 END Indicator for read 331 END Indicator for write 333 flow control 331 functions see iserial Interface sessions 150 interface status 336 Interrupts 148 152 interrupts 344 347 modem control lines setting 334 modem control lines status 335 parity 330 resetting interface 333 sending BREAK 329 Service requests SRQs 152 set up interface 330 SICL functions serial specific 156 stop bits 330 triggers 359 385 serialdev c example 149 serialintr c example 154 Series 700 Computer manuals 23 Series 700 RS 232 manuals 23 Servant Area VXI 366 Servants VXI 372 Servers LAN 167 Service request HP IB device sessions 74 HP IB interface sessions 79 Service Requests SRQs 241 247 handlers 293 Session close 219 commander 295 data structure 227 34
85. 7 Using SICL with RS 232 Creating a Communications Session Wh RS 2325 laiidi Wig decency e EE E E a eee eMe evade 145 Communicating with RS 232 Devices ccecccsesseceteeeeeeseeseeseeeeeeeees 146 Addressing RS 232 Devices ccccccesccesessseeseceteceteeeeeeseecseeeneeeeenaes 146 SICL Function Support with RS 232 Device Sessions 00 148 RS 232 Device Session Example c cccccssecsseeteceteceeeeteeeeensees 149 Communicating with RS 232 Interfaces 2 0 0 cceseesceseeseeeeeeeeeneeseeaes 150 Addressing RS 232 Interfaces ccceccccsseeseceteeeeeeeeeeseeesseeseeneeeaes 150 SICL Function Support with RS 232 Interface Sessions 151 RS 232 Interface Session Example c cccccsceescceseceseeeeeeeeseessees 154 Summary of RS 232 Specific Functions 0 0 ceecceeseesseeseeeteeeteeeeeeesees 156 Contents 9 8 Using SICL with LAN Overview Of SICE LAN Feact aereo ee hades ia e EE ei 163 LAN Software Architecture cccccccsccsssesceeeeseeeseeensceseeeneeeseesees 165 SICLLAN Serve Tra aa ea a e eea a aa aea aA 167 Considering LAN Configuration and Performance sseseseeeeeseeee 168 Communicating with Devices over LAN ccccccescceseeseeeseetteeseeneeeaes 169 LAN gatewayed Sessions cccccesccessceseeeseeescenseceeeeeeeeeeeeseeaeesaees 169 LAN Interface SESSIONS osori iania k aa n 176 Using Timeouts with LAN 00 0 ccccceccccsseeseceneceeeeeseeesecnseceeceeeeeseeeeen
86. 8 bit character Ifa 16 bit width is set only the lower 8 bits are used when checking for an itermchr match For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIOGETWIDTH Chapter 10 265 SICL Language Reference IGPIOSTAT IGPIOSTAT Supported sessions 2 0 h aa ccc eee cee ence eens interface C Syntax include lt sicl h gt int igpiostat id request result INST id int request unsigned long result Note GPIO is not supported over LAN 266 Chapter 10 SICL Language Reference IGPIOSTAT Description The igpiostat function is used to determine the current state of various GPIO modes and lines The request parameter can be one of the following I GPIO CTRL I GPIO DATA I GPIO INFO I GPIO PSTS I GPIO EIR I GPIO READY I GPIO AUTO HDSK Chapter 10 The result is a mask representing the state of all control lines The interface has two control lines so only the two least significant bits have meaning for that interface These can be represented by the following All other bits in the result mask are 0 zero I GPIO CTRL CTLOThe CTLO line I GPIO CTRL CTL1The CTL41 line The result is a mask representing the state of all data input latches The interface can have either 8 or 16 data in lines depending on the setting specified by igpiosetwidth Note that this function reads the data lines asynch
87. AL D DSR _SERIAL D CTS SERIAL STAT Misc status _ SERIAL DAV _SERIAL_TEMT _ SERIAL PARITY _SERIAL_ OVERFLOW _SERIAL FRAMING _SERIAL BREAK SERIAL READ BUFSZ Receive buffer size Number of bytes SERIAL READ DAV Data available Number of bytes SERIAL FLOW CTRL Flow control _SERIAL FLOW SERIAL READ EO EOI indicator for reads _SERIAL EOI SERIAL WRITE EO EOI indicator for writes _SERIAL EOI 158 Chapter 7 Function Name iserialmclctrl iserial Imclstat iserial Chapter 7 lLbreak Using SICL with RS 232 Summary of RS 232 Specific Functions Action Sets or Clears the modem control lines Modem control lines are either I SERIAL RTS or _SERIAL DTR Gets the current state of the modem control lines Sends a break to the instrument Break time is 10 character times with a minimum time of 50 milliseconds and a maximum time of 250 milliseconds 159 Using SICL with RS 232 Summary of RS 232 Specific Functions 160 Chapter 7 Using SICL with LAN Using SICL with LAN This chapter explains how to use SICL over LAN Local Area Network LAN is a natural way to extend the control of instrumentation beyond the limits of typical instrument interfaces In order to communicate over the LAN you must have loaded the LAN fileset during installation for a host system acting as a LAN client and you must have loaded the LANSVR fileset during installation for a host system acting as a
88. AN This chapter contains the following sections Creating a Communications Session with GPIO e Communicating with GPIO Interfaces Summary of GPIO Specific Functions 90 Chapter5 Using SICL with GPIO Creating a Communications Session with GPIO Creating a Communications Session with GPIO Once you have configured your system for GPIO communications you can start programming with the SICL functions If you have programmed GPIO before you will probably want to open the interface and start sending commands With GPIB and VXI there can be multiple devices on a single interface These interfaces support a connection called a device session With GPIO only one device is connected to the interface Therefore you communicate with GPIO devices using an interface session Chapter 5 91 Note Using SICL with GPIO Communicating with GPIO Interfaces Communicating with GPIO Interfaces Interface sessions are used for GPIO data transfer interrupt status and control operations When communicating with a GPIO interface session you specify the interface name Addressing GPIO Interfaces To create an interface session on GPIO specify either the interface symbolic name or logical unit in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The following are
89. As with other client server applications on a LAN when deploying an application which uses SICL LAN consideration must be given to the performance and configuration of the network the client and server will be attached to If the network to be used is not a dedicated LAN or otherwise isolated via a bridge or other network device current utilization of the LAN must be considered Depending on the amount of data which will be transferred over the LAN via the SICL application performance problems could be experienced by the SICL application or other network users if sufficient bandwidth is not available This is not unique to SICL over LAN but it is simply a general design consideration when developing any client server application If you have questions concerning the ability of your network to handle SICL traffic consult with your network administrator or network equipment providers 168 Chapter 8 Addressing Devices or Interfaces with LAN gatewayed Sessions Using SICL with LAN Communicating with Devices over LAN Communicating with Devices over LAN There are several different types of sessions which are supported over LAN This section describes those session types and what behavior should be expected for the various SICL calls LAN gatewayed Sessions Communicating with a device over LAN through a LAN to instrument_interface gateway preserves the functionality of the gatewayed interface with only a few exceptions see the S
90. CE Parity always zero I_SERIAL STOP The following are acceptable values for setting I SERIAL STOP 1 1 stop bit I_ SERIAL STOP 2 2 stop bits 330 Chapter 10 SICL Language Reference ISERIALCTRL I_ SERIAL WIDTH The following are acceptable values for setting I_ SERIAL CHAR_5 5 bit characters I SERIAL CHAR_6 6 bit characters I SERIAL CHAR_7 7 bit characters I SERIAL CHAR_8 8 bit characters I SERIAL READ BUFSZ This is used to set the size of the read buffer The setting parameter is used as the size of buffer to use This value must be in the range of 1 and 32767 I SERIAL DUPLEX The following are acceptable values for setting I_ SERIAL DUPLEX FULL Use full duplex I SERIAL DUPLEX HALF Use half duplex I_SERIAL FLOW CTRL The setting parameter must be set to one of the following values If no flow control is to be used set setting to zero 0 The following are the supported types of flow control I SERIAL FLOW NONE No handshaking I_ SERIAL FLOW_XON Software handshake I SERIAL FLOW _RTS_ CTS Hardware handshake I SERIAL FLOW _DTR_DSR Hardware handshake I SERIAL READ EOI Used to set the type of END Indicator to use for reads In order for iscanf to work as specified data must be terminated with an END indicator The RS 232 interface has no standard way of doing this SICL gives y
91. Description Return Value See Also SICL Language Reference IGETTIMEOUT IGETTIMEOUT Supported sessions 00005 device interface commander include lt sicl h gt int igettimeout id tval INST id long tval The igettimeout function stores the current timeout value in tval If no timeout value has been set tval will be set to zero 0 For C programs this function returns zero 0 if successful or a non zero error number if an error occurs ITIMEOUT 244 Chapter 10 C Syntax Description Note Return Value See Also SICL Language Reference IGPIBATNCTL IGPIBATNCTL Supported sessions 0 cece eect eee eens interface Affected by functions 00 0 0 00 00 ee ilock itimeout include lt sicl h gt int igpibatnctl id atnval INST id int atnval The igpibatnct1 function controls the state of the ATN Attention line If atnval is non zero then ATN is set If atnval is 0 then ATN is cleared This function is used primarily to allow GPIB devices to communicate without the controller participating For example after addressing one device to talk and another to listen ATN can be cleared with igpibatnctl to allow the two devices to transfer data This function will not work with iwrite to send GPIB command data onto the bus The iwrite function on a GPIB interface session always clears the ATN line before sending the buffer To send GPIB command data use
92. ESS_INTF I_INTF_GPIB _INTF_LAN lan instserv hpib 7 I_SESS DEV IINTF_GPIB _INTF_LAN hpib SESS_INTF I_INTF_GPIB _INTF_NONE hpib 7 SESS DEV INTF_GPIB _INTF_NONE Chapter 8 171 SICL Function Support with LAN gatewayed Sessions Using SICL with LAN Communicating with Devices over LAN A gatewayed session to a remote interface provides the same SICL function support as if the interface was local with the following exceptions or qualifications The following functions are not supported over LAN e i blockcopy e imap e imapinfo e i peek e i poke i popfifo e i pushfifo e iunmap The following SICL functions in addition to those listed above are not supported with the TCP IP Instrument Protocol e All VXI specific functions e All RS 232 serial specific functions e igetlu ionintr e isetintr e igetintfsess e igetonintr e igpibgettldelay e igpibllo e igpibppoll e igpibppollconfig e igpibppollresp e igpibsettldelay For the igetdevaddr igetintftype and igetsesstype functions to be supported with the TCP IP Instrument Protocol the remote address strings must follow the TCP IP Instrument Protocol naming conventions gpib0 gpibl and so forth For example gpib0o 7 gpibl 7 2 gpib2 172 Chapter 8 Using SICL with LAN Communicating with Devices over LAN However since the interface names at the remote server may be configurable this is
93. Ensure that the LAN timeout being used by the system is sufficiently greater than the SICL timeout being used for the session in question The LAN timeout should be large enough to allow for the network overhead in addition to the time that the I O operation may take Ifusing ilantimeout you must determine and set the LAN timeout manually Otherwise ensure that the Client Timeout Delta value specified during the LAN configuration is large enough See Using Timeouts with LAN section in chapter 8 for more information An iopen fails due to insufficient resources at the server or I O operations fail because some other session has the device or interface locked Possible Solution Old SICL LAN server processes from previous clients may not have terminated properly Consult your server s troubleshooting documentation and follow its instructions for killing any old server processes 198 Chapter 9 rpcinfo does not list siclland Troubleshooting Your SICL Program Troubleshooting SICL over LAN Client and Server SICL LAN Server Problems and Possible Solutions rpcinfo fails to indicate that program 395180 SICL LAN Protocol or 395183 TCP IP Instrument Protocol is available on the server Possible Solution Did you run Lanconf opt sicl bin directory on HP UX 11i or Linux as root If not do so If so on HP UX 111i ensure that etc rpc and etc inetd conf contain the following lines etc rpc should contain siclland 395180
94. FIFO 214 Chapter 10 SICL Language Reference IBLOCKMOVEX IBLOCKMOVEX Supported sessions 00005 device interface commander Affected by functions 00 0 0 0 eae ilock itimeout C Syntax include lt sicl h gt int iblockmovex id src_handle src_offset src_width src_increment dest_handle dest_offset dest_width dest_increment cnt swap INST id unsigned long src_handle unsigned long src_ offset int src_width int src_increment nsigned long dest handle unsigned long dest offset nt dest width nt dest increment nsigned long cnt int swap T Note Not supported over LAN Note If either the src_handle or the dest_handle is NULL then the handle is assumed to be for local memory In this case the corresponding offset is a valid memory address Chapter 10 215 Description Note Return Value See Also SICL Language Reference IBLOCKMOVEX iblockmovex moves data 8 bit byte 16 bit word and 32 bit long word from memory on one device to memory on another device This function allows local to local memory copies both src_handle and dest_handle are zero VXI to V XI memory transfers both src_handle and dest_handle are valid handles local to VXI memory transfers src_handle is zero dest_handle is valid handle or VXI to local memory transfers src_handle is valid handle dest_handle is zero The id parameter is the value returned from iopen If the id parame
95. I MXI Configuration Overview of VXI MXI Configuration When SICL is installed and configured according to the procedures in the J O Libraries Installation and Configuration Guide certain SICL utilities and configuration files are copied onto your system The VXI MXI system is configured using two SICL utilities and the VXI MXI configuration files These utilities automatically run when the system boots The following is a summary of the VXIbus boot process utilities iproc This utility runs at system boot and performs various system initialization functions It uses the iproc cf configuration file to determine when the other configuration utility ivxi rm runs ivxirm This utility runs the resource manager which initializes and configures the VXI MXI cardcage resources The resource manager reads the VXI MXI configuration files and polls the VXI devices to determine their resources and capabilities This utility runs at cardcage initialization unless otherwise specified in the iproc cf configuration file default is to run at cardcage initialization configuration files These files specify some site dependent configuration rules and any changes from the default fileset on HP UX 11i In order to use VXI MXI you must have loaded this fileset during the installation See the V O Libraries Installation and Configuration Guide for more details The utilities and configuration files are described in more detail in the sections th
96. I System in Chapter 6 Using SICL with VXI MXI for an example of using this file Appendix D 417 Note Customizing your VXI MXI System The iproc Utility Initialization and SYSRESET The iproc Utility Initialization and SYSRESET On HP UX and Linux systems SICL installs a program called iproc This program uses the iproc cf file to determine how your system is initialized The iproc cf file determines when the ivxirm program runs and with what options Additionally the iproc cf file specifies what action is taken when your VXI system encounters a SYSRESET If you have a VXI backplane the iproc program is run at system boot time This program becomes a daemon and monitors the VXI backplane for SYSRESET The iproc cf file tells iproc what to do ifa SYSRESET occurs Usually you want the resource manager to run and configure your system since the SYSRESET has invalidated the configuration The iproc cf file is stored in the following directory etc opt sicl Ifa SYSRESET power down or iclear occurs and the iscpi instrument is running then the iscpi instrument server task will be killed If this happens you will geta No Connect error message and you need to re open the iscpi communications session 418 Appendix D Customizing your VXI MXI System The iproc Utility Initialization and SYSRESET Note The SYSRESET line is commented out by default You must un comment the following line in the etc opt sicl iproc cf file i
97. IALMCLSTAT Supported sessions 0 cece eee teen ees interface Affected by functions 2 0 0 000s ilock itimeout C Syntax include lt sicl h gt int iserialmclstat id sline state INST id int sline int state Description The iserialmclstat function is used to determine the current state of the Modem Control Lines The s ine parameter sends one of the following values I SERIA RTSReady To Send line I SERIA DTRData Terminal Ready line If the value returned in state is non zero the Modem Control Line is asserted otherwise it is clear Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also ISERIALMCLCTRL Chapter 10 335 SICL Language Reference ISERIALSTAT ISERIALSTAT Supported sessions 2 6 00 cece E AE E E s interface Affected by functions 00 0 0 0 ae ilock itimeout C Syntax include lt sicl h gt int iserialstat id request result INST id int request unsigned long result Description The iserialstat function is used to find the status of the serial interface This function takes one of the following values passed in request and returns the status in the resu t parameter I SERIAL BAUD The result parameter will be set to the speed of the interface I SERIAL PARITY The result parameter will be set to one of the followi
98. ICL Function Support with LAN gatewayed Sessions section later in this chapter This means most operations you might request of an interface such as GPIB connected directly to your controller you can request of a remote interface via the LAN gateway The only portions of your application which must change are the addresses passed to the iopen calls unless those addresses are stored in a configuration file in which case no changes to the application itself are required The address used for a local interface must have a LAN prefix added to it so that the SICL software knows to direct the request to a SICL LAN server on the network To create a LAN gatewayed session specify the LAN interface symbolic name or logical unit the IP address or hostname of the server machine and the address of the remote interface or device in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values Chapter 8 169 Using SICL with LAN Communicating with Devices over LAN The following are examples of LAN gatewayed addresses lan instserv GPIB 7 A device address corresponding to the device at primary address 7 on the GPIB interface attached to the machine named instserv lan instserv hp com GPIB 7 A device address corresponding to the device at primary address 7 on the GPIB interfac
99. ICL RS232 file structure 393 SICL RUN File structure 390 453 SICL VXI file structure 391 Signal handling with LAN 184 Signals HP UX 57 SIGUSR2 57 SRQ handlers 54 SRQ See Service Requests Status GPIB 247 lock wait 351 of lockwait flag 235 VXI bus 366 Status Byte 317 set 352 Stop Bits 330 Symbolic name 40 118 416 GPIO 92 HP IB 77 LAN 169 RS 232 150 VXI MXI 118 syntax error 197 System Controller GPIB 247 SystemVXI MXI Configuration 410 T T1 Delay GPIB 249 257 Talker GPIB 247 TCP IP Instrument Networking Protocol 166 172 Termination Character 224 316 357 get 243 Threads error handling 288 errors 217 230 interrupt handling 382 LAN timeout 276 Timeout occurred 194 Timeouts 381 get current value 244 LAN 178 set wait time 358 Transfer Blocks 213 from FIFO 300 454 to FIFO 313 Trigger lines VXI controller 132 Triggers get VXI trigger information 369 GPIB 385 GPIO 385 send 359 send extended trigger 384 serial RS 232 385 VXI 386 VXI lines status 366 VXI assert 375 VXI de assert 373 VXI route lines 377 Troubleshooting Compile errors 192 Install error handler 189 LAN 195 LAN client 197 LAN server 199 Link errors 192 Run time errors 194 TTL trigger lines ttltrig cf 417 ttltrig cf file 417 nexpected symbol 192 nformatted Data read 315 write 383 nlock device 361 interface 361 nesting 361 Unmap Memory 36
100. ICL with GPIB Communicating with GPIB Interfaces tell scope to talk and printer to listen The listen command is formed by adding 32 to the device address of the device to be a listener The talk command is formed by adding 64 to the device address of the device to be a talker cmd 0 63 63 is unlisten Krf cmd 1 32 1 printer is at address 1 make it a listener cmd 2 64 7 scope is at address 7 make it a talker cmd 3 0 terminate the string AY igpibsendcmd intf cmd 3 set up our SRQ handler to be called when the scop finishes printing ionsrq scope srq_hdlr now the ATN line must be set to FALSE igpibatnctl intf 0 wait for SRQ before continuing program status 0 while status 0 iwaithdlr 120000L make sure it was the scope requesting service ireadstb scope amp status status amp 64 clear the status byte so the scope can assert SRQ again if needed iprintf scope CLS n void cleanup give local control back to the scope ilocal scope void srq hdlr INST id this handler does nothing we will use iwaithdlr in the code above to determine when the handler gets called 84 Chapter 4 Note Using SICL with GPIB Communicating with GPIB Commanders Communicating with GPIB Commanders Commander sessions are intended for use on GPIB interfaces that are not active controller
101. IT code iclose code ipromptf code lonerror code iopen code Possible Solution This error indicates that the SICL functions are not being found during the link process Most likely you have left out the SICL library during the link process Link in the SICL library with the lsicl option during the compile link process SICL assignments are undefined For example example c line 10 error 1588 id undefined example c line 10 error 1549 Modifiable lvalue required for assignment operator Possible Solution This error indicates that one of your assignments is undefined Check to make sure you declared your session as a SICL type INST at the beginning of your program Include an INST id at the beginning of your program Chapter 9 193 Program Hangs iopen fails Timeout occurred iopen fails Invalid Address Invalid INST Troubleshooting Your SICL Program Troubleshooting SICL Run time Errors Your program hangs while either sending or receiving data Possible Solution If your SICL program hangs the first thing you should try is to add the SICL itimeout function You must specify with what device or interface to time out However once the timeout time is reached the call will return with the I ERR _ TIMEOUT error iopen fails with a timeout error For example ERROR hpib 22 Timeout occurred Possible Solution This error indicates that the device or interface you
102. ITHDLR IINTROFF INTRON Chapter 10 241 SICL Language Reference IGETSESSTYPE IGETSESSTYPE Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int igetsesstype id pdata INST id int pdata Description The igetsesstype function returns in pdata a value indicating the type of session associated with a given session id This function returns one of the following values in pdata I_SESS_CMDR_ The session associated with id is a commander session I SESS DEV The session associated with id is a device session I_SESS_INTF The session associated with id is an interface session Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IOPEN 242 Chapter 10 SICL Language Reference IGETTERMCHR IGETTERMCHR Supported sessions 000 device interface commander C Syntax include lt sicl h gt int igettermchr id tchr INST id int tchr Description This function sets the variable referenced by tchr to the termination character for the session specified by id If no termination character is enabled for the session then the variable referenced by tchr is set to 1 Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also ITERMCHR Chapter 10 243 C Syntax
103. If another thread is using the LAN interface for greater than 2 minutes the no wait operation will timeout For C programs this function returns zero 0 if successful or a non zero error number if an error occurs ILANGETTIMEOUT and Chapter 8 Using SICL with LAN 276 Chapter 10 SICL Language Reference ILOCAL ay ILOCAL Supported sessions 00 cece ccc ee eee n ees device Affected by functions 0 0 0005 ilock itimeout C Syntax include lt sicl h gt int ilocal id INST id Description Use the ilocal function to put a device into Local Mode Putting a device in Local Mode enables the device s front panel interface Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IREMOTE and the interface specific chapter of this manual for details of implementation Chapter 10 277 C Syntax Note Description SICL Language Reference ILOCK ILOCK Supported sessions 00005 device interface commander Affected by functions 0 c eee eee eee eee itimeout f finclude lt sicl h gt int ilock id INST id Locks are not supported for LAN interface sessions such as those opened with lan_intf iopen lan To lock a session ensuring exclusive use of a resource use the i lock function The id parameter refers either to a device interface or comman
104. L s iscanf functions do not treat the newline n and carriage return r characters as white space Therefore they are treated as ordinary characters and must match input characters The conversion commands direct the assignment of the next arg The iscanf function places the converted input in the corresponding variable unless the assignment suppression character causes it to use no arg and to ignore the input This function ignores all white space characters in the input stream Examples of The following are examples of conversion commands used in the format Format Conversion Commands string and typical input data that would satisfy the conversion commands Conversion Input Data Description Command S S onestring suppression no assignment S s SS two strings suppression two assignment strings 3d 21512 5 61 comma operator shd 64 argument modifier short 10s onestring field width Chapter 10 323 SICL Language Reference ISCANF 10c onestring field width 10t two strings field width 10 chars read into 1 arg List of The conv chars conversion characters are conv chars d Corresponding arg must be a pointer to an integer for C C The library reads characters until an entire number is read It will convert IEEE 488 2 HEX OCT BIN and NRf format numbers If the 1 ell argument modifier is used the argument must be a pointer to a long integer in C C If the h argument modifier is used the argument mu
105. L Function Support with GPIB Interface Sessions cesescseseseeseesecseceecceeceeceeeceaceaeeaeees 78 GPIB Interface Session Examples ccsccesscesceeseeseesteeseeeteeseenees 79 Communicating with GPIB Commanders ccccccsesseesteeteeeeeeeeeesees 85 Addressing GPIB Commanders ccccccscesscesseesseetseeeceteeneeeseeeasees 85 SICL Function Support with GPIB Commander Sessions c scescesceeeeeeeesececeeeeeeeeeeeeenaeeaeens 87 Summary of GPIB Specific Functions cceccceeseesceesteeeeceeeeeteeeeeeseens 88 5 Using SICL with GPIO Creating a Communications Session With PIO sein eeiast coe eceeessentenvid EE EE E E E 91 Communicating with GPIO Interfaces cccecceescesseesseeteceteeeeeeeeeessees 92 Addressing GPIO Interfaces cccecccecseessecssceeeceeeeeseeeteceeenseeeneessees 92 SICL Function Support with GPIO Interface Sessions iirinn saatas aaka e eoet 93 GPIO Interface Session Example ccccccesscesseeseeseeseceseceseeeseeenes 95 GPIO Interrupts Example o oo ccc cecesccesseeseeeceseceseceeeeseeeeseeseeeseeees 96 Summary of GPIO Specific Functions c cccccscesseesteeeeceeeeetseeseeeseees 98 Contents 8 6 Using SICL with VXI MXxI Creating a Communications Session with VXI MXI eeeeeeeeeeees 103 Communicating with VXI MXI Devices ccccccceccecseeeeeeteeeseeeeeesees 104 Message Based Devices ccccecsccsseeeteceseeeeeeeeeeaecaaeeeesereeeeeeeee
106. L call If a SICL function is completed successfully this function returns undefined results On operating systems that support multiple threads the error number is per thread This means that the error number returned is for the last failed SICL function for this thread not necessarily for the session See Also IONERROR IGETONERROR IGETERRSTR ICAUSEERR 230 Chapter 10 SICL Language Reference IGETERRSTR IGETERRSTR C Syntax include lt sicl h gt char igeterrstr errorcode int errorcode Description SICL has a set of defined error messages that correspond to error codes see Chapter 9 Troubleshooting Your SICL Program for a list of errors that can be generated in SICL functions To get these error messages from error codes use the igeterrstr function Return Value Pass this function the error code you want and this function will return a human readable string See Also IONERROR IGETONERROR IGETERRNO ICAUSEERR Chapter 10 231 SICL Language Reference IGETGATEWAYTYPE IGETGATEWAYTY PE Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int igetgatewaytype id gwtype INST id int gwtype Description The igetgatewaytype function returns in gwtype the gateway type associated with a given session id This function returns one of the following values in gwtype I_INTF_LAN The session is using a LAN
107. Looking at SICL Function Support with VXI MXI Looking at SICL Function Support with VXI MXxI This section describes how SICL functions are implemented for VXI MXI sessions Device Sessions Message The following describes how some SICL functions are implemented for Based Device VXI MXI device sessions for message based devices Sessions iwrite iread ireadstb itrigger iclear ilonsrq Sends the data to the message based servant using the byte serial write protocol and the byte available word serial command Reads the data from the message based servant using the byte serial read protocol and the byte request word serial command read status byte Performs a VXI readSTB word serial command Sends a word serial trigger to the specified message based device Sends a word serial device clear to the specified message based device Can be used to catch SRQs from message based devices Register Based Because register based devices do not support the word serial protocol and Device other features of message based devices the following SICL functions are Sessions not supported with register based device sessions Non formatted I O iread iwrite itermchr 130 Chapter 6 Formatted I O iprintf iscanf ipromptf ifread ifwrite iflush isetbuf isetubuf Using SICL with VXI MXI Looking at SICL Function Support with VXI MXI Device Interface
108. O_CTRL_CTLO _GPIO_CTRL_CTL1 I_GPIO_DATA Data In lines 16 bit mask I_GPIO_INFO GPIO information _GPIO_AUTO_HDSK I GPIO_READ_EOI I GPIO_STAT END termination pattern Status lines _ GPIO_CHK_PSTS _GPIO_EIR _GPIO_ENH_MODE _GPIO_PSTS _GPIO_READY _ GPIO_EOIL NONE or 8 bit or 16 bit mask _GPIO_STAT_STIO _GPIO_STAT_STI1 99 Using SICL with GPIO Summary of GPIO Specific Functions 100 Chapter 5 Using SICL with VXI MXI Using SICL with VXI MXI This chapter explains how to use SICL to communicate over the VXIbus In order to communicate directly over the VXIbus you must have loaded the VXI fileset during the I O Libraries installation See the O Libraries Installation and Configuration Guide for information The example programs shown in this chapter are also provided in the opt sicl share examples directory This chapter contains the following sections e Creating a Communications Session with VXI MXI Communicating with VXI MXI Devices Communicating with VME Devices Communicating with VXI MXI Interfaces Looking at SICL Function Support with VXI MXI Using SICL Trigger Lines Using i blockcopy for DMA Transfers Using VXI Specific Interrupts Summary of VXI MXI Specific Functions For information on the specific SICL function calls see Chapter 10 102 Chapter 6 Note Using SICL with VXI MXI Creating a Communications Session with VXI MXI Creating a Communi
109. PIB device at bus address 23 INST dmm dmm iopen hpib 23 More on addressing specific devices can be found in the interface specific chapter for example Using SICL with GPIB later in this manual Interface Sessions An interface session allows low level control of the specified interface There is a full set of interface specific SICL functions for programming features that are specific to a particular interface type GPIB VXI etc This gives you full control of the activities on a given interface but does make for less portable code To create an interface session specify either the interface symbolic name or logical unit in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the V O Libraries Installation and Configuration Guide for information on these values The logical unit isan integer that corresponds to a specific interface The symbolic name isa string which uniquely describes the interface 40 Chapter3 Addressing Commander Sessions Using SICL Opening a Communications Session The following are valid interface addresses 7 Interface card at logical unit 7 hpib GPIB interface with the symbolic name hpib hpib2 Second GPIB interface with the symbolic name hpib2 The following example opens an interface session with the GPIB interface INST dmm dmm iopen hpib More on addressing specific interfaces ca
110. R RTS Ready To Send RTS 385 SICL Language Reference IXTRIG Triggers on VXI When used on a VXI interface session passing the I TRIG STD value to the ixtrig function causes one or more VXI trigger lines to fire Which trigger lines are fired is determined by the ivxitrigroute function The I_TRIG_STD value has no default value Therefore if it is not defined before it is used no action will be taken Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also ITRIGGER IVXITRIGON IVXITRIGOFF 386 Chapter 10 SICL Language Reference _SICLCLEANUP _SICLCLEANUP C Syntax include lt sicl h gt int _siclcleanup void Description This routine is called when a program is done with all SICL I O resources Calling this routine is not required on HP UX Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs Chapter 10 387 SICL Language Reference _SICLCLEANUP 388 Chapter 10 The SICL Files The SICL Files This appendix list the files and directories created on your system for SICL on HP UX 11i and Linux SICL RUN Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products Files for customization SICL SICL RUN opt sicl opt sicl The main SICL software directory opt sicl bin opt sicl bin The SICL
111. SER AL STOP 2 ERIAL WIDTH Data bits frame _SERIAL CHAR 5 _SER AL CHAR 6 _SERIAL CHAR 7 _ SER AL CHAR 8 ERIAL READ BUFSZ Receive buffer size Number of bytes ERIAL DUPLEX Data traffic _SERIAL DUPLEX HALF _ SERIAL DUPLEX FULL ERIAL FLOW CTRL Flow control _ SERIAL FLOW NONE _ SERIAL FLOW _XON IT SERIAL FLOW RTS CTS _ SERIAL FLOW _DTR_DSR ERIAL READ EO EOI indicator for reads _SERIAL EOI NONE _SERIAL EOI BIT8 _SERIAL EOI CHAR n ERIAL WRITE EO EOI indicator for writes _SERIAL EOI NONE _SERIAL EOI BIT8 ERIAL RESET Interface state none Chapter 7 157 Using SICL with RS 232 Summary of RS 232 Specific Functions Function Name Action iserialstat Gets the following information about the RS 232 interface Request Characteristic Value SERIAL BAUD Data rate 2400 9600 etc SERIAL PARITY Parity _SERIAL PAR SERIAL STOP Stop bits frame _SERIAL STOP SERIAL WIDTH Data bits frame _SERIAL CHAR SERIAL DUPLEX Data traffic _SERIAL DUPLEX SERIAL MSL Modem status lines _SERIAL DCD _ SERIAL DSR _SERIAL CTS _SERIAL R _SERIAL TER _ SERIAL D DCD _SERI
112. TAMS PCI GPIO Card 71622 81622 Installation and Operations Instructions GPIB Interface Learning Products TAMS PCI GPIB Card 70488 80488 Installation and Operations Instructions HP Agilent E2078A Users Guide Tutorial Description of the Hewlett Packard Interface Bus HPIB Series 700 RS 232 Interface Learning Products The RS 232 Solution by Joe Campbell SYBEX Publishing Chapter 1 23 Introduction Related Documents 24 LAN Learning Products Networking Overview Installing and Administering LAN 9000 Software Administering ARPA Services LAN GPIB Gateway Learning Products TAMS 3010 LAN I O Gateway Installation and Configuration Guide HP Agilent E2050 LAN GPIB Gateway Installation and Configuration Guide VXIbus Consortium Specifications The VMEbus Specification The VMEbus Extensions for Instrumentation TCP IP Instrument Protocol Specification VXI 11 Rev 1 0 TCP IP VXTbus Interface Specification VXI 11 1 Rev 1 0 TCP P IEEE 488 1 Interface Specification VXI 11 2 Rev 1 0 TCP P IEEE 488 2 Instrument Interface Specification VXI 11 3 Rev 1 0 Chapter 1 Getting Started with SICL Getting Started with SICL This chapter steps you through building and running your first SICL program If you plan to develop SICL applications go through this chapter to ensure you perform all the steps required to build and run a SICL program This chapter contains the following se
113. TRUE or request FALSE arrived process request TRUE or request FALSE event generate SRQ if appropriate exit is signal an undefined command event if yes then Undefined command event process an undefined command event exit Signal is a user defined or undefined event send I_INTR VXI_SIGNAL to device sessions for this device exit E Chapter 6 139 Using SICL with VXI MXI Using VXI Specific Interrupts Processing VME Interrupts Example vmeintr c This example uses SICL to cause a VME interrupt from an HP E1361 register based relay card at logical address 136 include lt sicl h gt static void vmeint INST unsigned short static void int setup INST unsigned long static void int _ hndlr INST long long int intr 0 main Into INST id intfl unsigned long mask 1 ionerror I_ERROR_ EXIT lintroff id intfl iopen vxi 136 int setup id_intfl mask vmeint id intfl 136 wait for SRQ or interrupt condition iwaithdlr 0 iintron iclose id_intfl static void int setup INST id unsigned long mask ionintr id int hndlr isetintr id I _INTR_VXI_SIGNAL mask static void vmeint INST id unsigned short laddr int reg char al6 ptr 0 reg 8 al ptr imap id I MAP Al6 0 1 QO Cause uhf mux to interrupt iwpoke unsigned short al6 ptr Oxc000 laddr 64
114. The names cf Configuration File ccccccsesseesseeseceseceeeeeseenseensees 416 The oride cf Configuration File cccccccscseesteeteceteceeeeeeeeeensees 416 The ttltrig cf Configuration File ec ceeeseecseceeeececeeeeeeeeeeeeeeaeeas 417 The iproc Utility Initialization and SYSRESET eee eeeeeeeeeneees 418 Viewing the VXIbus System Configuration cccccecccsceeseesteesteeteeees 421 VXI MXI Configuration Utilities ceccececseseeseceteceteeeseeseeseeseeees 422 VOL OCS EEEE E E E EASE A 423 WKI r a A A E a EE R 425 VXI SC EE E PRET ee A E E ES 428 Contents 14 Contents 15 Contents 16 Introduction Introduction Introduction Welcome to the Standard Instrument Control Library SICL User 5s Guide This manual describes how to use SICL A getting started chapter steps you through the process of building and running a simple SICL program The basics of SICL programming are covered in the following chapter and later chapters describe how to use SICL with specific interfaces GPIB GPIO VXI MXI RS 232 and LAN Also included is a complete SICL language Reference See the V O Libraries Installation and Configuration Guide for detailed information on SICL installation and configuration This manual contains the following Chapter 2 Getting Started with SICL steps you through building and running a simple example program This is a good place to start if you are a first time SICL user e Chapter
115. address in prim The sec parameter contains the secondary address of the device or 1 if no secondary address exists Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IOPEN 228 Chapter 10 C Syntax Description SICL Language Reference IGETERRNO IGETERRNO finclude lt sicl h gt O int igeterrno geterrno All functions except a few listed below return a zero if no error occurred I_ERR_NOERROR or a non zero error code if an error occurs see Chapter 9 Troubleshooting Your SICL Program for a list of errors This value can be used directly The igeterrno function will return the last error that occurred in one of the library functions Also if an error handler is installed the library calls the error handler when an error occurs The following functions do not return the error code in the return value Instead they simply indicate whether an error occurred iopen iprintf isprintf ivprintf isvprintf iscanf isscanf ivscanf isvscanf ipromptf ivpromptf imap i peek i poke For these functions and any of the other functions when an error is indicated read the error code by using the igeterrno function or read the associated error message by using the igeterrstr function Chapter 10 229 SICL Language Reference IGETERRNO Return Value This function returns the error code from the last failed SIC
116. address of the currently installed error handler into the variable pointed to by proc If no error handler exists it will store a zero 0 Return Value This function returns zero 0 if successful or a non zero error number if an error occurs See Also IONERROR IGETERRNO IGETERRSTR ICAUSEERR Chapter 10 239 C Syntax Description Return Value See Also SICL Language Reference IGETONINTR IGETONINTR Supported sessions 0000 device interface commander include lt sicl h gt int igetonintr id proc INST id void proc INST long long The igetonintr function stores the address of the current interrupt handler in proc If no interrupt handler is currently installed proc is set to zero 0 This function returns zero 0 if successful or a non zero error number if an error occurs IONINTR ITWAITHDLR IINTROFP INTRON 240 Chapter 10 SICL Language Reference IGETONSRQ IGETONSRQ Supported sessions 00 c cece eee eens device interface C Syntax include lt sicl h gt int igetonsrq id proc INST id void proc INST Description The igetonsrq function stores the address of the current SRQ handler in proc If there is no SRQ handler installed proc will be set to zero 0 Return Value This function returns zero 0 if successful or a non zero error number if an error occurs See Also IONSRQ IWA
117. al INST id long tval The ilantimeout function is used to set the length of time that the application LAN client will wait for a response from the LAN server Once an application has manually set the LAN timeout via this function the software will no longer attempt to determine the LAN timeout which should be used Instead the software will simply use the value set via this function In this function tva defines the timeout in milliseconds A value of zero 0 disables timeouts The value 1 has special significance causing the LAN client to not wait for a response from the LAN server However the value 1 should be used in special circumstances only and should be used with extreme caution See the following subsection Using the No Wait Value for more information The ilantimeout function is per process Thus when ilantimeout is called all sessions which are going out over the network are affected 274 Chapter 10 Note Note Using the No Wait Value Caution SICL Language Reference ILANTIMEOUT Not all computer systems can guarantee an accuracy of one millisecond on timeouts Some computer clock systems only provide a resolution of 1 50th or 1 60th of a second Other computers have a resolution of only 1 second Note that the time value is always rounded up to the next unit of resolution This function does not affect the SICL timeout value set via the itimeout function The LAN server will attempt the I O oper
118. alled the only way you can be informed that an error has occurred is to use igeterrno right after the iprintf call Remember that iprintf can be called many times without any data being flushed to the session There are only three conditions where the write formatted I O buffer is flushed Those conditions are Ifa newline is encountered in the format string e Ifthe buffer is filled Ififlush is called with the 1 BUF_WRITE value If an error occurs while writing data such as a timeout the buffer will be flushed that is the data will be lost and if an error handler is installed it will be called or the error number will be set to the appropriate value ISCANF IPROMPTF IFLUSH ISETBUF ISETUBUF TFREAD IFWRITE Chapter 10 311 C Syntax Description See Also SICL Language Reference IPROMPTF IPROMPTF Supported sessions 00005 device interface commander Affected by functions 0 00 0 000 00 ee ilock itimeout finclude lt sicl h gt int ipromptf id writefmt readfmt argl arg2 int ivpromptf id writefmt readfmt va_list ap INST id const char writefmt const char readfmt param argl arg2 va_list ap The ipromptf function is used to perform a formatted write immediately followed by a formatted read This function is a combination of the iprintf and iscanf functions First it flushes the read buffer It
119. ample The following example program opens a communication session with a VXI message based device and measures the AC voltage The measurement results are then printed vximesdev c This example program measures AC voltage on a multimeter and prints out the results include lt sicl h gt include lt stdio h gt main INST dvm char strres 20 Print message and terminate on error ionerror I_ ERROR EXIT Open the multimeter session dvm iopen vxi 24 itimeout dvm 10000 Initialize dvm iwrite dvm RST n 5 1 NULL Take measurement iwrite dvm MEAS VOLT AC 1 0 001 n 23 1 NULL Read measurements iread dvm strres 20 NULL NULL Print the results printf Result is s n strres Close the multimeter session iclose dvm 108 Chapter 6 Using SICL with VXI MXI Communicating with VXI MXI Devices Register Based Devices There are several methods that can be used for communicating with register based devices iscpi interface Register Programming Other Products HP Agilent Command Module Chapter 6 Use the SICL iscpi interface and program using SCPI commands The iscpi interface interprets the SCPI commands and allows you to communicate directly with register based devices Interpeted SCPI drivers for cards are available only for selected operating systems and cards These drivers rely on card
120. ans that you can control at what point you want the data written If no newline character is included in the format string for an iprintf call then the converted characters are stored in the output buffer It will require another call to iprintf ora call to iflush to have those characters written iflush only sends the data queued in the buffer and not the END indicator asin iprintf Note that newline characters output from an output parameter do not cause a flush only newlines in the format string do This can be very useful in queuing up data to send to a device It can also raise I O performance by doing a few large writes instead of several smaller writes This behavior can be changed by the isetbuf and isetubuf functions See the next section Formatted I O Buffers The format string for iscanf ignores most white space characters Newlines n and carriage returns r however are treated just like normal characters in the format string which must match the next non white space character read The SICL software maintains both a read and write buffer for formatted I O operations Occasionally you may want to control the actions of these buffers The write buffer is maintained by the iprintf and the write portion of the ipromptf functions It queues characters to send so that they are sent in large blocks thus increasing performance The write buffer automatically flushes when it sends a newline character from the format string
121. ap in VXI device registers Device session only 64 bytes Chapter 10 283 SICL Language Reference IMAPX I MAP EXTEND Map in VXI Device Extended Memory address space in A24 or A32 address space See individual device manuals for details regarding extended memory address space Device session only I MAP SHARED Map in VXI A24 A32 memory that is physically located on this device sometimes called local shared memory If the hardware supports it that is the local shared VXI memory is dual ported this map should be through the local system bus and not through the VXI memory This mapping mechanism provides an alternate way of accessing local VXI memory without having to go through the normal VXI memory system The value of pagestart is the offset in 64 Kbyte pages into the shared memory The value of pagecnt is the amount of memory in 64 Kbyte pages to map Note The E1489 MXIbus Controller Interface can generate 32 bit data reads and writes to VXIbus devices with D32 capability To use 32 bit transfers with the E1489 use I MAP A16 D32 I MAP A24 D32 and I MAP A32_D32 in place of I MAP A16 I MAP A24 and I MAP A32 when mapping to D32 devices Depending on what iderefptr returns memory may be accessed directly Since this function returns a C pointer you can also use C pointer arithmetic to manipulate the pointer and access memory directly Note that accidentally accessing non existent memory will cause
122. apping 112 Memory space Mapping 114 125 Message Based devices 104 130 communicating 105 Message based programming Example 108 Messages Error 190 Modem Control Lines 334 Move data Data move 215 Multi user environment Locking 66 MXI 368 Triggering 417 names cf file 416 NDAC See GPIB Nesting interrupts 272 locks 279 361 Networking Protocols 166 Networking see LAN Newline character 50 nonformatio c example 53 Non formatted I O 52 Example 53 Normal Operation VXI 379 Notification Interrupts 55 NRED See GPIB lines 451 O Online help 32 Opening a session 38 oride cf file and VME 122 Overview SICL 20 VXI MXI configuration 411 P Parallel Interface sessions 92 SICL functions parallel specific 98 parallel poll 253 Parallel Poll GPIB 252 253 254 Parity 330 Pass Control 78 Pass Control GPIB 251 Performance LAN 168 Polling 270 portmapper 201 Precision 45 Preference for Data Transfer 269 Primary address 73 106 110 Program hangs 194 Programming Register 112 Protocols Networking 166 R Read buffered data 223 formatted data 312 319 memory 296 297 unformatted data 315 Register programming 112 114 125 Catching bus errors 117 Example 114 Register Based devices 104 130 communicating 109 Mapping memory space 112 REM See GPIB lines Remote Enable 248 452 Remote Enable GPIB 255 Remote Mode 2
123. apter only the addresses passed to the iopen calls are modified The example addresses assume the machine with hostname instserv is acting as a LAN to GPIB gateway 174 Chapter 8 Using SICL with LAN Communicating with Devices over LAN landev c This example program sends a scan list to a switch and while looping closes channels and takes measurements finclude lt sicl h gt finclude lt stdio h gt main INST dvm INST sw double res int i Print message and terminate on error ionerror I _ERROR_EXIT Open the multimeter and switch sessions dvm iopen lan instserv hpib 9 3 sw iopen lan instserv hpib 9 14 itimeout dvm 10000 itimeout sw 10000 Set up trigger iprintf sw TRIG SOUR BUS n Set up scan list iprintf sw SCAN 100 103 n iprintf sw INIT n for i 1 1 lt 4 1i Take a measurement iprintf dvm MEAS VOLT DC n Read the results iscanf dvm Slf amp res Print the results printf Result is f n res Trigger to close channel iprintf sw TRIG n Close the multimeter and switch sessions iclose dvm iclose sw Chapter 8 175 Addressing LAN Interface Sessions SICL Function Support with LAN Interface Sessions J Using SICL with LAN Communicating with Devices over LAN LAN Interface Sessions The LAN interface unlike most
124. at follow Appendix D 411 Customizing your VXI MXI System The VXI MXI Resource Manager ivxirm The VXI MXI Resource Manager ivxirm The ivxirm utility is the resource manager which initializes and configures the VXI MXI cardcage resources The resource manager reads the VXI MXI configuration files and polls the VXI devices to determine their resources and capabilities The commander servant hierarchy is set up and the appropriate commands are sent to the VXI devices The information is then stored in the following file etc opt sicl vxiLU rsrcemgr out Where LU is the logical unit of the VXI MXI interface The resource manager also optionally prints this information to the standard output You can run this utility from the command line or it generally runs at cardcage initialization if specified in the iproc cf configuration file default is to run when the system boots Additionally there is another utility that can be used to review the system resources The ivxisc utility reads the rsrcmgr out file and prints a human readable display of the current configuration See the ivxirm and ivxisc utilities later in this chapter for a description on using these utilities 412 Appendix D Customizing your VXI MXI System The VXI MXI Configuration Files The VXI MXI Configuration Files In general the resource manager follows a set of rules defined by the VXI Standard when configuring the system However the VXI standard does not
125. ation for the amount of time specified via itimeout before returning a response If the SICL timeout used by the server is greater than the LAN timeout used by the client the client may timeout prior to the server while the server continues to service the request This use of the two timeout values is not recommended since under this situation the server may send an unwanted response to the client A tval value of 1 has special significance to ilantimeout causing the LAN client to not wait for a response from the LAN server For a very limited number of cases it may make sense to use this no wait value One such scenario is when the performance of paired writes and reads over a wide area network WAN with long latency times is critical and losing status information from the write can be tolerated Having the write and only the write call not wait for a response allows the read call to proceed immediately potentially cutting the time required to perform the paired WAN write read in half This value should be used with great caution If ilantimeout is set to 1 and then is not reset for a subsequent call the system may deadlock due to responses being buffered which are never read filling the buffers on both the LAN client and server Chapter 10 275 Note Return Value See Also SICL Language Reference ILANTIMEOUT To use the no wait value do the following e Prior to the iwrite call or any formatted I O call that will wr
126. bit and use the rest for the data that is put in your buffer Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also ISERIALCTRL Chapter 10 339 SICL Language Reference ISETBUF ISETBUF Supported sessions 000005 device interface commander Affected by functions 0000 ilock itimeout C Syntax include lt sicl h gt int isetbuf id mask size INST id int mask int size Description This function is used to set the size and actions of the read and or write buffers of formatted I O The mask can be one or the bit wise OR of both of the following flags I_BUF_READSpecifies the read buffer I_BUF_WRITESpecifies the write buffer The size argument specifies the size of the read or write buffer or both in bytes Setting a size of zero 0 disables buffering This means that for write buffers each byte goes directly to the device For read buffers the driver reads each byte directly from the device Setting a size greater than zero creates a buffer of the specified size For write buffers the buffer flushes writes to the device whenever the buffer fills up and for each newline character in the format string However note that the buffer is not flushed by newline characters in the argument list For read buffers the buffer is never flushed that is it holds any
127. bus errors Refer to Chapter 6 of this manual for an example of trapping bus errors Or see your operating system s programming information for help in trapping bus errors You will probably find this information under the command signal in your operating system s manuals 284 Chapter 10 SICL Language Reference IMAPX Note Due to hardware constraints on a given device or interface not all address spaces may be implemented In addition there may be a maximum number of pages that can be simultaneously mapped If a request is made that cannot be granted due to hardware constraints the process will hang until the desired resources become available To avoid this use the isetlockwait command with the flag parameter set to 0 and thus generate an error instead of waiting for the resources to become available You may also use the imapinfo function to determine hardware constraints before making an imap call Remember to iunmapx a memory space when you no longer need it The resources may be needed by another process Return Value For C programs this function returns a zero 0 if an error occurs or a non zero number if successful This non zero number is either a handle or the address to begin mapping memory Use the iderefptr function to determine wheter the returned handle is a valid address or a handle See Also TUNMAPX IMAPINFO IDEREFPTR Chapter 10 285 SICL Language Reference IMAPINFO IMAPINFO Supporte
128. byte swapping to perform byte data and no swapping is performed e 2 16 bit word data and bytes are swapped on word boundaries e 4 32 bit longword data and bytes are swapped on longword boundaries e 8 64 bit data and bytes are swapped on 8 byte boundaries The ength parameter must be an integer multiple of datasize If not unexpected results will occur IEEE 488 2 specifies the default data transfer format to transfer data in big endian format Non 488 2 devices may send data in either big endian or little endian format These functions do not depend on a SICL session id Therefore they may be used to perform non SICL related task namely file I O The following constants are available for use by your application to determine which byte ordering is native to this controller s architecture I ORDER LE This constant is defined if the native controller is little endian I ORDER BE This constant is defined if the native controller is big endian These constants may be used in if or ifdef statements to determine the byte ordering requirements of this controller s architecture This information can then be used with the known byte ordering of the devices being used to determine the swapping that needs to be performed For C programs this function returns zero 0 if successful or a non zero error number if an error occurs IPOKE IPEER ISCANF IPRINTF 356 Chapter
129. cations Session with VXI MXI Before you start programming your VXI MXI system ensure that the system is set up and operating correctly See Appendix D Customizing your VXI MXI System later in this manual for configuration information To begin programming your VXI MXI system you must determine what type of communication session you need The two supported VXI communication sessions are as follows Device Session The device session allows you direct access to a device without worrying about the type of interface to which it is connected Interface Session An interface session allows direct low level control of the specified interface This gives you full control of the activities on a given interface such as VXI Device sessions are the recommended method for communicating while using SICL They provide the highest level of programming best overall performance and best portability Commander Sessions are not supported with VXI interfaces Chapter 6 103 Using SICL with VXI MXI Communicating with VXI MXI Devices Communicating with VXI MXI Devices If you are going to use SICL functions to communicate directly with VXI devices you must first be aware of the two different types of VXI devices Message Based Register Based 104 Message based devices have their own processors which allow them to interpret the high level SCPI Standard Commands for Programmable Instruments commands While using SICL you simply place
130. cator I SERIAL TERI Trailing Edge of RI e I SERIAL D_DCD The DCD line has changed since the last time this status has been checked I SERIAL _D_DSR The DSR line has changed since the last time this status has been checked I SERIAL D CTS The CTS line has changed since the last time this status has been checked Chapter 10 337 SICL Language Reference ISERIALSTAT I SERIAL STAT I SERIAL READ BUFSZ I SERIAL READ DAV I SERIAL FLOW CTRL 338 This is a read destructive status That means reading this request resets the condition The result parameter will be set the bit wise OR of the following conditions I SERIAL DAV Data is available I SERIAL PARITY Parity error has occurred since the last time the status was checked I SERIAL OVERFLOW Overflow error has occurred since the last time the status was checked I SERIAL FRAMING Framing error has occurred since the last time the status was checked I SERIAL BREAK Break has been received since the last time the status was checked I SERIAL TEMT Transmitter empty The result parameter will be set to the current size of the read buffer The result parameter will be set to the current amount of data available for reading The result parameter will be set to the value of the current type of flow control that the interface is using I
131. ce characters that extends either to the next inappropriate character or until the field width if specified is exhausted An optional integer representing the field width In C C if a pound sign appears instead of the integer then the next arg is a pointer to the field width This arg is a pointer to an integer for 3c 3s t and S This arg is a pointer to a long for 2b The field width is not allowed for 3d or Sf An optional comma operator is an integer preceded by a comma It reads a list of comma separated numbers The comma operator is in the form of dd where dd is the number of array elements to read In C C a pound sign can be substituted for the number in which case the next argument is a pointer to an integer that is the number of elements in the array Note SICL Language Reference ISCANF The function will set this to the number of elements read This operator is only valid with the conversion characters d and f The argument must be an array of the type specified argument The meaning of the optional argument modifiers h 1 w modifier z and Z is dependent on the conversion character conv char A conversion character is a character that specifies the type of arg and the conversion to be applied This is the only required element of a conversion command See the following subsection List of conv chars for the specific conversion characters you may use Unlike C s scanf function SIC
132. ce sessions 146 serial interface sessions 150 VXI MXI interface sessions 118 VXI MXI message based device sessions 106 VXI MXI register based device sessions 110 Archive libraries 400 442 Argument modifier 46 Array size 46 Asynchronous Events disable 271 enable 272 Asynchronous events 54 Interrupts 55 SIGUSR2 57 SRQs 54 ATN See GPIB lines Attention ATN Line See GPIB B Bad address 197 Baud Rate 330 Big endian Byte Order 355 Block Transfers 213 from FIFO 300 to FIFO 313 BREAK 333 BREAK sending 329 Buffers data structure 342 flush 221 Flushing 50 set size 340 set size and location 353 Building SICL applications on HP UX 10 399 Bus Address GPIB 248 Bus errors 117 Example 117 Byte Order big endian 355 determine 356 little endian 355 C Clear device 218 interface 218 cmdr string 41 HP IB 85 LAN 169 cmdrsrvt cf file 416 Comma operator 46 Command Module 104 communicating 109 Commander close 219 interrupts 344 lock 279 session 295 set status byte 352 Commander servant hierarchy 416 Commander sessions 41 Addressing 41 HP IB addressing 85 HP IB communicating 85 LAN addressing 169 Commands Word serial 130 Communication sessions 38 GPIO 91 HP IB 71 LAN 169 Paralle 91 RS 232 145 Serial 145 VXI MXI 103 Compile errors Troubleshooting 192 Unexpected symbol 192 Compile Link errors Undefined id 193 Compiling
133. ch the VXI resource manager will access the bus 6 is the VXI slot number A2 4 is the address space to map the VME registers 0x400000 is the starting address 0x1000 is the size and 3 is the irq line If your VME device requires both A24 and A32 address space you will need to have an entry for each address space Each line should use a different device name for example vmedey1 and vmedev2 Once you have made the appropriate entry into the vmedev cf file you must re run the Resource Manager The following ANSI C example program opens a VXI MXI interface session and sets up an interrupt handler When the I INTR_VME_ IRQ interrupt occurs the function defined in the interrupt handler will be called The program then writes to the registers causing the I INTR_ VME IRQ interrupt to occur Note that you must edit this program to specify the starting address and register offset of your specific VME device This example program also requires the VME device to be using 126 Chapter 6 Using SICL with VXI MXI Communicating with VME Devices _INTR_VME_IRQ1 and the VXI controller to be the handler for the VME IRQI Chapter 6 127 Using SICL with VXI MXI Communicating with VME Devices vmedev c This example program opens a VXI MXI interface session and sets up an interrupt handler When the specified interrupt occurs the procedure defined in the inte
134. clude lt sicl h gt int igpibpassctl id busaddr INST id int busaddr Description The igpibpassct1 function passes control from this GPIB interface to another GPIB device specified in busaddr The busaddr parameter must be between 0 and 30 Note that this will also cause an I INTR_INTFDEACT interrupt if enabled Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IONINTR ISETINTR Chapter 10 251 SICL Language Reference IGPIBPPOLL IGPIBPPOLL Supported sessions 0 0 cece cece ene interface Affected by functions 00 0 0 00 eee ilock itimeout C Syntax include lt sicl h gt int igpibppoll id result INST id unsigned int result ByVal id As Integer result As Integer Description The igpibppol1 function performs a parallel poll on the bus and returns the 8 bit result in the lower byte of result Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIBPPOLLCONFIG IGPIBPPOLLRESP 252 Chapter 10 C Syntax Description Return Value See Also SICL Language Reference IGPIBPPOLLCONFIG IGPIBPPOLLCONFIG Supported sessions 00 000 eee e eee eee ee device commander Affected by functions 000 000s ilock itimeout include lt sicl h gt int igpibppollconfig id c
135. configuration tools programs etc opt sicl defaults opt sicl Default versions of the hwconfig cf defaults and iproc cf files opt sicl lib opt sicl lib Driver binary modules which are linked and inserted in the kernel by the SICL configuration programs Also adds the shared libraries opt sicl lib opt sicl lib Files for the shared library 390 AppendixA SICL PRG Filesets The SICL Files HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL PRG opt sicl lib opt sicl include opt sicl opt sicl bin opt sicl share examples opt sicl lib opt sicl include opt sicl opt sicl bin opt sicl share examples Files for customization The SICL library libsicl a The SICL header file sicl h The DIL to SICL migration document The dil2sicl migration tool The SICL example programs SICL VXI Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL VXI Files for customization The VXI specific configuration files including the resource manager program ivxirm The default versions of the VXI configuration files opt sicl bin opt sicl bin opt sicl defaults opt sicl defaults opt sicl lib opt sicl lib The VXI driver binary modules which are linked and inserted in the kernel by the SICLconf configuration program Also adds the driver s
136. converted from the internal computer format to the standard IEEE 488 2 format Chapter 10 ole Chapter 10 SICL Language Reference IPRINTF If the 1 argument modifier is present the block of data is an array of unsigned long integers The data block is sent to the device as an array of longwords 32 bits The field width value now corresponds to the number of long integers not bytes Each word will be appropriately byte swapped and padded so that they are converted from the internal computer format to the standard IEEE 488 2 format If the z argument modifier is present the block of data is an array of floats The data is sent to the device as an array of 32 bit IEEE 754 format floating point numbers The field width is the number of floats If the Z argument modifier is present the block of data is an array of doubles The data is sent to the device as an array of 64 bit IEEE 754 format floating point numbers The field width is the number of doubles Same as b in C C except that the data block is sent as IEEE 488 2 Indefinite Length Arbitrary Block Response Data Note that this format involves sending a newline with an END indicator on the last byte of the data block In C C corresponding arg is a character In C C corresponding arg is a character Send with END indicator In C C control sending the END indicator with each LF character in the format string A flag indicates to send an END with each succeed
137. ctions Reviewing an SICL Program Compiling and Linking an SICL Program Running an SICL Program Getting Online Help Where to Go Next If you need additional information on any of the SICL functions see Chapter 10 for details 26 Chapter2 Getting Started with SICL Reviewing a SICL Program Reviewing a SICL Program Example programs are included in your SICL product to help you get started using SICL Copies of the example programs are located in the opt sicl share examples directory The following is a simple C program that uses SCPI commands to query an GPIB instrument for its identification string and print the results idn c The following program uses SICL to query an HPIB instrument for an identification string and prints the results include lt stdio h gt include lt sicl h gt SICL header file Modify this line to reflect the address of your device define DEVICE ADDRESS hpib 0 void main declare a device session id INST id char buf 256 error handler to exit if an error is detected ionerror I ERROR EXIT open a device session with device at DEVICE ADDRESS id iopen DEVICE ADDRESS set timeout value to 1 sec itimeout id 1000 send SCPI RST command and prompt for id string iprintf id RST n ipromptf id IDN n St buf print contents of buf
138. d and write to devices or interfaces from the command line Appendix D Customizing your VXI MXI System documents how you can customize your VXI MXI system VXI MXI configuration utilities are documented as well This guide also contains a Glossary of terms and their definitions as well as an Index 19 Chapter 1 Introduction SICL Overview SICL Overview SICL is a modular instrument communications library that works with a variety of computer architectures I O interfaces and operating systems Applications written in C or C using this library can be ported at the source code level from one system to another without or with very few changes SICL uses standard commonly used functions to communicate over a wide variety of interfaces For example a program written to communicate with a particular instrument on a given interface can also communicate with an equivalent instrument on a different type of interface This is possible because the commands are independent of the specific communications interface SICL also provides commands to take advantage of the unique features of each type of interface thus giving the programmer complete control over I O communications SICL Features SICL has several features that distinguish it from other I O libraries e Portability e Centralized error handling e Formatted I O e Device interface and commander communications sessions e Asynchronous event notification 20 Chapter
139. d memory ptr imap id I MAP EXTEND 0 1 0 Map to a computer s A24 or A32 shared memory ptr imap id I MAP SHARED 0 1 0 Chapter 6 113 Note Register Based Programming Example Using SICL with VXI MXI Communicating with VXI MXI Devices Due to hardware constraints on given devices or interfaces not all address spaces may be implemented In addition there may be a maximum number of pages that can be simultaneously mapped If a request is made that cannot be granted due to hardware constraints the process will hang until the desired resources become available To avoid this use the iset lockwait with the flag parameter set to 0 and thus generate an error instead of waiting for the resources to become available You may also use the imapinfo function to determine hardware constraints before making an imap call Reading and Writing to the Device Registers Once you have mapped the memory space use the SICL i peek and i poke functions to communicate with the register based instruments With these functions you need to know which register you want to communicate with and the register s offset See the instrument s user s manual for a description of the registers and register locations The following is an example of using iwpeek id iopen vxi 24 addr imap id I_ MAP VXIDEV 0 1 0 reg data iwpeek addr 4 See Chapter 10 for a complete description o
140. d sessions 00005 device interface commander C Syntax include lt sicl h gt int imapinfo id map _ space numwindows winsize INST id int map_space int numwindows int winsize Note Not supported over LAN Description To determine hardware constraints on memory mappings imposed by a particular interface use the imapinfo function The id argument specifies a VXI interface The map_space argument specifies the address space Valid values for map_space are I MAP A16 VXI A16 address space 64 Kbyte pages I MAP A24 VXI A24 address space 64 Kbyte pages I MAP A32 VXI A32 address space 64 Kbyte pages The numwindows argument is filled in with the total number of windows available in the address space The winsize argument is filled in with the size of the windows in pages Hardware design constraints may prevent some devices or interfaces from implementing all of the various address spaces Also there may be a limit to the number of pages that can simultaneously be mapped for usage In addition some resources may already be in use and locked by another process If resource constraints prevent a mapping request the imap function will hang waiting for the resources to become available 286 Chapter 10 SICL Language Reference IMAPINFO Remember to unmap a memory space when you no longer need it The resources may be needed by another process Return Value For C programs this function returns
141. der Typically a commander session is used when a computer connected to the interface is acting like a device There are two parts to opening a communication session with a specific device interface or commander First you must create an instance of a SICL session by declaring a variable of type INST Once the variable is declared then you can open the communication channel by using the SICL iopen function INST id id iopen addr Where id is declared with the type INST and communicates to a device interface or commander The addr parameter is a string expression which specifies a device session address interface session address or a commander session address See the sections that follow for details on creating the different types of communications sessions Your program may have several sessions open at the same time by creating multiple INST identifiers with the iopen function Use the SICL iclose function to close a channel of communication 38 Chapter3 Addressing Device Sessions Note Using SICL Opening a Communications Session Device Sessions A device session allows you direct access to a device without worrying about the type of interface to which it is connected On GPIB for example you do not have to address a device to listen before sending data to it This insulation makes applications more robust and portable across interfaces and is recommended for most applications Device sessions are th
142. der session If it refers to an interface then the entire interface is locked other interfaces are not affected by this session If the id refers to a device or commander then only that device or commander is locked and only that session may access that device or commander However other devices either on that interface or on other interfaces may be accessed as usual Locks are implemented on a per session basis If a session within a given process locks a device or interface then that device or interface is only accessible from that session It is not accessible from any other session in this process or in any other process Attempting to call a SICL function that obeys locks on a device or interface that is locked will cause the call either to hang until the device or interface is unlocked to timeout or to return with the error I_ ERR_LOCKED see isetlockwait Locking an interface from an interface session restricts other device and interface sessions from accessing this interface 278 Chapter 10 Note Note Return Value See Also SICL Language Reference ILOCK Locking a device restricts other device sessions from accessing this device however other interface sessions may continue to use this interface Locking a commander from a commander session restricts other commander sessions from accessing this controller however interface sessions may continue to use this interface Locking an interface does
143. device symbolic name A name corresponding to a single interface or device This name uniquely identifies the interface or device on this controller If there is more than one 438 interface or device on the controller each interface or device must have a unique symbolic name thread An operating system object that consists of a flow of control within a process A single process may have multiple threads that each have access to the same data space within the process However each thread has its own stack and all threads may execute concurrently with each other either on multiple processors or by time sharing a single processor 439 440 Index Symbols _siclcleanup C 387 vximesdev c example 108 A Access modes VME 124 Active Controller 74 78 Active Controller GPIB 247 Address bus GPIB 248 emdr 85 device 228 GPIO symbolic name 92 HP IB symbolic name 77 interface 236 LAN symbolic name 169 logical unit lu 236 logical unit lu information 237 logical unit lu list 238 Primary 73 RS 232 symbolic name 150 Secondary 73 session 226 symbolic name 40 118 VXI MXI symbolic name 118 Addressing Commander sessions 41 Device sessions 39 GPIO interface sessions 92 HP IB commander sessions 85 HP IB device sessions 72 Interface sessions 40 LAN gatewayed sessions 169 Parallel interface sessions 92 RS 232 device sessions 146 RS 232 interface sessions 150 serial devi
144. do not close this session If no errors occur this function returns a valid session id otherwise it returns zero 0 TOPEN Chapter 10 233 SICL Language Reference IGETINTFTYPE IGETINTFTYPE Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int igetintftype id pdata INST id int pdata Description The igetintftype function returns a value indicating the type of interface associated with a session This function returns one of the following values in pdata I_INTF_GPIB This session is associated with a GPIB interface I_INTF_GPIO This session is associated with a GPIO interface I_INTF_LAN This session is associated with a LAN interface I_INTF_RS232_ This session is associated with an RS 232 Serial interface I_INTF_VXI This session is associated with a VXI interface Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IOPEN 234 Chapter 10 SICL Language Reference IGETLOCKWAIT IGETLOCKWAIT Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int igetlockwait id flag INST id int flag Description To get the current status of the lockwait flag use the iget lockwait function This function stores a one 1 in the variable pointed to by flag if the wait mode is enabled or a zero 0 if a no wai
145. e The following re quests are clarified I SER AL MSL Gets the state of the modem status line e I SER transmit AL STAT Gets the status of the and receive buffers and the errors that have occurred since the last time this request was made Only the error bits I SER AL PARITY ER AL OVERFLOW D AL FRAMING and AL BREAK are cleared the Yl U U UN R ER R DT AL DAVand I SERIAL TEMT bits reflect the status of the buffers at all times e I_ SER AL_READ_ DAV Gets the current amount of data available for reading This shows how much data is in the hardware receive buffer not how formatte much data is in the buffer used by the d input routines such as iscanf iserialmclctrl Controls the modem control lines RTS and DTR If one of these lines is being used for flow control you cannot set t iserialmclstat Determines lines If one control this of that line RS 232 There are specific interface session hat line with this function the current state of the modem control of these lines is being used for flow function may not give the correct state interrupts that can be used See Interface i setintr in Chapter 10 for information on the interface session interrupts Session for RS 232 Interrupts Chapter 7 153 Using SICL with RS 232 Communica
146. e and a printer capable of printing in HP RASTER GRAPHICS STANDARD e g thinkjet This program will tell the scope to take a reading on channel 1 then send the data back to this program Then some simple statistics about the data is printed The program then tells the scope to send the data directly to the printer illustrating how the controller does not have to be directly involved in an HPIB transaction include lt stdio h gt used for printf include lt stdlib h gt used for exit include lt sicl h gt SICL header file defines define INTF ADDR hpib define SCOPE ADDR INTF ADDR 7 GI function prototypes void initialize void void get data void void massage data void void print data void void cleanup void void srq hdlr INST id global data float pre 10 INST scope INST intf Chapter 4 81 Using SICL with GPIB Communicating with GPIB Interfaces void main ionerror I_ ERROR EXIT scope iopen SCOPE ADDR intf iopen INTF ADDR initialize get _data massage data print data cleanup iclose scope iclose intf void initialize initialize the hpib interface and scope iclear intf itimeout scope 5000 itimeout intf 5000 iclear scope igpibllo intf void get _data short readings 5000 int count setup scope to accept waveform data iprintf
147. e attached to the machine named instserv in the hp com domain Fully qualified domain names may be used lan 128 10 0 3 hpib 3 2 A device address corresponding to the device at primary address 3 secondary address 2 on the hpib interface attached to the machine with IP address 128 10 0 3 lanf intserv GPIB An interface address corresponding to the GPIB interface attached to the machine named intserv 30 intserv hpib 3 2 A device address corresponding to the device at primary address 3 secondary address 2 on the hpib interface attached to the machine named intserv 30 is the default logical unit for LAN lanf intserv GPIB cmdr A commander session with the GPIB interface attached to the machine named intserv assumes that the server supports GPIB commander sessions Note Ifyou are using the IP address of the server machine rather than the hostname then you cannot use the comma notation but must use the bracket notation incorrect lan 128 10 0 3 hpib correct lan 128 10 0 3 hpib 170 Chapter 8 Using SICL with LAN Communicating with Devices over LAN The following table shows the relationship between the address passed to iopen the session type returned by igetsesstype the interface type returned by igetintftype and the value returned by igetgatewaytype Address Session Type Interface Type Gateway Type lan SESS_INTF INTF_LAN _INTF_NONE lan instserv hpib S
148. e however that the LAN server does not support simultaneous connections from LAN clients using the SICL LAN Protocol and from other LAN clients using the TCP IP Instrument Protocol 166 Chapter 8 Using SICL with LAN Overview of SICL LAN SICL LAN Server SICL includes the necessary software to allow a Series 700 workstation or Linux PC to act as a LAN to instrument_interface gateway The fileset SICL LANSVR provides a daemon siclland which will accept I O requests from a SICL LAN client and perform the I O operations on a local interface To use this capability the Series 700 or Linux PC must have a local interface configured for I O The supported interfaces for this release are GPIB VXI MXI and RS 232 for the SICL LAN protocol and GPIB GPIB and VXI interfaces for the TCP IP Instrument Protocol See the SICL Function Support with LAN gatewayed Sessions section later in this chapter for information on which functions are not supported over LAN Note that the timing of operations performed remotely over a network will be different from the timing of operations performed locally The extent of the timing difference will in part depend on the bandwidth of and the traffic on the network being used Contact your local TAMS representative for a current list of other supported SICL LAN servers Chapter 8 167 Using SICL with LAN Considering LAN Configuration and Performance Considering LAN Configuration and Performance
149. e interrupt handler must be installed Second the interrupt event or events need to be enabled The ionintr function installs an interrupt handler The isetintr function enables notification of the interrupt event or events An interrupt handler can be installed with no events enabled Conversely interrupt events can be enabled with no interrupt handler installed Only when both an interrupt handler is installed and interrupt events are enabled will the interrupt handler be called Temporarily Disabling Enabling Asynchronous Events To temporarily prevent all SRQ and interrupt handlers from executing use the iintroff function This disables all asynchronous handlers for all sessions in the process To re enable asynchronous SRQ and interrupt handlers previously disabled by iintroff use the iintron function This enables all asynchronous handlers for all sessions in the process that had been previously enabled These functions do not affect the isetintr values or the handlers ionsrq or ionintr in any way See ionintr and ionsrqin Chapter 10 Default is on Chapter 3 55 Note Note Using SICL Using Asynchronous Events It is possible to overflow SICL s interrupt queue if too many interrupts are generated while notification is disabled Calls to iintroff iintron may be nested meaning that there must be an equal number of on s and off s This means that calling the iintron function may not actually re enable
150. e buffer that iprintf uses Converts data via a format string and writes the arguments appropriately Reads data converts this data via a format string and assigns the values to your arguments Sends then receives data from a device instrument It also converts data via format strings that are identical to iprintf and iscanf The advantage of this function is that the iprintf and iscanf parts are done together Flushes the formatted I O read and write buffers A flush of the read buffer means that any data in the buffer is lost A flush of the write buffer means that any data in the buffer is written to the session s target address Sets the size of the formatted I O read and the write buffers A size of zero 0 means no buffering Note that if no buffering is used performance can be severely affected Sets the read or the write buffer to your allocated buffer The same buffer cannot be used for both reading and writing Also you should be careful in using buffers that are automatically allocated 51 Using SICL Sending I O Commands Non Formatted I O There are two non buffered non formatted I O functions called i read and iwrite These are raw I O functions and do not intermix with the formatted I O functions If raw I O must be mixed use the if read and ifwrite functions They have the same parameters as iread and iwrite but read or write raw data to or from the formatted I O buffers The non formatted I O func
151. e datalen argument is an unsigned long integer containing the length of the data block in bytes If the end argument is non zero this function will send the END indicator with the last byte of the data block Otherwise if end is set to zero no END indicator will be sent The actualcnt argument is a pointer to an unsigned long integer Upon exit it will contain the actual number of bytes written to the specified device A NULL pointer can be passed for this argument and it will be ignored This function is identical to the iwrite function except the data is not written directly to the device Instead the data is written to the formatted I O write buffer the same buffer used by iprintf The formatted I O buffer is then flushed to the device at normal times such as when the buffer is full or when iflush is called The advantage to this function over iwrite is that it can be intermixed with calls to iprintf while iwrite cannot This function returns zero 0 if successful or a non zero error number IPRINTF ISCANF IPROMPTF IFREAD ISETBUF ISETUBUP IFLUSH ITERMCHR IWRITE IREAD Chapter 10 225 C Syntax Description Return Value See Also SICL Language Reference IGETADDR IGETADDR Supported sessions 00005 device interface commander include lt sicl h gt int igetaddr id addr INST id char addr The igetaddr function return
152. e is addressed to talk Bit 1 0 then this device is not addressed to talk This interrupt is enabled using isetintr by specifying a secval greater than 0 If secval 0 this interrupt is disabled Interrupts on GPIO Device Session Interrupts GPIO does not support device sessions GPIO Therefore there are no device session interrupts for GPIO GPIO Interface Session Interrupts The interface specific interrupts for the GPIO interface are I_INTR_GPIO_EIR This interrupt occurs whenever the EIR line is asserted by the peripheral device Enabled when secval 0 disabled when secval 0 I_INTR_GPIO_RDY This interrupt occurs whenever the interface becomes ready for the next handshake The exact meaning of ready depends on the configured handshake mode Enabled when secval 0 disabled when secva 0 346 Chapter 10 Note Interrupts on RS 232 Serial SICL Language Reference ISETINTR The GPIO interface is always active Therefore the interrupts for I_INTR_INTFACT and I_INTR_INTFDEACT will never occur GPIO Commander Session Interrupts GPIO does not support commander sessions Therefore there are no commander session interrupts for GPIO RS 232 Device Session Interrupts The device specific interrupt for the RS 232 interface is I_INTR_SERIAL_DAV This interrupt occurs whenever the receive buffer in the driver goes from the empty to the non empty state RS 232 Interface Session Interrupts The in
153. e recommended way of communicating using SICL They provide the highest level of programming best overall performance and best portability To create a device session specify either the interface symbolic name or logical unit anda particular device s address in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The logical unit isan integer corresponding to the interface The device address generally consists of the symbolic name or logical unit and an integer that corresponds to the device s address It may also include a secondary address which is also an integer Secondary addressing is not supported on the VXI and RS 232 interfaces Chapter 3 39 Addressing Interface Sessions Using SICL Opening a Communications Session The following are valid device addresses 123 Device at bus address 23 connected to an interface card at logical unit 7 dG 23 pl Device at bus address 23 secondary address 1 connected to an interface card at logical unit 7 hpib 23 Device at bus address 23 and symbolic name hpib hpib2 23 1 Device at bus address 23 secondary address 1 connected to a second GPIB interface with symbolic name hpib2 vxi 128 Device at logical address 128 and symbolic name vxi The following is an example of opening a device session with the G
154. e server does not wait forever is via the t timeout parameter to the siclland daemon By default siclland will use a 2 minute timeout if a timeout value of infinity is received from the client 182 Chapter 8 Using SICL with LAN Using Timeouts with LAN Application Terminations and Timeouts If an application is killed either via Ctrl C or the kill command while in the middle of a SICL operation which is performed at the LAN server the server will continue to try the operation until the server s timeout is reached By default the LAN server associated with an application using a timeout of infinity which is killed may not discover that the client is no longer running for 2 minutes If you are using a server other than the supplied LAN server check that server s documentation for its default behavior If itimeout is used by the application to set a long timeout value or if both the LAN client and LAN server are configured to use infinity or a long timeout value then the server may appear hung If this situation is encountered the LAN client via the Client Timeout Delta value or the LAN server via the Server Timeout value may be configured to use a shorter timeout value If long timeouts must be used the server may be reset A server may be reset by logging into the server host and killing the running siclland daemon s Note that the latter procedure will affect all clients connected to the server See the LAN section in C
155. e type of session Chapter 10 211 C Syntax Note Description Return Value IABORT IABORT Supported Sessions 0 000005 device interface commander f finclude lt sicl h gt int iabort id inst id This function is only supported with C C Also this function has no effect over LAN for any of the LAN servers such as the HP Agilent E2050 LAN GPIB Gateway The iabort function will abort any SICL calls currently executing with the current session id regardless of what thread it is executing on However since session ids are only valid within a single process only SICL calls in progress in the current process will be affected The SICL call being aborted will return the error code I ERR ABORTED implying that it was aborted by another thread If no thread has any SICL calls pending on the given session id this function will perform no action For C programs this function returns zero 0 if successful or a non zero error number if an error occurs 212 Chapter 10 SICL Language Reference IBLOCKCOPY DE ______ IBLOCKCOPY Supported sessions 00005 device interface commander Affected by functions 00 0 0 0 eae ilock itimeout C Syntax include lt sicl h gt int ibblockcopy id src dest cnt INST id unsigned char src unsigned char dest unsigned long cnt int iwblockcopy id src dest cnt swap INST id unsigned char src unsigned char
156. e within the given memory space where the memory mapping starts The pagecnt argument indicates how many pages to free 362 Chapter 10 SICL Language Reference IUNMAP The map_space argument contains the following legal values I MAP A16 Map in VXI A16 address space I MAP A24 Map in VXI A24 address space I MAP A32 Map in VXI A32 address space I_MAP_VXIDEV Map in VXI device registers Device session only I_MAP_EXTEND Map in VXI A16 address space Device session only I_MAP SHARED Map in VXI A24 A32 memory that is physically located on this device sometimes called local shared memory Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IMAP Chapter 10 363 SICL Language Reference IUNMAPX IUNMAPX Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int iunmapx id handle mapspace pagestart pagecnt INST id unsigned long handle int mapspace unsigned int pagestart unsigned int pagecnt Note Not supported over LAN Description The iunmapx function unmaps a mapped memory space The id specifies a VXI interface or device session The addr argument contains the address value returned from the imap call The pagestart argument indicates the page within the given memory space where the memory mapping starts The pagecnt argument indicates how ma
157. ecified in the system configuration Other possible interface names are serial SERIAL etc 150 Chapter 7 Using SICL with RS 232 Communicating with RS 232 Interfaces The following example opens an interface session with the RS 232 interface INST intf intf iopen COM1 SICL Function Support with RS 232 Interface Sessions The following describes how some SICL functions are implemented for RS 232 interface sessions iwrite All I O functions non formatted and formatted work tread the same as for device sessions However it is recommended that all I O be performed with device sessions to make your programs easier to maintain ixtrig Provides a method of triggering using either the DTR or RTS modem control line This function clears the specified modem status line waits 10 milliseconds then sets it again Specifying TRIG_STD is the same as specifying TRIG SERIAL DTR itrigger Same as ixtrig I_ TRIG STD Pulses the DTR modem control line for 10 milliseconds iclear Sends a break aborts any pending writes discards any data in the receive buffer resets any flow control states such as XON XOFF and resets any error conditions To reset the interface without sending a break use the following function iserialctrl id I SERIAL RESET 1 Chapter 7 151 Using SICL with RS 232 Communicating with RS 232 Interfaces ilonsrq iserialctrl
158. ecifying a secval 0 If secval 0 then this is disabled A VME interrupt occurred from a non VXI device or a VXI device that is not a servant of this interface This interrupt is enabled using isetintr by specifying a secval 0 If secval 0 then this is disabled A write to the VXI signal register was performed by a device that is not a servant of this controller This interrupt condition is enabled using isetintr by specifying a secval 0 If secval 0 then this is disabled The value written into the signal register is returned in the secval parameter of the interrupt handler The VME SYSFAIL line has been asserted VME IRQ 1 has been asserted 349 SICL Language Reference ISETINTR I INTR VME IRQ2 I INTR VME IRQ3 I INTR VME IRO4 I INTR VME IRQS I INTR VME IRQ6 I INTR VME _IRQ7 ME IRQ2 has been asserted ME IRQ3 has been asserted ME IRQ5 has been asserted V V VME IRQ4 has been asserted V VME IRQ6 has been asserted V ME IRQ7 has been asserted The following are generic interrupts for the VXI interface I INTR_INTFACT I_INTR_INTFDEACT This interrupt occurs whenever the interface receives a BNO Begin Normal Operation message This interrupt occurs whenever the interface receives an ANO Abort Normal Operation or ENO End Normal Operation message VXI Commander Session Interrupts The commander specific interrupt for VXI is I_INTR_VXI_LLOCK A lock clear
159. ecomes the active controller Interrupt occurs whenever this controller passes control to another GPIB device For example the igpibpassct1 function has been called GPIB Commander Session Interrupts The following are commander specific interrupts for GPIB I_INTR_ GPIB PPOLLCONFIG I INTR GPIB RI I INTR GPIB G EMLOC Chapter 10 ET F E This interrupt occurs whenever there is a change to the PPOLL configuration This interrupt is enabled using isetintr by specifying a secval greater than 0 If secval 0 this interrupt is disabled This interrupt occurs whenever a remote or local message is received and addressed to listen This interrupt is enabled using isetintr by specifying a secval greater than 0 If secval 0 this interrupt is disabled This interrupt occurs whenever the GET message is received and addressed to listen This interrupt is enabled using isetintr by specifying a secval greater than 0 If secva 0 this interrupt is disabled 345 SICL Language Reference ISETINTR I_INTR_GPIB_TLAC This interrupt occurs whenever this device has been addressed to talk or untalk or the device has been addressed to listen or unlisten When the interrupt handler is called the secval value is set to a bit mask Bit 0 is for listen and bit 1 is for talk If Bit 0 1 then this device is addressed to listen Bit 0 0 then this device is not addressed to listen Bit 1 1 then this devic
160. ed by the controller implementation specific This function routes the trigger line in the in_which parameter to the trigger lines contained in the out_which parameter In other words when the line contained in in_which fires all of the lines contained in out_which are also fired For example the following command causes EXTO to fire whenever TTL3 fires ivxitrigroute id I TRIG TTL3 I TRIG EXTO Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IVXITRIGON IVXITRIGOFF IVXIGETTRIGROUTE IXTRIG 378 Chapter 10 SICL Language Reference IVXIWAITNORMOP D IVXIWAITNORMOP Supported sessions nonan nnen device interface commander Affected by functions nsss 0 0 00 cee eee eee itimeout C Syntax include lt sicl h gt int ivxiwaitnormop id INST id Description The ivxiwaitnormop function is used to suspend the process until the interface or device is active that is establishes normal operation See the iwaithd1lr function for other methods of waiting for an interface to become ready to operate Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IWAITHDLR IONINTR ISETINTR ICLEAR Chapter 10 379 C Syntax Description Note Return Value See Also SICL Language Reference IVXIWS
161. ed char val void iwpoke addr val unsigned short adadr unsigned short val void ilpoke addr val unsigned long addr unsigned long val Not supported over LAN The i poke functions will write to memory The i poke functions are generally used in conjunction with the SICL imap function to write to VXI address space The addr is a valid memory address The val is a valid data value The iwpoke and ilpoke functions perform byte swapping if necessary so that VXI memory accesses follow correct VXI byte ordering Also if a bus error occurs unexpected results may occur IPEEK IMAP 298 Chapter 10 C Syntax Note Description Note See Also SICL Language Reference IPOKEX8 IPOKEX16 IPOKEX32 IPOKEXS8 IPOKEX16 IPOKEX32 finclude lt sicl h gt int ipokexs id handle offset value INST id unsigned long handle unsigned long offset unsigned char value int ipokex16 id handle offset value INST id unsigned long handle unsigned long offset unsigned short value int ipokexs id handle offset value INST id unsigned long handle unsigned long offset unsigned long value Not supported over LAN The ipokex8 ipokex16 and ipokex32 functions write to memory The functions are generally used in conjunction with the SICL imapx function to write to VXI address space The handle is a valid memory address offset is a valid memory offset The val is a va
162. ed library that calls SICL you must explicitly link the SICL library routines even if your program does not call SICL functions If any part of your program performs instrument I O you must link the SICL library routines The following example shows the process of creating a shared library that calls SICL and using it with an end program on HP UX 11i cc Aa z c library c lsicl ld b o library sl library o cc Aa o y y c library sl lsicl on Linux use gcc c library c lsicl ld shared o library so library o gcc o y y c L llibrary lsicl Chapter 2 29 Getting Started with SICL Compiling and Linking a SICL Program Note Ifyou fail to link the SICL library routines you may get duplicate symbol errors when linking the end program or you may get undefined symbol errors memory fault coredump errors when you run the program 30 Chapter2 Getting Started with SICL Running an SICL Program Running an SICL Program Execute your SICL program by typing the program name at the command prompt For example idn When using an HP Agilent 54601A Four Channel Oscilloscope you should get something similar to the following Hewlett Packard 54601A 0 1 7 If you have problems running the idn example program first check to make sure the device address specified in your program is correct If the program still doesn t run check the I O configuration by running the icosetup utility See the I O Libraries Installation and Confi
163. ed to unlock an interface or device Locks are performed on a per session device interface or commander basis If a session within a given process locks a device or interface then that device or interface can only be accessed from that session Locks can be nested The device or interface only becomes unlocked when the same number of unlocks are done as the number of locks Doing an unlock without a lock returns the error I ERR_NOLOCK What does it mean to lock Locking an interface from an interface session restricts other device and interface sessions from accessing this interface Locking a device restricts other device sessions from accessing this device however other interface sessions may continue to access the interface for this device Locking a commander from a commander session restricts other commander sessions from accessing this commander It is possible for an interface session to access an interface which is serving a device locked from a device session This interface access usually allows the interface session to address or reset any device on the interface In such a case data may be lost from the device session that was underway In particular be aware that both the HP Agilent Visual Engineering Environment HP Agilent VEE and the TAMS BASIC applications use SICL interface sessions Hence I O operations from either of these applications can supersede any device session that has a lock on a particular
164. either an enabled SRQ or interrupt condition occurs and the related handler executes Once the handler completes its operation this function returns and processing continues If timeout is non zero then iwaithdlr terminates and generates an error if no handler executes before the given time expires If timeout is zero then iwaithdlr waits indefinitely for the handler to execute Specify timeout in milliseconds Not all computer systems can guarantee an accuracy of one millisecond on timeouts Some computer clock systems only provide a resolution of 1 50th or 1 60th of a second Other computers have a resolution of only 1 second Note that the time value is always rounded up to the next unit of resolution The iwaithdir function will implicitly enable interrupts In other words if you have called iintroff iwaithd1r will re enable interrupts then disable them again before returning Chapter 10 381 Note Return Value See Also SICL Language Reference IWAITHDLR Interrupts should be disabled if you are using iwaithdlr Use iintroff to disable interrupts The reason for disabling interrupts is because there is a race condition between the isetintr and iwaithdlLr and if you only expect one interrupt it might come before the iwaithdlr executes The interrupts will still be disabled after the iwaithd1r function has completed For example lintroff ionintr hpib act_isr isetintr hpib I_INTR_INTFACT 1
165. eive buffer in the driver goes from the empty to the non empty state This interrupt occurs whenever the transmit buffer in the driver goes from the non empty to the empty state The following are generic interrupts for the RS 232 interface I_INTR_INTFACT This interrupt occurs when the Data Carrier Detect DCD line is asserted I_INTR_INTFDEACT This interrupt occurs when the Data Carrier Detect DCD line is cleared RS 232 Commander Session Interrupts RS 232 does not support commander sessions Therefore there are no commander session interrupts for RS 232 348 Chapter 10 SICL Language Reference ISETINTR Interrupts on VXI Device Session Interrupts The device specific interrupt for the VXI VXI interface is I_INTR_VXI_SIGNAL A specified device wrote to the VXI signal register or a VME interrupt arrived from a VXI device that is in the servant list and the signal was an event you defined This interrupt is enabled using isetintr by specifying a secval 0 If secval 0 then this is disabled The value written into the signal register is returned in the secval parameter of the interrupt handler VXI Interface Session Interrupts The following are interface specific interrupts for the VXI interface I INTR VXI SYSRESET I INTR VXI VME I INTR VXI UKNSIG I_INTR VXI_VMESYSFAIL I INTR VME IRQ1 Chapter 10 A VXI SYSRESET occurred This interrupt is enabled using isetintr by sp
166. el SCPI commands The hpib interface is used with a Command Module A Command Module may also be accessed over a LAN using a LAN to GPIB gateway such as the HP Agilent E2050 LAN to GPIB Gateway Programming with register based and message based devices is discussed in further detail later in this section You can program a VXIbus system that is mixed with both message based and register based devices To do this open a communications session for each device in your system and program as shown in the following sections Message Based Devices Message based devices have their own processors which allow them to interpret the high level SCPI commands While using SICL you simply place the SCPI command within your SICL output function call and the message based device interprets the SCPI command SICL functions used for programming message based devices include iread iwrite iprintf iscanf etc Chapter 6 105 Note Addressing VXI MXI Message Based Devices Note Using SICL with VXI MXI Communicating with VXI MXI Devices If your message based device has shared memory you can access the device s shared memory by doing register peeks and pokes See Register Based Devices later in this chapter for information on register programming To create a device session specify either the interface symbolic name or logical unit and a particular device s address in the addr parameter of the iopen function The interface symb
167. ent is an unsigned integer e E g G Corresponding argument is a double n Corresponding argument is a pointer to an integer f Corresponding argument is a pointer to a FILE descriptor opened for reading The following example sends an arbitrary block of data to the session specified by the id parameter The asterisk is used to indicate that the number is taken from the next argument long int size 1024 char data 1024 iprintf id b size data Sends 1024 characters of block data Chapter 3 47 Using SICL Sending I O Commands iscanf and ipromptf Conversion Characters Conversion Description Character d i n Corresponding argument must be a pointer to an integer e f g Corresponding argument must be a pointer to a float c Corresponding argument is a pointer to a character sequence s S t Corresponding argument is a pointer to a string O U X Corresponding argument must be a pointer to an unsigned integer Corresponding argument must be a character pointer F Corresponding argument is a pointer to a FILE descriptor opened for writing The following example reads characters up to the first white space character from the session specified by the id parameter and puts the characters into data char data 180 iscanf id Ss data 48 Chapter3 Using SICL Sending I O Commands Formatted I O The following ANSI C example shows how to use the formatted I O Example f
168. eration against SICL LAN gateways returns T_ ERR _NOERROR Performs no operation returns T_ ERR _NOERROR Performs no operation returns I ERR _NOERROR This function returns information about local interfaces only It does not return information about remote interfaces that are being accessed via a LAN to instrument_interface gateway 177 Using SICL with LAN Using Timeouts with LAN Using Timeouts with LAN The client server architecture of the LAN software requires the use of two timeout values one for the client and one for the server The server s timeout value is the SICL timeout value specified with the it imeout function The client s timeout value is the LAN timeout value which may be specified with the i lantimeout function When the client sends an I O request to the server the timeout value specified with it imeout or the SICL default is passed with the request The server will use that timeout in performing the I O operation just as if that timeout value had been used on a local I O operation If the server s operation is not completed in the specified time then the server will send a reply to the client which indicates that a timeout occurred and the SICL call made by the application will return I ERR TIMEOUT When the client sends an I O request to the server it starts a timer and waits for the reply from the server If the server does
169. es on a single interface SICL allows you direct access to a device on an interface without worrying about the type of interface to which it is connected To do this you communicate with a device session SICL also allows you to do interface specific actions such as setting up device addresses or setting other interface specific characteristics To do this you communicate with an interface session With RS 232 only one device is connected to the interface Therefore it may seem like extra work to have device sessions and interface sessions However structuring your code so that interface specific actions are isolated from actions on the device itself makes your programs easier to maintain This is especially important if at some point you will want to use a program with a similar instrument on a different interface such as GPIB Using SICL to communicate with an instrument on RS 232 is similar to using SICL over GPIB You must first determine what type of communications session you will need An RS 232 communications session can be either a device session or an interface session Commander sessions are not supported on RS 232 An RS 232 device session should be used when sending commands and receiving data from an instrument Setting interface characteristics such as the baud rate must be done with an interface session Chapter 7 145 Note Using SICL with RS 232 Communicating with RS 232 Devices Communicating with RS 232 Devices
170. etacantetecuatadscudothavealsbocesigdocedatunsasesageuteats 381 AAA H E D E A A E AE 383 TX PRIO i AREE ESR E R AEEA AR AA TE 384 SICLCLEANUP ien Rid ea r A AEN E A ENAS 387 The SICL Files Updating HP UX 9 SICL Applications Building SICL Applications on HP UX 11i 399 Contents 13 Linking with the Archive Library Ori HP UX 9 aei eoe Se eus E eee vee eden 400 C The SICL Utilities elea aire eye ir ee tere et fe BERR RR lr PR ee 403 AP GOK S355 Sse seal E E E E AAT 405 POKES cee stat ces cal Let otek ate cccetny can eds os Ve ceaeeteaa Netee eer atin eee oe 406 WEA a EERIE EAE AE EE Bas Ss es eR ia 407 a I AN ANELLI AE SE POE E A EN EE TE EE eel AEAT 408 D Customizing your VXI MXI System Overview of VXI MXI Configuration cccccccesceseeesseseesteeseeeeeeeees 411 The VXI MXI Resource Manager ivxirm cesceeseceteeeeeeeeseenteens 412 The VXI MXI Configuration Files c ccccesscssecseceeeeeeeeeseeesseeteeeeeees 413 The vximanuf cf Configuration File ccccecccesseesseessceseceteeeeensees 414 The vximodel cf Configuration File cccccccssesseestecseceseeeteeesees 414 The dynamic cf Configuration File c cccccscecssesceeseceeeeeeeeeteeenees 414 The vmedev cf Configuration File cccccssesseeteceseeeeeeeesteessees 415 The irg cf Configuration File cccccccescceseescesecsecseceeeeeseeseeesees 415 The cmdrsrvt cf Configuration File cccccccsceessesceestecseeeeeeeeeeesees 416
171. ever Most real applications would have termination conditions that cause the loop to exit iclose intf Chapter 5 97 Using SICL with GPIO Summary of GPIO Specific Functions Summary of GPIO Specific Functions Using these GPIO interface specific functions means that the program can not be used on other interfaces and therefore becomes less portable Function Name Action igpioctrl Sets the following characteristics of the GPIO interface Request Characteristic Settings I GPIO AUTO _HDSK Auto Handshake mode lor0 I GPIO_AUX Auxiliary Control lines 16 bit mask I GPIO_CHK_PSTS Check PSTS before read write 1 or 0 I GPIO_CTRL Control lines I_GPIO_CTRL_CTLO I GPIO CTRL_CTL1 I GPIO_DATA Data Output lines 8 bit or 16 bit mask 1 GPIO_PCTL_DELAY 1 GPIO_POLARITY 1 GPIO READ CLK 1 GPIO_READ EOI 1 GPIO_SET_PCTL PCTL delay time Logical polarity Data input latching END termination pattern Start PCTL handshake 0 7 0 31 See Chapter 10 I_GPIO_EOL NONE or 8 bit or 16 bit mask 1 igpiogetwidth igpiosetwidth 98 Returns the current width in bits of the GPIO data ports Sets the width in bits of the GPIO data ports Either 8 or 16 Chapter5 Function Name igpiostat Chapter 5 Action Using SICL with GPIO Summary of GPIO Specific Functions Gets the following information about the GPIO interface Request Characteristic Value I GPIO_CTRL Control Lines I_GPI
172. example addresses for GPIO interface sessions gpio An interface symbolic name 12 An interface logical unit The above examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name orlogical unit specified during the configuration The name used in your SICL program must match the logical unit orsymbolic name specified in the system configuration Other possible interface names are parallel GPIO etc The following example opens an interface session with the GPIO interface INST intf intf iopen gpio 92 Chapter5 Using SICL with GPIO Communicating with GPIO Interfaces SICL Function Support with GPIO Interface Sessions The following describes how some SICL functions are implemented for GPIO interface sessions iwrite iread iprintf iscanf itermchr ixtrig itrigger iclear Chapter 5 The size parameters for non formatted I O functions are always byte counts regardless of the current data width of the interface All formatted I O functions work with GPIO When formatted I O is used with 16 bit data widths the formatting buffers re assemble the data as a stream of bytes On the Series 700 these bytes are ordered high low high low Because of this unpacking operation 16 bit data widths may not be appropriate for formatted I O operations For iscanf termination an END value m
173. f data is present it will be discarded Flushes the write buffer of formatted I O operations and sets the END indicator on the last byte for example sets EOI on GPIB Discards the read buffer does not perform T O to the device Discards the write buffer does not perform T O to the device EAD and I BUF WRITE flags may be used together by OR ing them together and the 1 BUF_DISCARD_READ and I BUF DISCARD WRIT are invalid Chapter 10 E flags may be used together Other combinations 221 SICL Language Reference IFLUSH If iclear is called to perform either a device or interface clear then both the read and the write buffers are discarded Performing an iclear is equivalent to performing the following iflush call in addition to the device or interface clear function iflush id I BUF DISCARD READ I BUF DISCARD WRITE ae Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IPRINTF ISCANF IPROMPTF IFWRITE IFREAD ISETBUF ISETUBUF ICLEAR 222 Chapter 10 SICL Language Reference IFREAD m Supported sessions n onanan device interface commander Affected by functions 0 000000 ea ee ilock itimeout C Syntax include lt sicl h gt int ifread id buf bufsize reason actualcnt INST id char buf unsigned long buf
174. f no flow control is being used result will be set to zero 0 The following are the supported types of flow control I_SERIAL_ FLOW NONE No handshaking I_SERIAL_FLOW_XON Software handshake I_ SERIAL FLOW RTS CTS Hardware handshake I SERIAL FLOW DTR_DSR Hardware handshake Chapter 10 SICL Language Reference ISERIALSTAT I SERIAL READ EOI The result parameter will be set to the value of the current type of END indicator that is being used for reads The following values can be returned I SERIAL EOI CHR n A character is used to indicate EOI where n is the character These two values are logically OR ed together To find the value of the character AND result with Oxff The default is a n I SERIAL EOI _NONE No EOI indicator This is the default for I SERIAL READ iscanf I SERIAL EOI BITS Use the eighth bit of the data to indicate EOI This last byte will mask off this bit and use the rest for the data that is put in your buffer I SERIAL WRITE EOI The result parameter will be set to the value of the current type of END indicator that is being used for reads The following values can be returned I SERIAL EOI _NONE No EOI indicator This is the default for I SERIAL WRITE iprintf I SERIAL EOI BITS Use the eighth bit of the data to indicate EOI This last byte will mask off this
175. f the i peek and i poke functions Unmapping Memory Space Make sure you use the iunmap function to unmap the memory space when it is no longer needed This frees the mapping hardware so it can be used by other processes The following example program opens a communication session with the register based device connected to the address entered by the user The program then reads the Id and Device Type registers The register contents are then printed 114 Chapter 6 Using SICL with VXI MXI Communicating with VXI MXI Devices Note The HP UX Series 700 C compiler dereferences pointers that are cast to another data type by making multiple accesses of the base data type Therefore if you cast a character pointer to a short pointer it will dereference it as two D08 accesses To correct this problem always use the size pointer that you would like the access to be If you want D16 accesses use a short pointer If you want D32 accesses use a long pointer For example unsigned short a24 ptr a24 ptr unsigned short imap id I MAP A24 ps cnt 0 val iwpeek a24 ptr offset Chapter 6 115 Using SICL with VXI MXI Communicating with VXI MXI Devices vxiregdev c The following example prompts the user for an instrument address and then reads the id register device type register The contents of the register are then displayed include lt stdio h gt include lt stdlib h gt include lt sicl h gt void
176. f you must restart the portmapper you must then reconfigure inetd by running the following as root On HP UX 111 usr sbin inetd c On Linux kill HUP cat var run inetd pid rpcinfo fails rpcinfo t server_hostname 395180 1 OR rpcinfo t programS server_hostname 395183 1 returns the following message 395180 or 395183 are not rpcinfo RPC_SYSTEM_ERROR Connection refused available program 395180 version 1 is not available Possible Solution Ensure that inetd is running on the server See inetd 1m for details on starting inetd Chapter 9 201 Troubleshooting Your SICL Program Troubleshooting SICL over RS 232 Troubleshooting SICL over RS 232 Unlike GPIB special care must be taken to ensure that RS 232 devices are correctly connected to your computer Verifying your configuration first can save many wasted hours of debugging time Use of a RS 232 protocol analyzer may be of assistance No Response from Instrument Check to make sure that the RS 232 interface is configured to match the instrument Check the Baud Rate Parity Data Bits and Stop Bits Also make sure that you are using the correct cabling Refer to the O Libraries Installation and Configuration Guide as well as to the RS 232 Cables insert included in your I O Libraries product package for more information on correct cabling If you are sending many commands at once try sending them one at a time either by inserting delays
177. followed by the device s address in the addr parameter For more information on addressing devices see Chapter 3 Using SICL C example INST dmm dmm iopen hpib 15 To create an interface session specify a particular interface in the addr parameter For more information on addressing interfaces see Chapter 3 Using SICL C example INST hpib hpib iopen hpib To create a commander session use the keyword cmdr in the addr parameter For more information on commander sessions see Chapter 3 Using SICL C example INST cmdr cmdr iopen hpib cmdr The iopen function returns a zero 0 id value if an error occurs otherwise a valid session id is returned ICLOSE Chapter 10 295 SICL Language Reference IPEEK IPEEK Note Not recommended for new program development Use IPEEKX8 IPEEK X16 IPEEK X32 instead C Syntax include lt sicl h gt unsigned char ibpeek addr unsigned char addr unsigned short iwpeek addr unsigned short addr unsigned long ilpeek addr unsigned long addr Note Not supported over LAN Description The i peek functions will read the value stored at addr from memory and return the result The i peek functions are generally used in conjunction with the SICL imap function to read data from VXI address space Note The iwpeek and ilpeek functions perform byte swapping if necessary so that VXI memory accesses follow correct VXI b
178. for more information on these functions The formatted I O functions are buffered There are two non buffered and non formatted I O functions called iread and iwrite See the Non formatted I O section later in this chapter These are raw I O functions and do not intermix with the formatted I O functions If raw I O must be mixed use the i fread ifwrite functions They have the same parameters as iread and iwrite but read or write raw data to or from the formatted I O buffers Refer to the Formatted I O Buffers section later in this chapter for more details The formatted I O functions convert data under the control of the format string The format string specifies how each argument is converted before it is input or output The typical format string syntax is as follows format flags field width precision array size argument modifier conversion character See iprintf ipromptf and iscanf in Chapter 10 for more information on how data is converted under the control of the format string Format Flags Zero or more flags may be used to modify the meaning of the conversion character The format flags are only used when sending formatted I O iprintf and ipromptf The following are supported format flags Chapter 3 43 Using SICL Sending I O Commands Format Flags for iprintf and ipromptf Flag Description 1 Converts to a IEEE 488 2 NR1 number 2 Converts to a IEEE 488 2 NR2 number 3 Converts
179. g SICL for a description of how to use SICL HP C Programmers Guide to review usage of pointers and pointer types For Run time Errors see the following e Chapter 3 Using SICL for a description of SICL features The interface specific chapter for a description of valid addressing I O Libraries Installation and Configuration Guide for a description of the I O Libraries configuration process HP C Programmers Guide to review usage of pointers and pointer types For LAN problems see the following e Chapter 8 Using SICL with LAN for a description of LAN addressing and timeouts e Your network administrator The Jnstalling and Administering LAN 9000 Software manual for HP UX 208 Chapter 9 10 SICL Language Reference SICL Language Reference This chapter defines all of the supported SICL functions The functions are listed in alphabetical order to make them easier for you to look up and reference In this chapter the entry for each SICL function includes e C syntax e Complete description Return value s Related SICL functions that you may want to see also 210 Chapter 10 Session Identifiers Device Interface and Commander Sessions Functions Affected by Locks Functions Affected by Timeouts Per Process Functions SICL uses session identifiers to refer to specific SICL sessions The iopen function will create a SICL session and return a session identifie
180. gett1 delay igpibllo igpibpassctl igpibppoll igpibppollconfig igpibppollresp igpibrenctl igpibsendcmd igpibsett1 delay 88 Action Sets or clears the ATN line Change bus address Return requested bus data Retrieves the T1 delay setting on the GPIB interface Sets bus in Local Lockout Mode Passes active control to specified address Performs a parallel poll on the bus Configures device for PPOLL response Sets PPOLL state Sets or clears the REN line Sends data with ATN line set Sets the T1 delay on the GPIB interface Chapter 4 Using SICL with GPIO Note Using SICL with GPIO GPIO is a parallel interface that is flexible and allows a variety of custom connections Although GPIO typically requires more time to configure than GPIB its speed and versatility make it the perfect choice for many tasks This chapter explains how to use SICL to communicate over GPIO In order to communicate over GPIO you must have loaded the GPIO fileset during the I O Libraries installation See the O Libraries Installation and Configuration Guide for information Also note that the GPIO related SICL functions have the string GPIO embedded in their names This chapter describes in detail how to open a communications session and communicate with an instrument over a GPIO connection The example programs shown in this chapter are also provided in the opt sicl share examples directory GPIO is not supported with SICL over L
181. guration Guide for information on running iosetup Chapter 2 31 Getting Started with SICL Getting Online Help Getting Online Help Online help is offered in the form of Unix manual pages man pages You can get help on the following SICL functions e SICL function calls e SICL utilities Using Manual Pages To use manual pages type the Unix man command followed by the SICL function call or utility man name The following are examples of getting online help on SICL function calls and utilities Examples of SICL function calls man iprintf man ipromptf man iread Examples of SICL utilities man ipeek man iread man ivxisc 32 Chapter2 Getting Started with SICL Where to Go Next Where to Go Next Once you have your SICL example program running you can continue with Chapter 3 Using SICL Additionally you should look at the chapters that describe how to use SICL with your particular I O interface e Chapter 4 Using SICL with GPIB e Chapter 5 Using SICL with GPIO e Chapter 6 Using SICL with VXI MXI e Chapter 7 Using SICL with RS 232 e Chapter 8 Using SICL with LAN If you have any problems see Chapter 9 Troubleshooting Your SICL Program Chapter 2 33 Getting Started with SICL Where to Go Next 34 Chapter2 Using SICL Using SICL This chapter first describes how to use SICL and some of the basic features such as error handling and locking Detailed examp
182. hapter 10 SICL Language Reference IGPIOCTRL Description The igpioctr1 function is used to control various lines and modes of the GPIO interface This function takes request and sets the interface to the specified setting The request parameter can be one of the following I GPIO AUTO HDSK I GPIO AUX I GPIO CHK PSTS Chapter 10 If the setting parameter is non zero then the interface uses auto handshake mode the default This gives the best performance for iread and iwrite operations If the setting parameter is zero 0 then auto handshake mode is canceled This is required for programs that implement their own handshake using I GPIO SET PCTL The setting parameter is a mask containing the state of all auxiliary control lines A 1 bit asserts the corresponding line a 0 zero bit clears the corresponding line When configured in Enhanced Mode the HP Agilent E2074 5 interface has 16 auxiliary control lines In HP 98622 Compatibility Mode it has none Attempting to use I_GPIO_AUX in HP 98622 Compatibility Mode results in the error Operation not supported If the setting parameter is non zero then the PSTS line is checked before each block of data is transferred If the setting parameter is zero 0 then the PSTS line is ignored during data transfers If the PSTS line is checked and false SICL reports the error Device not active or available 259 SICL Language Reference IGPIOCTRL I_GPIO CTRL The setti
183. hapter 9 Troubleshooting Your SICL Program for more details Also see the documentation of the server you are using for the method to be used to reset the server Chapter 8 183 Using SICL with LAN Using Signal Handling with LAN Using Signal Handling with LAN SIGIO Signals SICL uses SIGIO for SRQs and interrupts on LAN interfaces The SICL LAN client installs a signal handler to catch SIGIO signals To enable sharing of SIGIO signals with other portions of an application the SICL LAN SIGIO signal handler remembers the address of any previously installed SIGIO handler and calls this handler after processing a SIGIO signal itself If your application installs a SIGIO handler it should also remember the address of a previously installed handler and call it before completing The signal number used with LAN SIGIO can not be changed Note that isetsig has no effect on LAN However if you must share SIGIO or any signal set with isetsig between SICL and another portion of your application your application must adhere to the following guidelines These guidelines allow for multiple signal handlers to be called when a signal is received Store the address of the previously installed signal handler when installing your signal handler Call this stored handler address when a signal is received e Note that both SIG_DFL and SIG_IGN may be returned as previous handlers and an application may need to deal with these as necessar
184. hared libraries Appendix A 391 The SICL Files SICL HPIB Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL HPIB opt sicl defaults opt sicl lib opt sicl defaults Files for customization The default versions of the GPIB configuration files The GPIB driver binary modules which are linked and inserted in the kernel by the SICL configuration programs Also adds the driver shared libraries SICL GPIO Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL GPIO opt sicl defaults opt sicl lib opt sicl defaults Files for customization The default versions of the GPIO configuration files The GPIO driver binary modules which are linked and inserted in the kernel by the configuration program Also adds the driver shared libraries 392 AppendixA The SICL Files SICL RS232 Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL RS232 opt sicl defaults opt sicl lib Files for customization The default versions of the RS 232 configuration files opt sicl defaults The RS 232 driver binary modules which are linked and inserted in the kernel by the SICL configuration programs Also adds the driver shared libraries SICL LAN Filesets HP UX 11i D
185. he addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The following are example addresses for VXI MXI interface sessions vxi An interface symbolic name iscpi An interface symbolic name The above examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name or logical unit specified during the configuration The name used in your SICL program must match the Logical unit orsymbolic name specified in the system configuration Other possible interface names are VXI MXI mxi etc 118 Chapter 6 Using SICL with VXI MXI Communicating with VXI MXI Interfaces The following example opens a interface session with the VXI interface INST vxi vxi iopen vxi Chapter 6 119 Using SICL with VXI MXI Communicating with VXI MXI Interfaces VXI MXI Interface Session Example The following example program opens a communication session with the VXI interface and uses the SICL interface specific ivxirminfo function to get information about a specific VXI device This information comes from the VXI resource manager and is only valid as of the last time the VXI resource manager was run vxiintr c The following example gets information about a specific v
186. he controller The field width is the number of long words If the z argument modifier is specified then the array is assumed to be an array of floats The data read from the device is an array of 32 bit IEEE 754 floating point numbers The field width is the number of floats If the zZ argument modifier is specified then the array is assumed to be an array of doubles The data read from the device is an array of 64 bit IEEE 754 floating point numbers The field width is the number of doubles Chapter 10 Chapter 10 SICL Language Reference ISCANF Corresponding arg must be a pointer to an unsigned integer for C C The library reads characters until the entire octal number is read If the 1 ell argument modifier is used the argument must be a pointer to an unsigned long integer for C C If the h argument modifier is used the argument must be a pointer to an unsigned short integer for C C Corresponding arg must be a pointer to an unsigned integer for C C The library reads characters until an entire number is read It will accept any valid decimal number If the 1 ell argument modifier is used the argument must be a pointer to an unsigned long integer for C C If the h argument modifier is used the argument must be a pointer to an unsigned short integer for C C Corresponding arg must be a pointer to an unsigned integer for C C The library reads characters until an entire number is read It will accept any va
187. hen the controller PPOLL s us For C programs this function returns zero 0 if successful or a non zero error number if an error occurs IGPIBPPOLL IGPIBPPOLLCONFIG 254 Chapter 10 SICL Language Reference IGPIBRENCTL ay IGPIBRENCTL Supported sessions 0 cece cee teen ees interface Affected by functions 00 0 0 0 00 ee ilock itimeout C Syntax include lt sicl h gt int igpibrenctl id ren INST id int ren Description The igpibrenct1 function controls the state of the REN Remote Enable line If ren is non zero then REN is set If ren is 0 then REN is cleared Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIBATNCTL Chapter 10 255 C Syntax Description Return Value See Also SICL Language Reference IGPIBSENDCMD IGPIBSENDCMD Supported sessions 0 cece cece cece nents interface Affected by functions 0 00000 ilock itimeout include lt sicl h gt int igpibsendcmd id buf length INST id char buf int length The igpibsendcmd function sets the ATN line and then sends bytes to the GPIB interface This function sends length number of bytes from buf to the GPIB interface Note that the igpibsendcmd function leaves the ATN line set If the interface is not active controller this function will return an error Fo
188. hpib cmdr 86 Chapter 4 Using SICL with GPIB Communicating with GPIB Commanders SICL Function Support with GPIB Commander Sessions The following describes how some SICL functions are implemented for GPIB commander sessions iwrite iread isetstb If the interface has been addressed to talk the data is written directly to the interface If the interface has not been addressed to talk it will wait to be addressed to talk before writing the data If the interface has been addressed to listen the data is read directly from the interface If the interface has not been addressed to listen it will wait to be addressed to listen before reading the data Sets the status value that will be returned ona ireadstb call i e when this device is Serial Polled Bit 6 of the status byte has a special meaning If bit 6 is set the SRQ line will be set If bit 6 is clear the SRQ line will be cleared GPIB There are specific commander session interrupts that can be used See Commander j setintr in Chapter 10 for information on the commander session Session interrupts Interrupts Chapter 4 87 Using SICL with GPIB Summary of GPIB Specific Functions Summary of GPIB Specific Functions Using these GPIB interface specific functions means that the program can not be used on other interfaces and therefore becomes less portable SICL GPIB Functions Function Name igpibatnctl igpibbusaddr igpibbusstatus igpib
189. ice Sessions The following describes how some SICL functions are implemented for GPIB device sessions iwrite Causes all devices to untalk and unlisten It then sends this controller s talk address followed by unlisten and then the listen address of the corresponding device session Then it sends the data over the bus iread Causes all devices to untalk and unlisten It sends an unlisten then sends this controller s listen address followed by the talk address of the corresponding device session Then it reads the data from the bus ireadstb Performs a GPIB serial poll SPOLL itrigger Performs an addressed GPIB group execute trigger GET iclear Performs a GPIB device clear DCL on the device corresponding to this session There are no device specific interrupts for the GPIB interface GPIB device sessions support Service Requests SRQ On the GPIB interface when one device issues an SRQ the library will inform a GPIB device sessions that have SRQ handlers installed See ionsrq in Chapter 10 This is an artifact of how GPIB handles the SRQ line The interface cannot distinguish which device requested service Therefore the library acts as if all devices require service Your SRQ handler can retrieve the device s status byte by using the ireadstb function It is good practice to ensure that a device isn t requesting service before leaving the SRQ handler The easiest technique for this is to service all devices from
190. ich will print a diagnostic message and then allow the process to continue execution See Using Error Handlers in Chapter 3 of this manual for more information on installing a SICL error handler and writing your own error routine You can also see Chapter 10 for details about the ionerror function call Chapter 9 189 Troubleshooting Your SICL Program Looking at Error Codes and Messages Looking at Error Codes and Messages When you install a default SICL error routine such as I _ T with an ionerror call the SICL error message is _ERROR_NOEX printed ERROR EX T or You may also use ionerror to install your own custom error handler Your error handler can call igeterrstr with the given error code and the corresponding error message string will be returned The following table contains an alphabetical summary of SICL error messages Error Codes and Messages Error Code D A A HR J R ABORTED R BADADDR R BADCONFIG R BADFMT R BADID R_BADMAP R_ BUSY R_ DATA R_ INTERNAL R_ INTERRUPT R_INVLADDR R_IO R_ LOCKED R_NOCMDR R NOCONN R_NODEV Error String Externally aborted Bad address nvalid configuration nvalid format nvalid INST nvalid map request nterface is in use by non SICL process Data integrity violation nternal error occurred Process interrupt occurred nvalid address Generic I O err
191. if an error occurs See Also IREAD IWRITE IFREAD IFWRITE IPRINTF ISCANF 270 Chapter 10 C Syntax Description Note Return Value See Also SICL Language Reference IINTROFF IINTROFF finclude lt sicl h gt int iintroff The iintroff function disables SICL s asynchronous events for a process This means that all installed handlers for any sessions in a process will be held off until the process enables them with iintron By default asynchronous events are enabled However the library will not generate any events until the appropriate handlers are installed To install handlers refer to the ionsrq and ionintr functions The iintroff iintron functions do not affect the isetintr values or the handlers in any way Default is on This function returns zero 0 if successful or a non zero error number if an error occurs IONINTR IGETONINTR IONSRQ IGETONSRQ TWAITHDLR IINTRON Chapter 10 271 C Syntax Description Note Return Value See Also SICL Language Reference IINTRON IINTRON finclude lt sicl h gt int iintron The iintron function enables all asynchronous handlers for all sessions in the process The iintroff iintron functions do not affect the isetintr values or the handlers in any way Default is on Calls to iintroff iintron can be nested meaning that there must be an equal number of
192. igpibpassctl hpib ba iwaithdlr 0 lintron In a multi threaded application iwaithd1r will enable interrupts for the whole process If two threads call iintroff and one of them then calls iwaithdLr interrupts will be enabled and both threads can receive interrupt events Note that this is not a defect since your application must handle the enabling disabling of interrupts and keep track of when all threads are ready to receive interrupts This function returns zero 0 if successful or a non zero error number if an error occurs IONINTR IGETONINTR IONSRQ IGETONSRQ TIINTROFF INTRON 382 Chapter 10 C Syntax Description Return Value See Also SICL Language Reference IWRITE Supported sessions 00005 device interface commander Affected by functions 0 000005 ilock itimeout include lt sicl h gt int iwrite id buf datalen endi actualcnt INST id char buf unsigned long datalen int endi unsigned long actualcnt The iwrite function is used to send a block of data to an interface or device This function writes the data specified in buf to the session specified in id The buf argument is a pointer to the data to send to the specified interface or device The datalen argument is an unsigned long integer containing the length of the data block in bytes If the endi argument is non zero this function will send the END indicat
193. ill print a list of registered programs on the server gt rpcinfo p instserv program verses proto port 100001 iL udp 1788 rstatd 100001 2 udp 1788 rstatd 100001 3B udp 1788 rstatd 100002 1 udp 1789 rusersd 100002 2 udp 1789 rusersd 395180 1 tcp 1138 395183 1 tcp 1038 Several lines of text will likely be returned but the ones of interest are the lines for programs 395180 which is the SICL LAN Protocol and 395183 which is the TCP IP Instrument Protocol The port number will vary This is the siclland daemon line you may or may not see the word siclland at the end of this line If the line for program 395180 or 395183 is not present then your LAN server is likely misconfigured Consult your server s documentation correct the configuration problem and then retry your application The second rpcinfo option which can be tried is t which will attempt to execute procedure 0 of the specified program For the SICL LAN Protocol gt rpcinfo t instserv 395180 program 395180 version 1 ready and waiting For the TCP IP Instrument Protocol gt rpcinfo t instserv 395183 program 395183 version 1 ready and waiting If you do not see one of the above your server is likely misconfigured or not running Consult your server s documentation correct the problem and then retry your application See the rpcinfo 1M man page for more information 196 Chapter 9 iopen fails syntax errorr iopen fails Bad address iope
194. ill print the contents of the specified memory location in hexadecimal The sym_name is the SICL symbolic name of the interface The interface must support mapping such as VXI The map_space is the map area that you would like to examine Currently the only interfaces supported are VXI and MXI The valid map spaces are A16 A24 A32 VXIDEV and EXTEND See the imap function in Chapter 10 for a description of these mappings The offset is the offset in bytes from the beginning of the mapped space to the location that is to be examined The parameter definitions follow y Turns on verbose mode p Prints the usage of the ipeek program b Specifies that the register size is a byte 8 bits Ww Specifies that the register size is a word 16 bits default 1 Specifies that the register size is a long 32 bits ipeek vxi A16 0xC000 1 Appendix C 405 ipoke Syntax Description Example The SICL Utilities ipoke b ipoke v _ sym_name map_space offset value l ipoke is the SICL utility for writing to memory locations on interfaces that support mapping The ipoke utility will write the contents of the value parameter to the specified memory location The sym_name is the SICL symbolic name ofthe interface The interface must support mapping such as VXI The map space is the map area that you would like to write to Currently the only interfaces supported are VXI and MXI The valid map spaces are A16 A2
195. imal number in the form Hxxxx Valid only for sd and sf Note that sf values will be truncated to the integer value Chapter 10 eQ B space SICL Language Reference IPRINTF Convert to an IEEE 488 2 format octal number in the form Qxxxx Valid only for d and 3f Note that sf values will be truncated to the integer value Convert to an IEEE 488 2 format binary number in the form Bxxxx Valid only for d and 3f Note that f values will be truncated to the integer value Left justify the result Prefix the result with a sign or if the output is a signed type Prefix the result with a blank if the output is signed and positive Ignored if both blank and are specified Use alternate form For the o conversion it prints a leading zero For x or X a non zero will have 0x or 0X as a prefix For e E f g and G the result will always have one digit on the right of the decimal point Will cause the left pad character to be a zero 0 for all numeric conversion types Chapter 10 307 SICL Language Reference IPRINTF List of The conv chars conversion characters you can use in conversion cony chars commands are 308 Corresponding arg is an integer If no flags are given send the number in IEEE 488 2 NR1 integer format If flags indicate an NR2 floating point or NR3 floating point format convert the argument to a floating point number This argument supports all six flag modifier formatting
196. in addition to the device or interface clear function iflush id I BUF DISCARD READ I BUF DISCARD WRITE Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IFLUSH and the interface specific chapter in this manual for details of implementation 218 Chapter 10 SICL Language Reference ICLOSE ICLOSE Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int iclose id INST id Description Once you no longer need a session close it using the iclose function This function closes a SICL session After calling this function the value in the id parameter is no longer a valid session identifier and cannot be used again Note Donot call iclose from an SRQ or interrupt handler because it may cause unpredictable behavior Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IOPEN Chapter 10 219 C Syntax Description Return Value See Also SICL Language Reference IDEREFPTR IDEREFPTR Supported Sessions 0005 device interface commander include lt sicl h gt int idereptr id handle value INST id unsigned long handle unsigned char value This function tests the handle returned by imapx The id is the valid SICL session id returned from the iopen functio
197. ing LF character default a flag indicates to not send END If no or flag appears an error is generated Corresponding arg is a pointer to a null terminated string that is sent as a string In C C corresponding arg is a pointer to a null terminated string that is sent as an IEEE 488 2 string response data block An IEEE 488 2 string response data block consists of a leading double quote followed by non double quote characters and terminated with a double quote Send the ASCII percent character 309 SICL Language Reference IPRINTF i Corresponding arg is an integer Same as d except that the six flag modifier formatting options NR1 1 NR2 2 NR3 3 H Q or B are ignored o u x X Corresponding arg will be treated as an unsigned integer The argument is converted to an unsigned octal o unsigned decimal u or unsigned hexadecimal x X The letters abcdef are used with x and the letters ABCDEF are used with x The precision specifies the minimum number of characters to appear If the value can be represented with fewer than precision digits leading zeros are added If the precision is set to zero and the value is zero no characters are printed e E Corresponding arg is a double in C C The argument is converted to exponential format that is d dddde dd The precision specifies the number of digits to the right of the decimal point If no precision is specified then six digi
198. interrupts Waits for EIR invokes the handler for each interrupt Handler checks interrupt cause amp exits when EIR is clear finclude lt sicl h gt void handler id reason sec INST id long reason sec if reason I_INTR_GPIO EIR printf EIR interrupt detected n Proper protocol is for the peripheral device to hold EIR asserted until the controller acknowledges the interrupt The method for acknowledging and or responding to EIR is very device dependent Perhaps a CTLx line is pulsed or data is read etc The response should be executed at this point in the program else printf Unexpected Interrupt reason d n reason main INST intf interface session id log message and exit program on error ionerror I_ ERROR EXIT open GPIO interface session intf iopen gpio 96 Chapter5 Using SICL with GPIO Communicating with GPIO Interfaces suspend interrupts until configured lintroff configure interrupts ionintr intf handler isetintr intf I_INTR_GPIO EIR 1 wait for interrupts printf Ready for interrupts n while 1 iwaithdlr 0 iwaithdlr performs an automatic iintron If your program does concurrent processing instead of waiting then you need to execute iintron when you are ready for interrupts xy This simplified example loops for
199. ion is via a LAN gateway 186 Chapter 8 Troubleshooting Your SICL Program Troubleshooting Your SICL Program This chapter provides a guide to troubleshooting errors that may occur when using SICL This chapter contains the following sections Installing an Error Handler Looking at Error Codes and Messages Troubleshooting SICL Troubleshooting SICL over LAN Troubleshooting SICL over RS 232 Troubleshooting SICL over GPIO e Where to Find Additional Information 188 Chapter 9 Troubleshooting Your SICL Program Installing an Error Handler Installing an Error Handler One of the simplest ways to detect SICL run time errors is to install an error handler SICL allows you to install an error handler for all SICL functions within an application When a SICL function call results in an error the error routine specified in the error handler is called You can use one of the error routines provided by SICL or you can write your own error routine Use the SICL ionerror function to install an error handler lonerror proc Where proc is the error routine to be called when a SICL function call results in an error The following are error routines provided by SICL _ERROR_ EXIT This valueinstalls aspecialerrorhandlerwhich will print a diagnostic message and then terminate the process _ERROR_NO_ EXIT This value installs a special error handler wh
200. ions 00005 device interface commander C Syntax include lt sicl h gt void icauseerr id errcode flag INST id int errcode int flag VDescription Occasionally it is necessary for an application to simulate a SICL error The icauseerr function performs that function This function causes SICL to act as if the error specified by errcode see Chapter 9 Troubleshooting Your SICL Program for a list of errors has occurred on the session specified by id If flag is 1 the error handler associated with this process is called if present otherwise it is not On operating systems that support multiple threads the error is per thread and the error handler will be called in the context of this thread See Also IONERROR IGETONERROR IGETERRNO IGETERRSTR Chapter 10 217 SICL Language Reference ICLEAR ICLEAR Supported sessions 00 0 c cece eee ee eens device interface Affected by functions 0 00000 ee ilock itimeout C Syntax include lt sicl h gt int iclear id INST id Description Use the iclear function to clear a device or interface If id refers to a device session this function sends a device clear command If id refers to an interface this function sends an interface clear command The iclear function also discards the data in both the read and the write formatted I O buffers This discard is equivalent to performing the following iflush call
201. irectories Linux Directories Description of Files var adm sw products SICL SICL LAN opt sicl defaults opt sicl lib Files for customization opt sicl The default versions of the LAN defaults configuration files opt sicl lib The LAN driver shared libraries SICL LANSVR Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL LANSVR opt sicl bin Files for customization The SICL LAN server daemon and a LAN configuration utility opt sicl bin Appendix A 393 The SICL Files SICL MAN Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL MAN opt sicl share man manl opt sicl share man manim opt sicl share man man3 opt sicl share man man4 Files containing copyright information opt sicl share man manl opt sicl share man manim opt sicl share man man3 opt sicl share man man4 SICL MAN HPIB Filesets Files containing man pages for SICL user utilities Files containing man pages for SICL system administrator utilities Files containing man pages for SICL function calls Files containing man pages for SICL configuration files HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL MAN HPIB opt sicl share man man3 opt sicl share ma
202. is error then some problem with the cable or the peripheral device is indicated Generic I O Error This error results if you have specified 1 HINT _USEDMA and also specified other conditions that are inconsistent with DMA For example the DMA controller cannot perform pattern matching So setting itermchr or GPIO READ EOI prevents the use of DMA The easiest way to avoid this error is to avoid the use of ihint The system always picks an appropriate mode for any transaction if left to its own devices If you believe that I_ HINT _USEDMA is needed in your program be careful to avoid any other requirements or conditions that prevent the use of DMA 206 Chapter 9 Troubleshooting Your SICL Program Troubleshooting SICL over GPIO Bad Parameter This error has the same meaning for GPIO as for any interface However one case may be less obvious than typical parameter passing errors If the interface is in 16 bit mode the number of bytes requested in an i read or iwrite function must be an even number Although you probably view 16 bit data as words the syntax of iread and iwrite requires a length specified as bytes Chapter 9 207 Troubleshooting Your SICL Program Where to Find Additional Information Where to Find Additional Information For Compile Link Errors see the following e Chapter 2 Getting Started with SICL for SICL compile link instructions Chapter 3 Usin
203. ision operator is an integer preceded by a period such as 6d The optional precision for conversion characters e E and f specifies the number of digits to the right of the decimal point For the d i o u x and X conversion characters it specifies the minimum number of digits to appear For the s and s conversion characters the precision specifies the maximum number of characters to be read from your arg string In C C an asterisk may appear in the place of the integer in which case it will take another arg to satisfy this conversion command The next arg will be an integer that will be the precision for example iprintf id da 6 num The comma operator is an integer preceded by a comma such as 3 10d The optional comma operator is only valid for conversion characters d and f This is a comma followed by a number This indicates that a list of comma separated numbers is to be generated The argument is an array of the specified type instead of the type that is an array of integers instead of an integer In C C an asterisk may appear for the number in which case it will take another arg to satisfy this conversion command The next arg will be an integer that is the number of elements in the array The meaning of the modifiers h 1 w z and Z is dependent on the conversion character Such as Swd A conversion character is a character that specifies the type of arg and
204. itches If yours is a new application someone on the project with good hardware skills should become familiar with the HP Agilent E2074 cabling and handshake behavior In either case it is important to read the HP Agilent E2074 GPIO Interface Installation Guide Following are some GPIO specific reasons for certain SICL errors Keep in mind that many of these can also be caused by non GPIO problems For example Operation not supported will happen on any interface if you execute igetintfsess with an interface ID Such general causes are discussed earlier in this book The following discussion highlights the causes of errors that relate directly to the HP Agilent E2074 GPIO interface Bad Address for iopen This means the same thing for GPIO as for any interface It indicates that the iopen did not succeed because the specified address symbolic name does not correspond to the Symbolic Name specified during the configuration This is mentioned here because the GPIO has more configuration fields and thus more chances for mistakes than any other interface 204 Chapter 9 Troubleshooting Your SICL Program Troubleshooting SICL over GPIO If your iopen fails first check the values in your GPIO interface configuration values and ensure that the configuration was processed successfully As root execute the command On HP UX 11i sbin dmesg On Linux bin dmesg If there were no errors the I O configuration section of dmesg will co
205. ite data which you do not wish to block waiting for the returned status from the server call ilantimeout with a timeout value of 1 e Make the iwrite call The iwrite call will return as soon as the message is sent not waiting for a reply The iwrite call s return value will be I ERR TIMEOUT and the reported count will be 0 even though the data will be written assuming no errors Note that the server will send a reply to the write even though the client will simply discard it There is no way to directly determine the success or failure of the write although a subsequent functioning read call can be a good sign e Reset the client side timeout to a reasonable value for your network by calling ilantimeout again with a value sufficiently large enough to allow a read reply to be received It is recommended that you use a value which provides some margin for error Note that the timeout specified to ilantimeout is in milliseconds rounded up to the nearest second e Make the blocking iread call or formatted I O call that will read data Since ilantimeout has been set to a value other than 1 preferably not 0 the iread call will wait for a response from the server for the specified time rounded up to the nearest second If the no wait value is used in a multi threaded application and multiple threads are attempting I O over the LAN the I O operations using the no wait option will wait for access to the LAN for 2 minutes
206. ith the I_ TRIG STD value passed to it it pulses the CTLO control line RS 232 Device Session Triggers The itrigger function sends the 488 2 TRG n command to the serial device RS 232 Interface Session Triggers The itrigger function performs the same function as calling ixtrig with the I_ TRIG STD value passed to it it pulses the DTR modem control line Chapter 10 359 VXI Triggers Note Return Value See Also SICL Language Reference ITRIGGER VXI Device Session Triggers The itrigger function sends a word serial trigger command to the specified device The itrigger function is only supported on message based device sessions with VXI VXI Interface Session Triggers The itrigger function performs the same function as calling ixtrig with the I TRIG STD value passed to it it causes one or more VXI trigger lines to fire Which trigger lines are fired is determined by the ivxitrigroute function For C programs this function returns zero 0 if successful or a non zero error number if an error occurs TXTRIG and the interface specific chapter in this manual for more information on trigger actions 360 Chapter 10 SICL Language Reference IUNLOCK IUNLOCK Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int iunlock id INST id Description The iunlock function unlocks a device or interface that has been previously locked If you attempt to perfo
207. lated Documents sei505 sci538 seasons Harts a 22 Other SICL Learning Products ccccccceesceteceeceeeeeeeeeseeesteeseeseeeeaes 22 Other Documentation cccccccccccccceessccceessscceessecesssseeccsssesessrseeeesaas 23 2 Getting Started with SICL Reviewing a SICL Program cceccecscesseessecseceeeceeeeeseeeseceeeeeeeeseeeeesaees 27 Compiling and Linking a SICL Program eeececeseeseeceeeeceneeeeeeeeees 29 Using Shared Libraries cccccccccsccessceseeeeeesceseeseeseeceseeceeeeesseeeas 29 Running an SICL Program cccecceccsecscceseceseeeeeeesecaeceseeeeceeeeeeeeseenseens 31 Getting Online Help rnm annan a n an i ah i iii 32 Using Manual Pages ccccccccssessscesecesceeeeeesecsseceseeeeeeeeeeseeesecnaeeneeens 32 Where to GONE a ns ea r e A E AE EE E NEET eon 33 3 Using SICL Including the sicl h Header File cecccccesceeseeeeeeseeeseeeteceteeeseeeseeeees 37 Opening a Communications Session cccccccesccesseereeeseeeteceteeeeeeeseeesees 38 Device SESSIONS sscs354ecxsSacscahcancvahdancanzesneanesaeen saa Ea 39 Interface Sessions c cccceessessecseceeeceeecescecsaecscenseceteeeseeeseeeeceaeenseeees 40 Commander Sessions cccccessecsseeseceseceseeeseeesceeeceaecneceeeeeeseeseeaeess 41 Sending I O Commands cccccecsseeseceseceseeeeeeeeeesaecsaeseeeeeeeseeeaeecseenaeens 42 Formatted VO nieee e eR E E E 42 Non Formatted Onire a Ea E O A 52 Using Asynchronous Events esse
208. le programs are also provided to help you understand how these features work Copies of the example programs are located in the opt sicl share examples directory This chapter contains the following sections Including the sicl h Header File e Opening a Communications Session e Sending I O Commands e Using Asynchronous Events e Using Error Handlers Using Locking For specific details on SICL function calls see Chapter 10 36 Chapter 3 Using SICL Including the sicl h Header File Including the sicl h Header File You must include the sic1 h header file at the beginning of every file that contains SICL calls This header file contains the SICL function prototypes and the definitions for all SICL constants and error codes include lt sicl h gt Chapter 3 37 Using SICL Opening a Communications Session Opening a Communications Session A communications session is a channel of communication with a particular device interface or commander e A device session is used to communicate with a specific device connected to an interface A device is a unit that receives commands from a controller Typically a device is an instrument but could be a computer a plotter or a printer e An interface session is used to communicate with a specified interface Interface sessions allow you to use interface specific functions for example igpibsendcmd A commander session is used to communicate with the interface comman
209. leftover data for the next iscanf ipromptf call This is the default action Setting a size less than zero creates a buffer of the absolute value of the specified size For write buffers the buffer flushes writes to the device whenever the buffer fills up for each newline character in the format string or at the completion of every iprintf call For read buffers the buffer flushes erases its contents at the end of every iscanf or ipromptf function 340 Chapter 10 SICL Language Reference ISETBUF Note Calling isetbuf flushes any data in the buffer s specified in the mask parameter Return Value This function returns zero 0 if successful or a non zero error number if an error occurs See Also IPRINTF ISCANF IPROMPTF IFWRITE IFREAD IFLUSH ISETUBUF Chapter 10 341 SICL Language Reference ISETDATA ISETDATA Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int isetdata id data INST id void data Description The isetdata function stores a pointer to a data structure and associates it with a session or INST id You can use these user defined data structures to associate device specific data with a session such as device name configuration instrument settings and so forth You are responsible for the management of the buffer that is if the buffer needs to be allocated or deallocated you must do it
210. licit control of the PCTL line Attempting to use I_GPIO SET PCTLin auto handshake mode results in the error Operation not supported 260 Chapter 10 SICL Language Reference IGPIOCTRL I_GPIO_PCTL_DELAY The setting parameter selects a PCTL delay value from a set of eight click stops numbered 0 through 7 A setting of 0 selects 200 ns a setting of 7 selects 50 us For a complete list of delay values see the GPIO Interface Installation Guide Changes made by this function can remain in the interface hardware after your program ends The setting remains until the computer is rebooted I GPIO POLARITY The setting parameter determines the logical polarity of various interface lines according to the following bit map A 0 sets active low polarity a 1 sets active high polarity Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Data Out Data In PSTS PFLG PCTL Value 16 Value 8 Value 4 Value 2 Value 1 Changes made by this function can remain in the interface hardware after your program ends The setting remains until the computer is rebooted Chapter 10 261 SICL Language Reference IGPIOCTRL I GPIO READ CLK The setting parameter determines when the data input registers are latched It is recommended that you represent setting as a hex number In that representation the first hex digit corresponds to the upper most significant input byte and the second hex digit corresponds to the lower in
211. lid data value The ipokex16 and ipokex32 functions perform byte swapping if necessary so that VXI memory accesses follow correct VXI byte ordering Also if a bus error occurs unexpected results may occur TIPEEKX8 IPEEK X16 IPEEK X32 IMAPX Chapter 10 299 SICL Language Reference IPOPFIFO IPOPFIFO C Syntax int ibpopfifo INST id unsigned char unsigned char unsigned long int iwpopfifo INST id unsigned char unsigned char unsigned long int swap int ilpopfifo INST id unsigned char unsigned char unsigned long int swap finclude lt sicl h gt id fifo dest cnt fifo dest cnt id fifo dest cnt swap fifo dest cnt id fifo dest cnt swap fifo dest cnt Note Not supported over LAN Description The i popfifo functions read data from a FIFO and puts it in memory Use b for byte w for word and 1 for long word 8 bit 16 bit and 32 bit respectively These functions increment the write address to write successive memory locations while reading from a single memory FIFO location Thus these functions can transfer entire blocks of data The id although specified is normally ignored except to determine an interface specific transfer mechanism such as DMA To prevent using an interface specific mechanism pass a zero 0 in this parameter The dest argument is the starting memory address for the destination data The fifo argument is the
212. lid hexadecimal number If the 1 ell argument modifier is used the argument must be a pointer to an unsigned long integer for C C If the h argument modifier is used the argument must be a pointer to an unsigned short integer for C C Corresponding arg must be a character pointer for C C The conversion type matches a non empty sequence of characters from a set of expected characters The characters between the and the are the scanlist The scanset is the set of characters that match the scanlist unless the circumflex is specified If the circumflex is specified then the scanset is the set of characters that do not match the scanlist The circumflex must be the first character after the otherwise it will be added to the scanlist The can be used to build a scanlist It means to include all characters between the two characters in which it appears for example a z means to match all the lower case letters between and including a and z If the appears at the beginning or the end of conversion string is added to the scanlist 327 SICL Language Reference ISCANF n Corresponding arg is a pointer to an integer for C C The number of bytes currently converted from the device is placed into the arg No argument is converted F Corresponding arg is a pointer to a FILE descriptor The input data read from the device is written to the file referred to by the FILE descriptor until the END indicator is received
213. ling isetubuf flushes the buffer specified in the mask parameter Note Once a buffer is allocated to isetubuf do not use the buffer for any other use In addition once a buffer is allocated to isetubuf either for a read or write buffer don t use the same buffer for any other session or for the opposite type of buffer on the same session write or read respectively In order to free a buffer allocated to a session make a call to isetbuf which will cause the user defined buffer to be replaced by a system defined buffer allocated for this session The user defined buffer may then be either re used or freed by the program Return Value This function returns zero 0 if successful or a non zero error number if an error occurs See Also IPRINTF ISCANF IPROMPTF IFWRITE IFREAD ISETBUPF IFLUSH 354 Chapter 10 C Syntax Description Note SICL Language Reference ISWAP ISWAP finclude lt sicl h gt int iswap addr length datasize int ibeswap addr length datasize int ileswap addr length datasize char adadr unsigned long length int datasize These functions provide an architecture independent way of byte swapping data received from a remote device or data that is to be sent to a remote device This data may be received sent using the iwrite iread calls or the ifwrite ifread calls The iswap function will always swap the data The ibeswap function a
214. lock out all device session accesses on that interface such as iwrite dev2 as well as all other SICL interface session accesses on that interface The following C example will cause the device session to hang intf iopen hpib dev iopen hpib 7 ilock intf ilock dev this will succeed iwrite dev CLS 4 1 0 this will hang Locks can be nested So every ilock requires a matching iunlock If iclose is called either implicitly by exiting the process or explicitly for a session that currently has a lock the lock will be released For C programs this function returns zero 0 if successful or a non zero error number if an error occurs TUNLOCR ISETLOCK WAIT IGETLOCK WAIT Chapter 10 279 SICL Language Reference IMAP IMAP Supported sessions 00005 device interface commander Affected by functions 0 000000 ee ilock itimeout Note Not recommended for new program development Use IMAPX instead C Syntax include lt sicl h gt char imap id map space pagestart pagecnt suggested INST id int map_space unsigned int pagestart unsigned int pagecnt char suggested Note Not supported over LAN Description The imap function maps a memory space into your process space The SICL i peek and i poke functions can then be used to read and write to VXI address space The id argument specifies a VXI interface
215. lock word serial command has arrived This interrupt is enabled using isetintr by specifying a secval 0 If secval 0 then this is disabled If a lock occurred the secval in the handler is passed a 1 if an unlock the secval in the handler is passed 0 Return Value This function returns zero 0 if successful or a non zero error number if an error occurs See Also IONINTR IGETONINTR IWAITHDLR IINTROFF INTRON IXTRIG and the section titled Asynchronous Events and HP UX Signals in Chapter 3 for protecting I O calls against interrupts 350 Chapter 10 C Syntax Description Note Return Value See Also SICL Language Reference ISETLOCKWAIT ISETLOCKWAIT Supported sessions 00005 device interface commander include lt sicl h gt int isetlockwait id flag INST id int flag The isetlockwait function determines whether library functions wait for a device to become unlocked or return an error when attempting to operate on a locked device The error that is returned is 1 ERR_LOCKED If flag is non zero then all operations on a device or interface locked by another session will wait for the lock to be removed This is the default case If flag is zero 0 then all operations on a device or interface locked by another session will return an error I_ ERR LOCKED This will disable the timeout value set up by the itimeout function
216. m MEAS VOLT DC n 14 1 NULL Read the results iread dvm strres 20 NULL NULL Release the multimeter device for use by others iunlock dvm Print the results printf Result is s n strres Close the multimeter session iclose dvm Chapter 3 67 Using SICL Using Locking 68 Chapter3 Using SICL with GPIB Using SICL with GPIB The HPIB interface Hewlett Packard Interface Bus is Hewlett Packard s implementation of the IEEE 488 1 Bus Other IEEE 488 versions include GPIB General Purpose Interface Bus and IEEE Bus GPIB and HPIB are both used in the discussions and examples in this chapter The HPIB related SICL functions have the string GPIB embedded in the function name This chapter explains how to use SICL to communicate over GPIB In order to communicate over GPIB you must have loaded the GPIB fileset during the system installation See the O Libraries Installation and Configuration Guide for information This chapter describes in detail how to open a communications session and communicate with GPIB devices interfaces or controllers The example programs shown in this chapter are also provided in the opt sicl share examples directory This chapter contains the following sections e Creating a Communications Session with GPIB Communicating with GPIB Devices e Communicating with GPIB Interfaces e Communicating with GPIB Commanders Summary
217. main char inst _addr 80 char base_ addr unsigned short id_reg devtype reg INST id get instrument address puts Pleas nter the logical address of the register based instrument for example vxi 24 n gets inst addr install error handler ionerror I_ ERROR EXIT open communications session with instrument id iopen inst _addr itimeout id 10000 map into user memory space base _ addr imap id I MAP VXIDEV 0 1 NULL read registers id reg iwpeek unsigned short base addr 0x00 devtype reg iwpeek unsigned short base addr 0x02 print results printf Instrument at address s n inst addr printf ID Register 0x 4X n Device Type Register 0x 4X n id_reg devtype reg unmap memory space iunmap id base addr I MAP VXIDEV 0 1 close session iclose id 116 Chapter 6 Using SICL with VXI MXI Communicating with VXI MXI Devices Catching Bus It is good practice to add bus error handling to your applications that use Errors Example i peek and i poke Adda catch _buserror function call before using i peek or i poke and the uncatch_buserror function call at the end of your application The following is an example of these functions The following functions handle catching amp processing buserrors include lt signal h gt Structure defined in signal h str
218. mation on this utility iopen fails with a timeout error Possible Solution Increase the value of the Client Timeout Delta parameter during the SICL LAN interface configuration See the Using Timeouts with LAN section in chapter 8 for more information Chapter 9 197 iopen fails other failures I O operation times out Operation following a timed out operation fails iopen fails or other operations fail due to locks Troubleshooting Your SICL Program Troubleshooting SICL over LAN Client and Server iopen fails with some error other than those already mentioned above Possible Solution Try the steps mentioned at the beginning of this section to determine if the client and server can talk to one another over the LAN If the ping and rpcinfo procedures described earlier in this chapter work then check any server error logs which may be available for further clues Check for possible problems such as a lack of resources at the server memory number of SICL sessions etc An I O operation times out even though the timeout being used is infinity Possible Solution Increase the value of the Server Timeout value during the LAN interface configuration Also ensure that the LAN client timeout is large enough if you used ilantimeout See the Using Timeouts with LAN section in chapter 8 for more information An I O operation following a previous timeout fails to return or takes longer than expected Possible Solution
219. ments is easy to do This chapter explains how to use SICL to communicate over RS 232 In order to communicate over RS 232 you must have loaded the RS232 fileset during the I O Libraries installation See the O Libraries Installation and Configuration Guide for information Also note that the RS 232 related SICL functions have the string SERIAL embedded in the functions names This chapter describes in detail how to open a communications session and communicate with an instrument over an RS 232 connection The example programs shown in this chapter are also provided in the opt sicl share examples directory This chapter contains the following sections Creating a Communications Session with RS 232 e Communicating with RS 232 Devices e Communicating with RS 232 Interfaces Summary of RS 232 Specific Functions 144 Chapter 7 Using SICL with RS 232 Creating a Communications Session with RS 232 Creating a Communications Session with RS 232 Once you have configured your system for RS 232 communications you can start programming with the SICL functions If you have programmed RS 232 before you will probably want to open the interface and start sending commands With SICL you must first determine what type of communications session you will need SICL is designed to provide a standard way of accessing instrumentation that is independent from the type of connection With GPIB and VXI there can be multiple devic
220. n man3 Files for customization Files containing man pages for SICL GPIB specific function calls SICL MAN GPIO Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL MAN GPIO Files for customization opt sicl share man opt sicl share man Files containing man pages for man3 man3 SICL GPIO specific function calls 394 AppendixA SICL MAN VXI Filesets The SICL Files HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL MAN VXI opt sicl share man manim opt sicl share man man3 opt sicl share man man4 opt sicl share man manlm opt sicl share man man3 opt sicl share man man4 Files containing copyright information Files containing man pages for SICL VXI MXI specific system administrator utilities Files containing man pages for SICL VXI MXI specific function calls Files containing man pages for SICL VXI MXI specific configuration files SICL MAN RS232 Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL MAN RS232 opt sicl share man man3 opt sicl share man man3 Files containing copyright information Files containing man pages for SICL RS 232 specific function Calls SICL MAN LAN Filesets HP UX 11i Directories Linux Directories Descripti
221. n The name used in your SICL program must match the logical unit orsymbolic name specified in the system configuration Other possible interface names are serial SERIAL etc For other interfaces SICL supports the concept of primary and secondary addresses For RS 232 the only primary address supported is 488 SICL does not support secondary addressing on RS 232 interfaces The following are examples of opening a device session with an RS 232 device INST dmm dmm iopen com1 488 Chapter 7 147 Using SICL with RS 232 Communicating with RS 232 Devices SICL Function Support with RS 232 Device Sessions The following describes how some SICL functions are implemented for RS 232 device sessions iprintf SICL s formatted I O routines depend on the iscan concept of an EOI indicator Since RS 232 does not ipromptf define an EOI indicator SICL uses the newline character n by default You cannot change this with a device session however you can use the iserialctrl function with an interface session See the section titled SICL Function Support with RS 232 Interface Sessions later in this chapter ireadstb Sends the IEEE 488 2 command STB to the instrument followed by the newline character n It then reads the ASCII response string and converts it to an 8 bit integer Note that this will work only if the instrument supports this command itrigger Sends the IEEE 488 2 command TRG to the in
222. n handle is the valid SICL map handle obtained from the imapx function This function sets value to zero 0 if imap or imapx returns a map handle that cannot be used as a memory pointer you must use ipeekx8 ipeekx16 ipeekx32 ipokex8 ipokex16 ipokex32 or iblockmovex functions Alternately the function returns a non zero value if imapx returns a valid memory pointer that can be directly dereferenced For C programs this function returns zero 0 if successful or it returns a non zero error number if an error occurs IMAPX TUNMAPX IPEEKX8 IPEEKX16 IPEEK X32 TIPOKEX8 IPOKEX16 IPOKEX32 IBLOCKMOVEX 220 Chapter 10 SICL Language Reference IFLUSH m Supported sessions n ooann device interface commander Affected by functions n naaa naana neea ilock itimeout C Syntax include lt sicl h gt int iflush id mask INST id int mask Description This function is used to manually flush the read and or write buffers used by formatted I O The mask may be one or a combination of the following flags I BUF READ I BUF WRITE I BUF WRITE END I BUF DISCARD READ I BUF DISCARD WRITE The I_BUF_RI Indicates the read buffer iscanf If data is present it will be discarded until the end of data that is if the END indicator is not currently in the buffer reads will be performed until it is read Indicates the write buffer iprintf I
223. n DEVICE ADDRESS constant This function is called to set the length of time that SICL will wait for an instrument to respond Different timeout values can be set for different sessions as needed These formatted I O functions are patterned after those used in the C programming language They support the standard ANSI C format string plus added formats defined specifically for instrument I O This function closes the session with the specified device For more details on SICL features see Chapter 3 Using SICL You can also see Chapter 10 for specifics about these SICL function calls 28 Chapter2 Getting Started with SICL Compiling and Linking a SICL Program Compiling and Linking a SICL Program You can create your SICL applications in C ANSI C or C When compiling and linking a C program that uses SICL use the lsicl command line option to link in the SICL library routines The following example creates the idn executable file on HP UX 11i cc Aa o idn idn c lsicl on Linux use gcc o idn idn c lsicl The Aa option specifies ANSI C on HP UX The o option creates an executable file called idn The 1 option links in the shared SICL library If you are building an application that was originally built on HP UX 9 or if you need to link with the SICL archive libraries on HP UX 9 see Appendix B Updating HP UX 9 SICL Applications Using Shared Libraries If your program uses a shar
224. n be found in the interface specific chapter for example Using SICL with GPIB later in this manual Commander Sessions The commander session allows you to talk to the interface controller Typically the controller is the computer used to communicate with devices on the interface However when the controller is no longer the active controller or passes control commander sessions can be used to talk to the controller In this mode the interface is acting like a device on the interface non controller To create a commander session specify either the interface symbolic name or logical unit followed by a comma and then the string cmdr in the iopen function The interface symbolic name and logical unit are defined during the system configuration See the I O Libraries Installation and Configuration Guide for information on these values The following are valid commander addresses hpib cmdr GPIB commander session 7 cmdr Commander session on interface at logical unit 7 The following is an example of creating a commander session with the GPIB interface INST cmdr cmdr iopen hpib cmdr Chapter 3 41 Using SICL Sending I O Commands Sending I O Commands Once you have established a communications session with a device interface or commander you can start communicating with that session using either formatted I O or non formatted I O Formatted I O converts mixed types of data under the control of a format stri
225. n fails unrecognized symbolic name iopen fails timeout Troubleshooting Your SICL Program Troubleshooting SICL over LAN Client and Server SICL LAN Client Problems and Possible Solutions iopen fails with error I ERR_SYNTAX Possible Solution If using the lan net_address format ensure that the net_address is a hostname not an IP address If you must use an IP address specify the address using the bracket notation lan 128 10 0 3 rather than the comma notation lan 128 10 0 3 iopen fails with the error I ERR _BADADDR and the error text is core connect failed RPC PROG NOT REGISTERED Possible Solution This indicates that the SICL LAN server has not registered itself on the server machine This may also be caused by specifying an incorrect hostname Ensure that the hostname or IP address is correct and if so check the LAN server s installation and configuration iopen fails with the error I_ ERR_SYMNAME and the error text is bad hostname gethostbyname failed Possible Solution This indicates that the hostname used in the iopen address is unknown to the networking software Ensure that the hostname is correct and if so contact your network administrator to configure your machine to recognize the hostname The utility ns lookup can be used to determine if the hostname is known to your system See the nslookup 1 man page for more infor
226. n order for the resource manager to run on SYSRESET sysreset vxi ivxirm t 5 amp Appendix D 419 Customizing your VXI MXI System The iproc Utility Initialization and SYSRESET The following is an example of the etc opt sicl iproc cf file iproc configuration file Boot up functions Lines are of the form boot lt command to execute gt boot echo SICL Instrument I O Initialization The next line must always exist boot siclsetup V743 or VXI MXI Support boot ivxirm p I vxi When a SYSRESET occurs rerun the resource manager delay 5 sec The resource manager MUST be run in the background i e last character should be a amp sysreset vxi ivxirm t 5 amp Sample lines for a second VXI MXI interface boot ivxirm p I vxi2 sysreset vxi2 ivxirm I vxi2 t 5 amp The following line must be present for ALL VXI MXI systems monitor 420 Appendix D Customizing your VXI MXI System Viewing the VXlbus System Configuration Viewing the VXIbus System Configuration You can use the SICL ivxisc utility to read the current system configuration and print a human readable display ivxisc etc opt sicl vxiLU LU represents the logical unit of the VXI MXI interface Run the I O setup configuration utility for information on the Logical Unit of your VXI MXI interface Also see VXI MXI Utilities later in this chapter for information on using this utility Appendix D 421 Customi
227. ng The data is buffered thus optimizing interface traffic The formatted I O routines are geared towards instruments and are very efficient in I O e Non formatted I O sends or receives raw data to or from a device interface or commander With non formatted I O no formatting or conversion of the data is performed Thus if formatted data is required it must be done by the user See the following sections for a complete description and examples of using formatted I O and non formatted I O Formatted I O The SICL formatted I O mechanism is similar to the C stdio mechanism SICL formatted I O however is designed specifically for instrument communication and is optimized for IEEE 488 2 compatible instruments The three main functions for formatted I O are as follows e The iprintf function formats according to the format string and sends data to the session specified by id iprintf id format arg arg2 e The iscanf function receives data from the session specified by id and converts the data according to the format string iscanf id format arg f arg2 42 Chapter3 Formatted I O Conversion Using SICL Sending I O Commands The ipromptf function formats data according to the writefmt string and sends data to the session specified by id and then immediately receives the data and converts it according to the readfmt string iprompt f id writefmt readfmt arg arg2 See Chapter 10
228. ng parameter is a mask containing the state of all control lines A 1 bit asserts the corresponding line a 0 zero bit clears the corresponding line The HP Agilent E2074 5 interface has two control lines so only the two least significant bits have meaning for that interface These can be represented by the following All other bits in the setting mask are ignored I GPIO CTRL CTLOThe CTLO line I GPIO CTRL CTL1The CTL1 line I GPIO DATA The setting parameter is a mask containing the state of all data out lines A 1 bit asserts the corresponding line a 0 zero bit clears the corresponding line The HP Agilent E2074 5 interface has either 8 or 16 data out lines depending on the setting specified by igpiosetwidth Note that this function changes the data lines asynchronously without any type of handshake It is intended for programs that implement their own handshake explicitly I GPIO READ EOI If the setting parameter is 1 GPIO EOI NONE then END pattern matching is disabled for read operations Any other setting enables END pattern matching with the specified value If the current data width is 16 bits then the lower 16 bits of setting are used If the current data width is 8 bits then only the lower 8 bits of setting are used T GPIO SET PCTL If the setting parameter is non zero then a GPIO handshake is initiated by setting the PCTL line Auto handshake mode must be disabled to allow exp
229. ng values I SERIAL PAR ERIAL_ ERIAL ERIAL PAR PAR NONI ERIAL PAR SPAC EVEN Even parity _ODD Odd parity PAR No parity bit MARK Parity always one E Parity always zero I SERIAL STOP The result parameter will be set to one of the following values I SERIA I SERIA I SERIAL WIDTH following values I SERIA ERIA S SERIA SERIA 336 STOP_1 1 stop bits STOP_2 2 stop bits The result parameter will be set to one of the CHAR _5 5 bit characters CHAR_6 6 bit characters CHAR 7 7 bit characters CHAR 8 8 bit characters Chapter 10 SICL Language Reference ISERIALSTAT I_SERIAL DUPLEX The result parameter will be set to one of the following values I SERIAL DUPLEX FULL Use full duplex I SERIAL DUPLEX HALF Use half duplex I SERIAL MSL The result parameter will be set to the bit wise OR of all of the Modem Status Lines that are currently being asserted The value of the result parameter will be the logical OR of all of the serial lines currently being asserted The serial lines are both the Modem Control Lines and the Modem Status Lines The following are the supported serial lines I SERIAL DCD Data Carrier Detect I _SERIAL_DSR Data Set Ready I SERIAL CTS Clear To Send I SERIAL RI Ring Indi
230. not guaranteed Also note that the correct behavior of iremote and iclear depend on the correct address strings being used Any of the following functions may timeout over LAN even those functions which cannot timeout over local interfaces See the Using Timeouts with LAN section later in this chapter for more details These functions all cause a request to be sent to the server for execution All GPIB specific functions All VXI specific functions All Serial specific functions iabort iclear iclose e iflush E fread fwrite e igetintfsess e ilocal ilock FOnNintr e ionsrq e iopen e iprintf e ipromptf e iread e ireadstb e iremote e iscanf e isetbuf e isetintr e isetstb e isetubuf e itrigger iunlock e iversion e iwrite Ixtrig 1 i Chapter 8 173 Using SICL with LAN Communicating with Devices over LAN The following SICL functions perform as follows with LAN gatewayed sessions idrvrversion Returns the version numbers from the server iwrite actualcnt may be reported as 0 when some iread bytes were transferred to or from the device by the server This can happen if the client times out while the server is in the middle of an I O operation LAN gatewayed The following example program opens an GPIB device session via a LAN Session to GPIB gateway Note that this example is the same as the first example in Example the Using SICL with GPIB ch
231. not reply in the time specified then the client stops waiting for the reply from the server and returns I ERR TIMEOUT to the application LAN Timeout Functions The ilantimeout and ilangettimeout functions can be used to set or query the current LAN timeout value They work much like the itimeout and igettimeout functions The use of these functions is optional however since the software will calculate the LAN timeout based on the SICL timeout in use and configuration values specified during the system configuration see the O Libraries Installation and Configuration Guide for information on setting this value Once ilantimeout is called by the application the automatic LAN timeout adjustment described in the next sub section is turned off See Chapter 10 for details of the ilantimeout and ilangettimeout functions Note that a timeout value of 1 used with the i lantimeout function has special significance causing the LAN client to not wait for a response from the LAN server However the timeout value of 1 should be used in special circumstances only and should be used with extreme caution For more 178 Chapter 8 Using SICL with LAN Using Timeouts with LAN information about this timeout value see the section Using the No Wait Value under the i Lantimeout function in Chapter 10 Default LAN Timeout Values The LAN Client interface configuration specifies two timeout related configuration values for
232. notification of interrupts Occasionally you may want to suspend a process and wait until an event occurs that causes a handler to execute The iwaithd1lr function causes the process to suspend until either an enabled SRQ or interrupt condition occurs and the related handler executes Once the handler completes its operation this function returns and processing continues For this function to work properly your application must turn interrupts off before enabling asynchronous events that is use iintroff The iwaithdl1r function behaves as if interrupts are enabled Interrupts are still disabled after the iwaithd1r function has completed Only calls to iintron will re enable interrupts Interrupts must be disabled if you are using iwaithdlr Use iintroff to disable notification of interrupts The reason for disabling notification of interrupts is that the interrupt may occur between the isetintr and iwaithdIr and ifyou only expect one interrupt it might come before the iwaithdlr Notification may not occur that is the handler may not get called This may or may not be the effect you desire 56 Chapter 3 Note Using SICL Using Asynchronous Events For example iintroff ionintr vxi trigger handler isetintr vxi I INTR TRIG I TRIG TTLO I TRIG TTL7 ivxitrigon vxi I_ TRIG TILO while done iwaithdlr 0 lintron Asynchronous Events and Unix Signals If you are using SICL LAN see the
233. nt modifier h 1 w z and Z is dependent on the conversion character Argument Modifiers Argument Conversion Description Modifier Character h d i Corresponding argument is a short integer h f Corresponding argument is a float for iprintf or a pointer to a float for iscanf l d i Corresponding argument is a long integer l b B Corresponding argument is a pointer to an array of long integers f Corresponding argument is a double for iprintf or a pointer to a double for iscanf w b B Corresponding argument is a pointer to an array of short integers Z b B Corresponding argument is pointer to an array of floats Z b B Corresponding argument is a pointer to an array of doubles 46 Chapter 3 Using SICL Sending I O Commands Conversion Characters The conversion characters for sending and receiving formatted I O are different The following tables summarize the conversion characters for each iprintf and ipromptf Conversion Characters Conversion Description Character d i Corresponding argument is an integer f Corresponding argument is a double b B Corresponding argument is a pointer to an arbitrary block of data c C Corresponding argument is a character t Controls whether the END indicator is sent with each LF character in the format string s S Corresponding argument is a pointer to a null terminated string Sends an ASCII percent character O U X X Corresponding argum
234. ntain a line such as SICL HP E2074 GPIO Initialized If there was a problem you will see a short diagnostic message containing the words GPIO config This diagnostic message will help you identify the field in the SICL configuration which contained the error Operation Not Supported The HP Agilent E2074 has several modes Certain operations are valid in one mode and not supported in another Two examples are igpioctrl id I GPIO AUX value This operation applies only to the Enhanced mode of the data port Auxiliary control lines do not exist when the interface is in HP 98622 Compatibility mode igpioctrl id I GPIO SET PCTL 1 This operation is allowed only in Standard Handshake mode When the interface is in Auto Handshake mode the default explicit control of the PCTL line is not possible Chapter 9 205 Troubleshooting Your SICL Program Troubleshooting SICL over GPIO No Device This error indicates that you wanted PSTS checks for read write operations and a false state of the PSTS line was detected Enabling and disabling PSTS checks is done with the command igpioctrl id I GPIO CHK PSTS value If the check seems to be reporting the wrong state of the PSTS line then correct the PSTS polarity bit by running the configuration utility See the O Libraries Installation and Configuration Guide for information on running this utility If the PSTS check is functioning properly and you get th
235. nted to by arg White space is not ignored with 3c No null character is added to the end of the string s Corresponding arg is a pointer to a string for C C All leading white space characters are ignored then all characters from the device are read into a string until a white space character is read An optional field width indicates the maximum length of the string Note that you should specify the maximum field width of the buffer being used to prevent overflows S Corresponding arg is a pointer to a string for C C This data is received as an IEEE 488 2 string response data block The resultant string will not have the enclosing double quotes in it An optional field width indicates the maximum length of the string Note that you should specify the maximum field width of the buffer being used to prevent overflows t Corresponding arg is a pointer to a string for C C Read all characters from the device into a string until an END indicator is read An optional field width indicates the maximum length of the string All characters read beyond the maximum length are ignored until the END indicator is received Note that you should specify the maximum field width of the buffer being used to prevent overflows b Corresponding arg is a pointer to a buffer This conversion code reads an array of data from the device The data must be in IEEE 488 2 Arbitrary Block Program Data format Note that depending on the structure of the data da
236. nterface status 247 interrupts 343 344 445 lines active controller 248 ATN Attention 248 DAV Data Valid 248 EOI END or Identify 248 IFC Interface Clear 248 listener 248 LLO Local Lockout 248 NDAC Not Data Accepted 248 NRFD Not Ready for Data 248 REM Remote 248 REN Remote Enable 248 SRQ Service Request 248 talker 248 listener 247 local lockout 250 not data accepted NDAC 247 parallel poll 252 254 pass control 251 remote enable 248 255 remote mode 247 318 send commands 256 service requests SRQ 247 status 247 system controller 247 tl delay 249 257 talker 247 triggers 359 385 GPIO auto handshake 259 auto handshake status 267 auxiliary control lines 259 control lines 260 control lines status 267 data width 263 264 data in clocking 262 data in line status 267 data out lines 260 END pattern matching 260 268 446 enhanced mode status 268 external interrupt request EIR status 267 functions see igpio handshake status 267 interface control 258 interface line polarity 261 Interface sessions 92 interface status 267 interrupts 343 344 346 PCTL delay value 261 peripheral control PCTL line 260 peripheral status PSTS line 259 267 268 SICL functions GPIO specific 98 status 266 status lines 268 triggers 359 385 GPIO interface manuals 23 gpiointr c example 96 gpiomeas c example 95 H Handlers
237. ny pages to free The map_space argument contains the following legal values H Z IAP A16 I MAP A24 I MAP A32 I MAP VXIDI I MAP EXT H Z AP_SHAR E EV END ED E Map in VXI A16 address space Map in VXI A24 address space Map in VXI A32 address space Map in VXI device registers Device session only Map in VXI A16 address space Device session only Map in VXI A24 A32 memory that is physically located on this device called local shared memory Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IMAPX 364 Chapter 10 SICL Language Reference IVERSION IVERSION C Syntax include lt sicl h gt int iversion siclversion implversion int siclversion int implversion Description The iversion function stores in siclversion the current SICL revision number times ten that the application is currently linked with The SICL version number is a constant defined in sicl h for C This function stores in implversion an implementation specific revision number the version number of this implementation of the SICL library Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs Chapter 10 365 SICL Language Re IVXIBUSSTATUS IVXIBUSSTATUS ference Supported sessions 2 0 00 cece cece eee ene interface
238. o set the maximum time to wait for an I O operation to complete In this function tva defines the timeout in milliseconds A value of zero 0 disables timeouts Note Not all computer systems can guarantee an accuracy of one millisecond on timeouts Some computer clock systems only provide a resolution of 1 50th or 1 60th of a second Other computers have a resolution of only 1 second Note that the time value is always rounded up to the next unit of resolution Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGETTIMEOUT 358 Chapter 10 C Syntax Description Triggers on GPIB Triggers on GPIO Triggers on RS 232 Serial SICL Language Reference ITRIGGER ITRIGGER Supported sessions 00 0 c eee eee eee ees device interface Affected by functions 00 0 0 0 0 ee ilock itimeout finclude lt sicl h gt int itrigger id INST id The itrigger function is used to send a trigger to a device GPIB Device Session Triggers The itrigger function performs an addressed GPIB group execute trigger GET GPIB Interface Session Triggers The itrigger function performs an unaddressed GPIB group execute trigger GET The itrigger command on a GPIB interface session should be used in conjunction with igpibsendcmd GPIO Interface Session Triggers The itrigger function performs the same function as calling ixtrig w
239. oes the addressing and or other bus management controller role A computer acting as a controller communicating with a device device A unit that receives commands from a controller Typically a device is an instrument but could also be a computer acting in a non controller role or another peripheral such as a printer or plotter device driver A segment of software code that communicates with a device It may either communicate directly with a device by reading and writing registers or it may communicate through an interface driver 436 device session A session that communicates as a controller specifically with a single device such as an instrument handler A software routine used to respond to an asynchronous event such as an error or an interrupt instrument A device that accepts commands and performs a test or measurement function interface A connection and communication media between devices and controllers including mechanical electrical and protocol connections interface driver A software segment that communicates with an interface It also handles commands used to perform communications on an interface interface session A session that communicates and controls parameters affecting an entire interface Interpreted SCPI A SICL interface type that allows you to talk to register based instruments with the high level SCPI commands interrupt An asynchronous event requiring attention out of the normal flow
240. of GPIB Specific Functions 70 Chapter 4 Using SICL with GPIB Creating a Communications Session with GPIB Creating a Communications Session with GPIB Once you have determined that your GPIB system is setup and operating correctly you may want to start programming with the SICL functions First you must determine what type of communication session you need The three types of communications sessions are device interface and commander Chapter 4 71 Note Using SICL with GPIB Communicating with GPIB Devices Communicating with GPIB Devices The device session allows you direct access to a device without worrying about the type of interface to which it is connected The specifics of the interface are hidden from the user Addressing GPIB Devices To create a device session specify either the interface symbolic name or logical unit anda particular device s address in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The following are example GPIB addresses for device sessions hpib 7 A device address corresponding to the device at primary address 7 and symbolic name hpib hpib 3 2 A device address corresponding to the device at primary address 3 secondary address 2 and symbolic name hpib hpib 9 0 A device address corresponding to the device at
241. of control of a program lock A state that prohibits other users from accessing a resource such as a device or interface 437 logical unit A logical unit is a number associated with an interface A logical unit in SICL uniquely identifies an interface Each interface on the controller must have a unique logical unit mapping An operation that returns a pointer to a specified section of an address space as well as makes the specified range of addresses accessible to the requester non controller role A computer acting as a device communicating with a controller process An operating system object containing one or more threads of execution that share a data space A multi process system is a computer system that allows multiple programs to execute simultaneously each in a separate process environment A single process system is a computer system that allows only a single program to execute at a given point in time register An address location that controls or monitors hardware session An instance of a communications channel with a device interface or commander A session is established when the channel is opened with the iopen function and is closed with a corresponding call to iclose SRQ Service Request An asynchronous request an interrupt from a remote device indicating that the device requires servicing status byte A byte of information returned from a remote device showing the current state and status of the
242. olic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The following are example addresses for VXI MXI device sessions vxi 24 A device address corresponding to the device at primary address 24 on the vxi interface vxi 128 A device address corresponding to the device at primary address 128 on the vxi interface Remember that the primary address must be between 0 and 255 The primary address corresponds to the VXI logical address and specifies the address in A16 space of the VXI device The previous examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name orlogical unit specified during the configuration The name used in your SICL program must match the logical unit orsymbolic name specified in the system configuration Other possible interface names are VXI MXI mxi etc SICL supports only primary addressing on the VXI device sessions Specifying a secondary address causes an error The following is an example of opening a device session with the VXI device at logical address 64 106 Chapter 6 Using SICL with VXI MXI Communicating with VXI MXI Devices INST dmm dmm iopen vxi 64 Chapter 6 107 Using SICL with VXI MXI Communicating with VXI MXI Devices Message Based Device Session Ex
243. omizing your VXI MXI System iproc sysreset interface name monitor Note This keyword will execute the action on the interface_name when a VXI SYSRESET interrupt is detected by the iproc daemon This function is primarily used to ensure that the VXI resource manager ivxirm will be run in response to a VXI SYSRESET This requires iproc to continue execution This keyword allows the i proc daemon to continue execution when there are no other keywords like sysreset which would require it to continue execution Without a keyword in iproc cf that allows or requires iproc to continue execution such as sysreset or monitor i proc will halt execution and exit 424 Appendix D Syntax Description Customizing your VXI MXI System ivxirm ivxirm ivxirm diptvDILMS arguments The ivxirm the resource manager initializes the VXI and MXI buses by reading several configuration files and by polling the VXI devices to determine their resources and capabilities Then using a set of rules governing VXI configuration it defines the relationships between commanders and servants and writes this information to the rs remgr out configuration file The resource manager also optionally prints this information to the standard output The resource manager is usually run automatically at system power on The command line argument definitions follow d The next argument contains the name of the directory for the static and
244. on of Files var adm sw products SICL SICL MAN LAN opt sicl share man man3 opt sicl share man man3 Files containing copyright information Files containing man pages for SICL LAN specific function calls Appendix A 395 The SICL Files SICL MAN LANSVR Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL MAN LANSVR opt sicl share man manim opt sicl share man manim Files containing copyright information LAN specific man pages SICL DIAG Filesets HP UX 11i Directories Linux Directories Description of Files var adm sw products SICL SICL DIAG opt sicl bin Files containing copyright information opt sicl bin A directory containing diagnostic programs and utilities 396 AppendixA Updating HP UX 9 SICL Applications Updating HP UX 9 SICL Applications This appendix describes what you need to do in order to run your SICL for HP UX 9 applications on HP UX 11i 398 Appendix B Updating HP UX 9 SICL Applications Building SICL Applications on HP UX 11i Building SICL Applications on HP UX 11i If you built your SICL application on HP UX 9 x with the SICL shared library then no changes are necessary However if you used the SICL archive library then you must either re build your application or run the provided script See the following e If your SICL 9
245. one handler The data transfer functions work only when the GPIB interface is the Active Controller Passing control to another GPIB device causes the interface to lose active control 74 Chapter 4 Using SICL with GPIB Communicating with GPIB Devices GPIB Device Session Example The following example illustrates communicating with an GPIB device session This example opens two GPIB communications sessions with VXI devices through a VXI Command Module Then a scan list is sent to a switch and measurements are taken by the multimeter every time a switch is closed Chapter 4 75 Using SICL with GPIB Communicating with GPIB Devices hpibdev c This example program sends a scan list to a switch and while looping closes channels and takes measurements include lt sicl h gt include lt stdio h gt main 76 INST dvm INST sw double res int is Print message and terminate on error ionerror I _ERROR_EXIT Open the multimeter and switch sessions dvm iopen hpib 9 3 sw iopen hpib 9 14 itimeout dvm 10000 itimeout sw 10000 Set up trigger iprintf sw TRIG SOUR BUS n Set up scan list iprintf sw SCAN 100 103 n iprintf sw INIT n for i 1 i lt 4 it Take a measurement iprintf dvm MEAS VOLT DC n Read the results iscanf dvm Slf amp res Print the results printf Result
246. open function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The following are example addresses for VXI MXI device sessions iscpi 32 A register based device address corresponding to the device at primary address 32 on the iscpi interface vxi 24 A device address corresponding to the device at primary address 24 on the vxi interface vxi 128 A device address corresponding to the device at primary address 128 on the vxi interface Remember that the primary address must be between 0 and 255 The primary address corresponds to the VXI logical address The above examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name orlogical unit specified during the configuration The name used in your SICL program must match the logical unit orsymbolic name specified in the system configuration Other possible interface names are VXI MXI mxi etc SICL supports only primary addressing on the VXI device sessions Specifying a secondary address causes an error 110 Chapter 6 Using SICL with VXI MXI Communicating with VXI MXI Devices The following is an example of opening a device session with the VXI device at logical address 64 INST dmm dmm iopen vxi 64 Chapter 6 111 Prog
247. or Locked by another user Commander session is not active or available No connection Device is not active or available Description A SICL call was aborted by iabort or external means The device interface address passed to iopen doesn t exist Verify that the interface name is the one assigned in the hwconfig cf file An invalid configuration was identified when calling iopen Invalid format string specified for iprintf or iscanf The specified INST id does not have a corresponding iopen The imap call has an invalid map request The specified interface is busy The use of CRC Checksum etc imply invalid data SICL internal error A process interrupt has occurred in your application The address specified in iopen is not a valid address e g hpib 57 An I O error has occurred for this communication session Resource is locked by another session see isetlockwait intrinsic Tried to specify a commander session when it is not active available or does not exist Communication session has never been established or connection to remote has been dropped Tried to specify a device session when it is not active available or does not exist 190 Chapter 9 Troubleshooting Your SICL Program Looking at Error Codes and Messages Error Codes and Messages Continued Error Code ERR_NOERROR ERR_NOINTF D FH A B pI A R_NOTSUPP ERR_OS ERR OVERFLOW ERR PARAM ERR
248. or with the last byte of the data block Otherwise if endi is set to zero no END indicator will be sent The actualcnt argument is a pointer to an unsigned long integer which upon exit will contain the actual number of bytes written to the specified interface or device A NULL pointer can be passed for this argument and no value will be written For LAN if the client times out prior to the server the actualcnt returned will be 0 even though the server may have written some data to the device or interface For C programs this function returns zero 0 if successful or a non zero error number if an error occurs TREAD IFREAD IFWRITE Chapter 10 383 SICL Language Reference IXTRIG IXTRIG Supported sessions 2 6 0 cece eee eee eens interface Affected by functions 0 0 00a ee ilock itimeout C Syntax include lt sicl h gt int ixtrig INST id unsigned long which id which Description The ixtrig function is used to send an extended trigger to an interface The argument which can be I TRIG STD I TRIG AL I TRIG TTI I TRIG TTI I TRIG TTI I TRIG TTI L TRIG TT I TRIG TT T SEREG SEII TEREG GELI I TRIG E I TRIG E 384 Li LO L1 K2 L3 L4 L5 L6 L7 Standard trigger operation for all interfaces The exact operation of I TRIG_STD depends on the particular interface See the following subsections fo
249. or a list of errors for a complete description of the error codes The INST id that is passed to the error handler is the same INST id that was passed to the function that generated the error Therefore if an error occurred because of an invalid INST id the INST id passed to the error 288 Chapter 10 SICL Language Reference IONERROR handler is also invalid Also if iopen generates an error before a session has been established the error handler will be passed a zero 0 INST id Two special reserved values of proc can be passed to the ionerror procedure I_ERROR_EXIT This value installs a special error handler which logs a diagnostic message and terminates the process I_ERROR_NO EXIT This value also installs a special error handler which logs a diagnostic message but does not terminate the process Ifa zero 0 is passed as the value of proc it will remove the error handler Note that the error procedure could perform a setjmp longjmp or an escape using the try recover clauses Example for using setjmp longjmp finclude lt sicl h gt INST id jmp_buf env a void proc INST int Error occurred perform a longjmp longjmp env 1 void xyzzy if setjmp env 0 Normal code lonerror proc Do actions that could cause errors iwrite iredg Cee See ess ee Ore ionerror 0 else Error Code ionerror 0 do error p
250. or by single stepping your program RS 232 Port Allocation and HP UX termio Functions Note that an RS 232 port which is configured for use by SICL is not available for use by Unix termio functions and vice versa 202 Chapter 9 Troubleshooting Your SICL Program Troubleshooting SICL over RS 232 Data Received from Instrument is Garbled Check the interface configuration Install an interrupt handler in your program that checks for communication errors Data Lost During Large Transfers Check the following e Flow control settings match Full half duplex for 3 wire connections e Cabling is correct for hardware handshaking Chapter 9 203 Troubleshooting Your SICL Program Troubleshooting SICL over GPIO Troubleshooting SICL over GPIO Because the GPIO interface has such flexibility most initial problems come from cabling and configuration There are many fields that be specified during the I O Libraries configuration For example no data transfers will work correctly until the handshake mode and polarity have been correctly set A GPIO cable can have up to 50 wires in it and you often must solder your own plug to at least one end It is important to have the hardware configuration under control before you begin troubleshooting your software If you are porting an existing HP 98622 application the hardware task is simplified The cable connections are the same and many configuration values closely approximate HP 98622 DIP sw
251. or device The pagestart argument indicates the page number within the given memory space where the memory mapping starts The pagecnt argument indicates how many pages to use The map_space argument will contain one of the following values I MAP A16 Map in VXI A16 address space 64 Kbyte pages I MAP A24 Map in VXI A24 address space 64 Kbyte pages I MAP A32 Map in VXI A32 address space 64 Kbyte pages I MAP VXIDEV Map in VXI device registers Device session only 64 bytes 280 Chapter 10 SICL Language Reference IMAP I_MAP EXTEND Map in VXI Device Extended Memory address space in A24 or A32 address space See individual device manuals for details regarding extended memory address space Device session only I MAP SHARED Map in VXI A24 A32 memory that is physically located on this device sometimes called local shared memory If the hardware supports it that is the local shared VXI memory is dual ported this map should be through the local system bus and not through the VXI memory This mapping mechanism provides an alternate way of accessing local VXI memory without having to go through the normal VXI memory system The value of pagestart is the offset in 64 Kbyte pages into the shared memory The value of pagecnt is the amount of memory in 64 Kbyte pages to map Note The E1489 MXIbus Controller Interface can generate 32 bit data reads and writes to VXIbus devices with D32 capability To use
252. or rlogin and kill the hung siclland server process You can determine what siclland server processes are running by typing the following ps ef grep siclland You ll see something like the following root 2492 2480 11 15 33 27 0 00 siclland 1 var opt sicl siclland_ log Where 2492 is the PID of the running server You will see one server process for each client connected to this host If more than one server is running you have two options for killing the hung server Ifinformational logging has been enabled using the s option to siclland then the server process matching a client process can be determined by log entries which by default is placed in the file var opt sicl siclland_log See siclland 1m for details Ifno logging has been enabled then the server as a whole will need to be reset by killing all siclland processes Note that this will break the connections to all clients even those which are still operational Use the following to kill a LAN server process This must be done as root kill PID_number 200 Chapter 9 Troubleshooting Your SICL Program Troubleshooting SICL over LAN Client and Server rpcinfo fails rpcinfo returns the message rpcinfo can t contact portmapper can t contact Rec SYSTEM ERROR Connection refused portmapper Possible Solution Ensure that the portmapper is running on the server See portmap 1m for details on starting the portmapper Note that i
253. ormation short int_handler 8 List of interrupt handlers short interrupter 8 List of interrupters short file 10 Unused This static data is set up by the VXI resource manager Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also See the platform specific manual for the section on the Resource Manager Chapter 10 371 SICL Language Reference IVXISERVANTS IVXISERVANTS Supported sessions 2 0 0 cece eee en enna interface C Syntax include lt sicl h gt int ivxiservants id maxnum list INST id int maxnum int list Description The ivxiservants function returns a list of VXI servants This function returns the first maxnum servants of this controller The ist parameter points to an array of integers that holds at least maxnum integers This function fills in the array from beginning to end with the list of active VXI servants All unneeded elements of the array are filled with 1 Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs 372 Chapter 10 IVXITRIGOFF Supported sessions 0 cece eee eee eens interface C Syntax int ivxitrigoff INST id include lt sicl h gt id which unsigned long which SICL Language Reference IVXITRIGOFF ilock itimeout Description The ivxitrigoff function de asserts
254. ory this value represents 256 byte pages For A32 memory this value represents 64 Kbyte pages Interpret as an unsigned integer for this command I_VXI_BUS_SHM ADDR SPACE Returns either 24 or 32 depending on whether the device s VXI memory is located in A24 or A32 memory space I_VXI_BUS_SHM PAGE Returns the location of the device s VXI memory For A24 memory the result is in 256 byte pages For A32 memory the result is in 64 Kbyte pages Chapter 10 367 SICL Language Reference IVXIBUSSTATUS I_VXI_BUS_VXIMXI I_VXI_BUS_TRIGSUPP Returns 0 if device is a VXI device Returns 1 if device is a MXI device Returns a numeric value indicating which triggers are supported The numeric value is the sum of the following values I TRIG STD I TRIG ALL I TRIG _TTLO I TRIG TTL I TRIG TTL2 I TRIG _TTL3 I TRIG _TTL4 I TRIG TTL5 I TRIG _TTL6 I TRIG _TTL7 I TRIG ECLO I TRIG ECLI I TRIG _ECL2 I TRIG_ECL3 I TRIG _EXTO I TRIG EXT I TRIG _EXT2 I TRIG_EXT3 I TRIG_CLKO I TRIG CLK1 I TRIG _CLK2 I TRIG CLK10 I TRIG_CLK100 I TRIG SERIAL DTR I TRIG _ SERIAL RTS I TRIG_GPIO_CTLO I TRIG GPIO _CTL1 0x00000001L Ox ffffffffL 0x00001000L 0x00002000L 0x00004000L 0x00008000L 0x00010000L 0x00020000L 0x00040000L 0x00080000L 0x00100000L 0x00200000L 0x00400000L 0x00800000L 0x01000000L 0x00200000L 0x00400000L 0x00800000L 0x10000000L 0x20000000L 0x40000000L 0x80000000L 0x00000800L 0x00000400L 0
255. other supported SICL interfaces does not allow for direct communication with devices via interface commands LAN interface sessions if used at all will typically be used only for setting the client side LAN timeout see the Using Timeouts with LAN section later in this chapter To create a LAN interface session specify either the interface symbolic name or logical unit and a particular device s address in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the O Libraries Installation and Configuration Guide for information on these values The following are examples of LAN interface addresses lan A LAN interface address 30 A LAN interface address 30 is the default lu for LAN The following SICL functions are not supported over LAN interface sessions and will return I ERR_NOTSUPP All GPIB specific functions All VXI specific functions All serial specific functions e All formatted I O routines e iwrite e iread ilock iunlock e isetintr e itrigger ixtrig e ireadstb e isetstb imapinfo ilocal e iremote 176 Chapter 8 Using SICL with LAN Communicating with Devices over LAN The following SICL functions perform as follows with LAN interface sessions iclear lonsrq ionintr iabort igetluinfo Chapter 8 Performs no operation returns I_ERR_NOERROR Performs no op
256. ou two different methods of indicating EOI Chapter 10 331 SICL Language Reference ISERIALCTRL 332 The first method is to use a character The character can have a value between 0 and Oxff Whenever this value is encountered in a read iread iscanf or ipromptf the read will terminate and the term reason will include I_ TERM END The default for serial is the newline character n The second method is to use bit 7 if numbered 0 7 of the data as the END indicator The data would be bits 0 through 6 and when bit 7 is set that means EOI The following values are valid for the setting parameter I SERIAL EOI CHR n A character is used to indicate EOI where n is the character This is the default type and n is used I SERIAL EOI_NONE No EOI indicator I SERIAL EOI BITS Use the eighth bit of the data to indicate EOI On the last byte the eighth bit will be masked off and the result will be placed into the buffer Chapter 10 SICL Language Reference ISERIALCTRL I_SERIAL_WRITE_EOI The setting parameter will contain the value of the type of END Indicator to use for writes The following are valid values to use I SERIAL EOI_NONE No EOI indicator This is the default for I SERIAL WRITE iprintf I SERIAL EOI BITS Use the eighth bit of the data to indicate EOI On the last byte the eighth bi
257. peek32x 297 ipeek8x 297 ipoke 114 125 298 ipoke utility 406 ipoke16x 299 ipoke32x 299 ipoke8x 299 ipopfifo 300 iprintf 42 93 148 225 229 302 conversion characters 47 iproc utility 423 ipromptf 42 148 229 312 ipushfifo 313 iread 52 151 224 315 GPIO interface sessions 93 HP IB commander sessions 87 HP IB device sessions 74 HP IB interface sessions 78 LAN gatewayed sessions 174 termination character 357 VXI MXI device sessions 130 iread utility 407 ireadstb 94 148 317 HP IB commander sessions 87 HP IB device sessions 74 VXI MXI device sessions 130 iremote 318 IRQ lines 415 irg cf 415 iscanf 42 93 148 223 229 319 conversion characters 47 notes on using 319 using with itermchr 319 I SCPI communicating 109 iserialbreak 329 iserialctrl 330 iserialmclctrl 153 334 iserialmclstat 335 iserialstat 153 336 isetbuf 340 isetdata 227 342 isetintr 55 343 isetlockwait 278 351 isetstb 352 isetubuf 353 isprintf 229 302 isscanf 229 319 isvprintf 229 302 isvscanf 229 319 itermchr 93 224 316 357 using with iscanf 319 itimeout 28 358 itrigger 133 148 151 359 GPIO interface sessions 93 HP IB device sessions 74 HP IB interface sessions 78 VXI MXI device sessions 130 iunlock 64 361 iunmap 114 125 282 285 362 iversion 365 ivprintf 229 302 ivpromptf 229 312 ivscanf 229 319 ivxibusstatus 366
258. printf dvm MEAS VOLT DC n Read the results iscanf dvm Sl1f amp res Print the results printf Result is f n res Close the voltmeter session iclose dvm Chapter 7 149 Note Using SICL with RS 232 Communicating with RS 232 Interfaces Communicating with RS 232 Interfaces Interface sessions can be used to get or set the characteristics of the RS 232 connection Examples of some of these characteristics are baud rate parity and flow control When communicating with an RS 232 interface session you specify the interface name Addressing RS 232 Interfaces To create an interface session on RS 232 specify either the interface symbolic nameor logical unit anda particular device s address in the addr parameter of the iopen function The interface symbolic name and logical unit are defined during the system configuration See the V O Libraries Installation and Configuration Guide for information on these values The following are example addresses for RS 232 interface sessions COM1 An interface symbolic name COM2 An interface symbolic name 9 An interface logical unit The previous examples use the default symbolic name specified during the system configuration If you want to change the name listed above you must also change the symbolic name orlogical unit specified during the configuration The name used in your SICL program must match the logical unit orsymbolic name sp
259. pulses the P_RESET line for approximately 12 microseconds aborts any pending writes discards any data in the receive buffer and resets any error conditions Optionally it also clears the Data Out port depending on the mode configuration specified during the GPIO interface configuration The iclear command when used on a VXI MXI interface session causes a pulse on the SYSRESET line which cancels the normal operation state until the resource manager has reconfigured the VXI system The iclear command when used on a VXI message based device session sends a word serial device clear command to the specified device Ifa SYSRESET iclear occurs and the iscpi instrument is running then the iscpi instrument will be terminated If this happens you will get a No Connect error message and you need to re open the iscpi communications session Appendix C 403 The SICL Utilities iclear Using the iclear command on the RS 232 interface session clears the input and output buffers and sends a break character The parameter definitions follow t timeout Times out after timeout milliseconds y Turns on verbose mode Prints the usage of the iclear program Example iclear t 1000 vxi 404 Appendix C ipeek The SICL Utilities ipeek b Syntax ipeek v w sym_name map_space offset l Description ipeek is the SICL utility for examining memory locations on interfaces Example that support mapping The ipeek utility w
260. put byte The clocking choices are 0 Read 1 Busy 2 Ready For an explanation of the data in clocking see the GPIO Interface Installation Guide Changes made by this function can remain in the interface hardware after your program ends The setting remains until the computer is rebooted Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIOSTAT IGPIOSETWIDTH 262 Chapter 10 SICL Language Reference IGPIOGETWIDTH IGPIOGETWIDTH Supported sessions 0 0 0 cece ete eee eens interface C Syntax include lt sicl h gt int igpiogetwidth id width INST id int width Note GPIO is not supported over LAN Description The igpiogetwidth function returns the current data width in bits of a GPIO interface For the HP Agilent E2074 5 interface width will be either 8 or 16 Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIOSETWIDTH Chapter 10 263 SICL Language Reference IGPIOSETWIDTH IGPIOSETWIDTH Supported sessions 2 0 00 cece cece cece nen enn interface Affected by functions 0 00 0 0 eae ilock itimeout C Syntax include lt sicl h gt int igpiosetwidth id width INST id int width Note GPIO is not supported over LAN Description The igpiosetwidth function is used to set the data
261. r 6 Using SICL with VXI MXI Using SICL Trigger Lines The itrigger function when used on a VXI MXI interface session generates the same results as the ixtrig functions with the value passed to it _TR G STD The I TRIG_ STD value when passed to the ixtrig function causes one or more VXI trigger lines to fire The trigger lines represented by before it is used no action will be taken TRIG STD are determined by the ivxitrigroute function The TRIG_STD value has no default value Therefore if it is not defined The following is an example that illustrates how to use some of the SICL VXI trigger functions Chapter 6 133 Using SICL with VXI MXI Using SICL Trigger Lines trigger c An example program illustrating various trigger operations with SICL include lt sicl h gt finclude lt unistd h gt main INST id Install error handler ionerror I_ ERROR EXIT Open a vxi interface session id iopen vxi Assert drive low TTLTRG2 TILTRG4 and TTLTRG6 for 1 sec ivxitrigon id I TRIG TTL2 I TRIG TTL4 I TRIG TTL6 sleep 1 De Assert drive high all previously asserted trigger lines ivxitrigoff id I TRIG ALL Route External Trigger In SMB Connector EXTO to TTLTRGO ivxitrigroute id I TRIG _EXTO I TRIG TTLO Route internal clock to External Trigger Out SMB Connector EXT1 ivxit
262. r C programs this function returns zero 0 if successful or a non zero error number if an error occurs IGPIBATNCTL IWRITE 256 Chapter 10 SICL Language Reference IGPIBSETT1DELAY IGPIBSETTIDELAY Supported sessions 0 cee eee eee eens interface Affected by functions 0 000 000s ilock itimeout C Syntax include lt sicl h gt int igpibsettldelay id delay INST id int delay Description This function sets the t1 delay on the GPIB interface associated with session id The value is the time of t1 delay in nanoseconds and should be no less than I_GPIB_T1DELAY MIN or no greater than I GPIB _T1DELAY MAX Note that most GPIB interfaces only support a small number oft delays so the actual value used by the interface could be different than that specified in the igpibsettldelay function You can find out the actual value used by calling the igpibgettldelay function Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIBGETTIDELAY Chapter 10 257 SICL Language Reference IGPIOCTRL IGPIOCTRL Supported sessions 2 6 0 cece cece ee een enn interface Affected by functions 0 00 0 0 02 ae ilock itimeout C Syntax include lt sicl h gt int igpioctrl id request setting INST id int request unsigned long setting Note GPIO is not supported over LAN 258 C
263. r application Ignored signals are not queued blocked signals have a one deep queue and are acted on as soon as the block is removed The following programming segment shows signal blocking SIGALARM and SIGINT are blocked during an iscanf call temporarily block 2 signals old mask sigblock sigmask SIGINT sigmask SIGALRM call protected I O function iscanf id Sf amp mydata restore original signal mask Ssigsetmask old mask 58 Chapter3 Using SICL Using Asynchronous Events Interrupt Handler Example The following is an ANSI C example that installs an interrupt handler and enables the interrupts on the VXI TTL trigger lines When the TTL trigger line is asserted the installed interrupt handler is called interrupts c This is an example of the interrupt handling in SICL This program installs an interrupt handler and enables th interrupts on trigger and waits for the interrupt include lt sicl h gt include lt stdio h gt include lt unistd h gt int intr 0 void trigger handler INST id long reason long secval indicate that the interrupt happened antr 1 end of trigger handler main INST id start child process to fire trigger line if fork 0 child ionerror I_ ERROR EXIT lintroff id iopen vxi set the interrupt handler ionintr id trigger handler
264. r interface specific information All standard triggers for this interface that is the bit wise OR of all supported triggers TTL Trigger Line 0 TTL Trigger Line 1 TTL Trigger Line 2 TTL Trigger Line 3 TTL Trigger Line 4 TTL Trigger Line 5 TTL Trigger Line 6 TTL Trigger Line 7 ECL Trigger Line 0 ECL Trigger Line 1 Chapter 10 TOT iot _TRIG _TRIG _ RIG E RIG E RIG RIG EXTO EXT1 EXT2 EXT3 SICL Language Reference IXTRIG ECL Trigger Line 2 ECL Trigger Line 3 External BNC or SMB Trigger Connector 0 External BNC or SMB Trigger Connector 1 External BNC or SMB Trigger Connector 2 External BNC or SMB Trigger Connector 3 Triggers on When used on a GPIB interface session passing the I TRIG STD value to GPIB the ixtrig function causes an unaddressed GPIB group execute trigger GET The ixtrig command on a GPIB interface session should be used in conjunction with the igpibsendcmd There are no other valid values for the ixtrig function Triggers on The ixtrig function will pulse either the CTLO or CTL1 control line The GPIO following values can be used I TRIG STD CTLO I TRIG GPIO CTLO CTLO I TRIG GPIO CTL1 CTL1 Triggers on The ixtrig function will pulse either the DTR or RTS modem control RS 232 Serial lines The following values can be used I TRIG STD I_ TRIG SERIAL I_ TRIG SERIAL Chapter 10 Data Terminal Ready DTR DTR Data Terminal Ready DT
265. r such Software and Documentation by the applicable FAR or DFARS clause or the TAMS standard software agreement for the product involved Copyright 1984 1985 1986 1987 1988 Sun Microsystems Inc Microsoft Windows NT and Windows 95 are U S registered trademarks of Microsoft Corporation Pentium is a U S registered trademark of Intel Corporation Copyright 1994 1995 1996 1997 1998 Hewlett Packard Company All rights reserved Copyright 2001 2003Test amp Measurement Systems All rights reserved This document contains information which is protected by copyright All rights are reserved Reproduction adaptation or translation without prior written permission is prohibited except as allowed under the copyright laws Printing History This is the seventh edition of the Standard Insrtument Control Library User s Guide for HP UX Note on previous editions the Reference section was actually a separate manual On previous versions the manual was operating system specific Edition 1 May 1994 Edition 2 September 1994 Edition 3 January 1995 Edition 4 November 1995 Edition 5 July 1998 Edition 6 August 2001 Edition 7 August 2003 Contents SICL User s Guide Edition 7 1 Introduction SIC CAOR EN ert a a E Maes dete tt detect ie AR rete E 20 SICT FG atures oiene5 hskis hes Sh lastiei at Seiya aces tease De oe 20 SIC TE MSP ies astiecteceisheetrheravadl toate eed ceeds tect asai 21 R
266. r that is preceded by a period When used with conversion characters e E and f the number of digits to the right of the decimal point is specified For the d i o u x and X conversion characters the minimum number of digits to appear is specified For the s and S conversion characters the precision specifies the maximum number of characters to be read from the argument This field is only used when sending formatted I O iprintf and ipromptf You can use an asterisk in place of the integer to indicate that the integer is taken from the next argument The following example converts numb so that there are only two digits to the right of the decimal point and sends it to the session specified by id float numb 26 9345 iprintf id 2f numb Sends 26 93 Chapter 3 45 Using SICL Sending I O Commands Array Size The comma operator is a format modifier which allows you to read or write a comma separated list of numbers only valid with d and conversion characters It is a comma followed by an integer The integer indicates the number of elements in the array argument The comma operator has the format of dd where dd is the number of elements to read or write The following example specifies a comma separated list to be sent to the session specified by id int list 5 101 102 103 104 105 iprintf id 5d list Sends 101 102 103 104 105 Argument Modifier The meaning of the optional argume
267. r to you A session identifier is needed for most SICL functions Note that for the C and C languages SICL defines the variable type INST C and C programs should declare session identifiers to be of type INST For example INST id Some SICL functions are supported on device sessions some on interface sessions some on commander sessions and some on all three The listing for each function in this chapter indicates which sessions support that function In addition some functions are affected by locks refer to the ilock function This means that if the device or interface that the session refers to is locked by another process this function will block and wait for the device or interface to be unlocked before it will succeed or it will return immediately with the error I ERR LOCKED Refer to the isetlockwait function Likewise some functions are affected by timeouts refer to the itimeout function This means that if the device or interface that the session refers to is currently busy this function will wait for the amount of time specified by itimeout to succeed If it cannot it will return the error I ERR_TIMEOUT Functions that do not support sessions and are not affected by ilock or itimeout are per process functions The SICL function ionerror is an example of this The ionerror function installs an error handler for the process As such it handles errors for all sessions in the process regardless of th
268. ramming Directly to the Registers Note Using SICL with VXI MXI Communicating with VXI MXI Devices When communicating with register based devices you either have to send a series of peeks and pokes directly to the device s registers or you have to have a command interpreter to interpret the high level SCPI commands Command interpreters include the iscpi interface HP Agilent C Size Command Module HP Agilent B Size Cardcage built in command module or HP Agilent Compiled SCPI When sending a series of peeks and pokes to the device s registers use the following process e Map memory space into your process space Read the register s contents using i peek e Write to the device registers using i poke Unmap the memory space Note that the above procedure is only used on register based devices that are not using the iscpi interface Note that programming directly to the registers is not supported over LAN Mapping Memory Space for Register Based Devices When using SICL to communicate directly to the device s registers you must map a memory space into your process space This can be done by using the SICL imap function imap id map_space pagestart pagecnt suggested This function maps space for the interface or device specified by the id parameter pagestart pagecnt and suggested are used to indicate the page number how many pages and a suggested starting location respectively map_space determine
269. resses for that space The default limits will be set so that the upper and lower one eighth of A24 and A32 space will not be allocated S The next argument contains the name of the program to use to print the VXI configuration This defaults to the ivxisc program The resource manager first accesses the configuration files as directed by the argument above It then determines resource and capability information from the VXI devices in the cardcage or multi cardcage hierarchy The resource manager then determines the proper configuration according to the rules defined by the configuration files and the standard VXI configuration methods It then sends appropriate commands to the VXI devices The configuration is optionally printed Finally the configuration information is stored in the rsrcmgr out file for use by other programs The rsrcemgr out file contains binary data not ASCII text In the case of multiframe extended VXI systems using VXI MXI bus extenders the resource manager will set up logical address windows A16 A24 A32 windows and interrupt routing registers prior to establishing the commander servant hierarchy and initiating normal operation 426 Appendix D Customizing your VXI MXI System ivxirm The VXI MXI configuration files specify the site dependent configuration rule changes See The VXI MXI Configuration Files earlier in this appendix for a description of the file contents Note ivxirmis normally run automaticall
270. rigroute id I TRIG _CLKO I TRIG EXT1 Turn off previous routing ivxitrigroute id I _TRIG_EXTO 0 ivxitrigroute id I _ TRIG _CLKO 0 Set up I_TRIG STD routing to TTLTRG1 and TTLTRG3 ivxitrigroute id I TRIG STD I TRIG TTL1 I TRIG TTL3 Fire the STD triggers ixtrig id I TRIG STD Close the vxi interface session iclose id 134 Chapter 6 Note Using SICL with VXI MXI Using i blockcopy for DMA Transfers Using i blockcopy for DMA Transfers VXI controllers can have the capability for block copy DMA transfers This can be done using the SICL i blockcopy functions Use the following process to access DMA transfers 1 Use the SICL imap function to map the desired VXIbus address 2 Use the SICL itimeout function to set up a timeout value 3 Use the SICL i blockcopy function to initiate the DMA transfer Note that the swap parameter is ignored The following example illustrates using ibblockcopy for a DMA transfer SICL does not support overlapped DMA transfers which means the i blockcopy functions will not return until the end of the DMA transfer blockcopy c This example demonstrates how to use i blockcopy to move data The SICL blockcopy routines will attempt to use DMA if one of the locations is A24 or A32 address space If neither location is in A24 or A32 space the data will be move in the normal fashion Usage blockcopy a lt symbolic name gt Re
271. rint the results printf Result is s n strres Close the multimeter session iclose dvm Chapter 3 53 Using SICL Using Asynchronous Events Using Asynchronous Events Asynchronous events are events that happen outside the control of your application These events include Service Requests SRQ and interrupts An SRQ is a notification that a device requires service Any device can generate an SRQ Both devices and interfaces can generate interrupts By default creating a session enables asynchronous events However the library will not report any events to the application until the appropriate handlers are installed in your program SRQ Handlers The ions rq function installs an SRQ handler The currently installed SRQ handler is called any time its corresponding device or interface generates an SRQ If an interface is unable to determine which device on the interface generated the SRQ all SRQ handlers assigned to that interface will be called Therefore an SRQ handler cannot assume that its corresponding device generated an SRQ The SRQ handler should use the ireadstb function to determine whether its device generated an SRQ If two or more sessions refer to the same device and have handlers installed the handlers for each of the sessions are called 54 Chapter3 Note Using SICL Using Asynchronous Events Interrupt Handlers Two distinct steps are required for an interrupt handler to be called First th
272. rm an operation on a device or interface that is locked by another session the call will hang until the device or interface is unlocked Calls to ilock iunlock may be nested meaning that there must be an equal number of unlocks for each lock This means that simply calling the iunlock function may not actually unlock a device or interface again For example note how the following C code locks and unlocks devices ilock id Device locked iunlock id Device unlocked ilock id Device locked ilock id Device locked iunlock id Device still locked iunlock id Device unlocked Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also ILOCK ISETLOCK WAIT IGETLOCK WAIT Chapter 10 361 SICL Language Reference IUNMAP IUNMAP Supported sessions 00005 device interface commander Note Not recommended for new program development Use UNMAPX instead C Syntax include lt sicl h gt int iunmap id addr map_space pagestart pagecnt INST id char addr int map_space unsigned int pagestart unsigned int pagecnt Note Not supported over LAN Description The iunmap function unmaps a mapped memory space The id specifies a VXI interface or device session The addr argument contains the address value returned from the imap call The pagestart argument indicates the pag
273. rocessing Chapter 10 289 SICL Language Reference IONERROR if igeterrno o CEC sgar Or using try recover escape include lt sicl h gt INST id void proc INST id int error Error occurred perform an escape escape id void xyzzy try Normal code lonerror proc Do actions that could cause errors pe a a iread 7 60 e4 ionerror 0 recover Error Code ionerror 0 do error processing if igeterrno CEC 2337 Return Value This function returns zero 0 if successful or a non zero error number if an error occurs See Also IGETONERROR IGETERRNO IGETERRSTR ICAUSEERR 290 Chapter 10 SICL Language Reference IONINTR IONINTR Supported sessions 00005 device interface commander C Syntax include lt sicl h gt int ionintr id proc INST id void proc id reason secval INST id long reason long secval Description The library can notify a process when an interrupt occurs by using the ionintr function This function installs the procedure proc as an interrupt handler After you install the interrupt handler with ionintr use the isetintr function to enable notification of the interrupt event or events The library calls the proc procedure whenever an enabled interrupt occurs It calls proc with the following parameters void proc id reason sec
274. rom the VXI device and the ivxisc utility uses that information and this file to print out the VXI device model If you add a new VXI device to your system that is not currently in this database you may want to add an entry to this file The dynamic cf Configuration File The dynamic cf file contains a list of VXI devices to be dynamically configured You only need to add entries to this file if you want to override the default dynamic configuration assignment by the resource manager Normally if you have a dynamically configurable device and the logical address is set at 255 the resource manager will assign the first available address However if a dynamically configurable device has an entry in this file the resource manager will assign the address listed in the file 414 Appendix D Customizing your VXI MXI System The VXI MXI Configuration Files The vmedev cf Configuration File The vmedev cf file contains a list of VME devices that use resources in the VXI cardcage Since the resource manager is unable to detect VME devices the resource manager uses this information to determine such things as the slot number where the VME device is located A16 A32 or A24 how much memory it uses and what interrupt lines it uses Additionally the resource manager verifies that multiple resources aren t allocated See Communicating with VME Devices in chapter 6 Using SICL with VXI MXI for more information on setting up VME devices in
275. ronously without any type of handshake It is intended for programs that implement their own handshake explicitly An igpiostat function from one process will proceed even if another process has a lock on the interface Ordinarily this does not alter or disrupt any hardware states Reading the data in lines is one exception A data read causes an input indication on the I O line pin 20 In rare cases that change might be unexpected or undesirable to the session that owns the lock The result is a mask representing the following information about the device and the interface State of the PSTS line State of the EIR line True if ready for a handshake Exact meaning depends on the current handshake mode True if auto handshake mode is enabled False if auto handshake mode is disabled 267 SICL Language Reference IGPIOSTAT I GPIO CHK PSTS I GPIO ENH MODE I GPIO READ EOI I GPIO STAT True if the PSTS line is to be checked before each block of data is transferred False if PSTS is to be ignored during data transfers True if the data ports are configured in Enhanced bi directional Mode False if the ports are configured in HP 98622 Compatibility Mode The result is the value of the current END pattern being used for read operations If the result is I GPIO _EOI_ NONE then no END pattern matching is being used Any other result is the value of the END pattern The result i
276. rrupt handler is called You must edit this program to specify starting address and register offset for your specific VME device include lt stdio h gt include lt stdlib h gt include lt sicl h gt define ADDR vxi void handler INST id long reason long secval printf Got the interrupt n void main unsigned short reg char base_ addr INST id install error handler ionerror I_ ERROR EXIT open an interface communications session id iopen ADDR itimeout id 10000 install interrupt handler ionintr id handler isetintr id I_INTR_VME IRQ1 1 turn interrupt notification off so that interrupts are not recognized before the iwaithdlr function is called lintroff map into user memory space base addr imap id I MAP A24 0x40 1 NULL 128 Chapter6 Using SICL with VXI MXI Communicating with VME Devices read a register reg iwpeek unsigned short base addr 0x00 print results printf The registers contents were as follows OxS4X n reg write to a register causing interrupt iwpoke unsigned short base addr 0x00 reg wait for interrupt iwaithdlr 10000 turn interrupt notification on intron Jz unmap memory space iunmap id base addr I MAP A24 0x40 1 close session iclose id Chapter 6 129 Using SICL with VXI MXI
277. s e Mapping VME Memory Reading and Writing to Device Registers Unmapping Memory Each of the above items are described in further detail in the following subsections An example program is also provided Chapter 6 121 E1482 VXI MXI Resources Using SICL with VXI MXI Communicating with VME Devices Declaring Resources The VXI Resource Manager does not reserve resources for VME devices Instead a configuration file is used to reserve resources for VME devices in a VXI system Use the etc opt sicl vxiLU vmedev cf where LU is the logical unit of the VXI MXI interface to reserve resources for VME devices The VXI Resource Manager reads this file to reserve the VME address space and VME IRQ lines The VXI Resource Manager then assigns the VXI devices around the already reserved VME resources When you edit the vmedev cf file you need to specify the device name bus slot address space starting offset size and VME IRQ line The following is an example entry vmedevl 0 12 A24 0x400000 0x10000 3 For VME devices requiring A16 address space the device s address space should be defined in the lower 75 of A16 address space addresses below 0xC000 This is necessary because the upper 25 of A16 address space is reserved for VXI devices For VME devices using A24 or A32 address space use A24 or A32 address ranges just higher than those used by your VXI devices To determine what A24 or A32 address ranges are used by your
278. s a character buffer the data is placed in the buffer The format string contains regular characters and special conversion sequences The iprintf function sends the regular characters not a character in the format string directly to the device Conversion specifications are introduced by the character Conversion specifications control the type the conversion and the formatting of the arg parameters The formatted I O functions iprintf and ipromptf can re address the bus multiple times during execution This behavior may cause problems with instruments which do not comply with IEEE 488 2 Re addressing occurs under the following circumstances e After the internal buffer fills See isetbuf e When a 3C is found in the format string This behavior affects only non IEEE 488 2 devices on the GPIB interface 302 Chapter 10 SICL Language Reference IPRINTF Use the special characters and conversion commands explained later in this section to create the format string s contents Special Special characters in C C consist of a backslash followed by another Characters for character The special characters are C C n r t HH v f Chapter 10 Send the ASCII LF character with the END indicator set Send the ASCII CR character Send the backslash character Send the ASCII TAB character Send the ASCII character specified by the octal value Send the ASCII VERTICAL TAB character Send
279. s a mask representing the state of all status lines The interface has two status lines so only the two least significant bits have meaning for that interface These can be represented by the following All other bits in the result mask are 0 zero I GPIO STAT STIOThe STIO line I GPIO STAT STI1The ST11 line Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIOCTRL IGPIOSETWIDTH 268 Chapter 10 IHINT Supported sessions SICL Language Reference IHINT Aen ee ge See ene device interface commander C Syntax include lt sicl h gt int ihint id hint INST id int hint Description There are three common ways a driver can implement I O communications Direct Memory Access DMA Polling POLL and Interrupt Driven INTR Note however that some systems may not implement all of these transfer methods The SICL software permits you to recommend your preferred method of communication To do this use the ihint function The Aint argument can be one of the following values I_ HINT DONTCARE I HINT USEDMA I HINT USEPOLL I HINT USEINTR I HINT SYSTEM I HINT IO No preference Use DMA if possible and feasible Otherwise use POLL Use POLL if possible and feasible Otherwise use DMA or INTR Use INTR if possible and feasible Otherwise use DMA or POLL The driver sho
280. s a pointer to the address string which was passed to the iopen call for the session id This function returns zero 0 if successful or a non zero error number if an error occurs TOPEN 226 Chapter 10 SICL Language Reference IGETDATA IGETDATA Supported sessions 005 device interface commander C Syntax include lt sicl h gt int igetdata id data INST id void data Description The igetdata function retrieves the pointer to the data structure stored by isetdata associated with a session The isetdata igetdata functions provide a good method of passing data to event handlers such as error interrupt or SRQ handlers For example you could set up a data structure in the main procedure and retrieve the same data structure in a handler routine You could set a device command string in this structure so that an error handler could re set the state of the device on errors Return Value This function returns zero 0 if successful or a non zero error number if an error occurs See Also ISETDATA Chapter 10 227 SICL Language Reference IGETDEVADDR IGETDEVADDR Supported sessions 00 0 cece eee eee een ene n eee device C Syntax include lt sicl h gt int igetdevaddr id prim sec INST id int prim int sec Description The igetdevaddr function returns the device address of the device associated with a given session This function returns the primary device
281. s which memory location to map the space The following are valid map_space choices I MAP A16 Maps in VXI A16 address space device or interface sessions 64K byte pages I MAP A24 Maps in VXI A24 address space device or interface sessions 64K byte pages I MAP A32 Maps in VXI A32 address space device or interface sessions 64K byte pages 112 Chapter 6 Using SICL with VXI MXI Communicating with VXI MXI Devices I MAP VXIDEV Maps in VXI A16 device registers device session only 64 bytes I MAP EXTEND Maps in VXI device extended memory address space in A24 or A32 address space device sessions only I MAP SHARED Maps in VXI MXI A24 A32 memory that is physically located on the computer sometimes called local shared memory interface sessions only I MAP AM address modifer Maps in the specified region address modifer of VME address space See the Communicating with VME Devices later in this chapter for more information on this map space argument T The following are example imap function calls Map to the VXI device vm starting at pagenumber 0 for 1 page base_address imap vm I MAP VXIDEV 0 1 NULL Map to A32 address space 16 Mbytes ptr imap id I MAP A32 0x000 0x100 NULL Map to A24 space while using E1489 8 Mbytes ptr imap id I MAP A24 0x00 0x80 NULL Map to a device s A24 or A32 extende
282. sage Error s lt options gt n progname printf t a lt addr gt tSICL address n exit 1 Chapter 6 137 Using SICL with VXI MXI Using VXI Specific Interrupts Using VXI Specific Interrupts See the isetintr function in Chapter 10 for a list of VXI MXI specific interrupts The following pseudo code describes the actions performed by SICL when a VME interrupt arrives and or a VXI signal register write occurs 138 Chapter6 Using SICL with VXI MXI Using VXI Specific Interrupts VME Interrupt arrives get lack value send I_INTR_ VME IRQ is VME IRQ line configured VME only if yes then exit do lower 8 bits match logical address of one of our servants if yes then lack is from one of our servants call servant signal processing iack else iack is from a non servant VXI device or VME device send I_INTR_VXI_VME interrupt to interface sessions Signal Register Write occurs get value written to signal register send I_INTR_ANY SIG do lower 8 bits match logical address of one of our servants if yes then Signal is from one of our servants call Servant signal processing value else Stray signal send I_INTR_VXI_UKNSIG to interface sessions servant signal processing signal value Value is form one of our servants is signal value a response signal If yes then process response signal exit Signal is an event signal is signal an RT or RF event if yes then A request
283. scanf with Certain Instruments The iscanf function cannot be used easily with instruments that do not send an END indicator Buffer Management with iscanf By default iscanf does not flush its internal buffer after each call This means data left from one call of iscanf can be read with the next call to iscanf One side effect of this is that successive calls to iscanf may yield unexpected results For example reading the following data Sho 2 ONENI SL 3 SNEIN 1 45 r n With iscanf id 1f amp resl Will read the 1 25 iscanf id 1f amp res2 Will read the r n iscanf id lf amp res3 Will read the 1 35 There are four ways to get the desired results Use the newline and carriage return characters at the end of the format string to match the input data This is the recommended approach For example iscanf id 1 r n amp resl iscanf id lf r n amp res2 iscanf id lf r n amp res3 Use isetbuf with a negative buffer size This will create a buffer the size of the absolute value of bufsize This also sets a flag that tells iscanf to flush its buffer after every iscanf call isetbuf id I BUF READ 128 320 Chapter 10 SICL Language Reference ISCANF Do explicit calls to iflush to flush the read buffer iscanf id 1f amp resl iflush id I BUF READ iscanf id 1lf amp res2 iflush
284. scope RST n iprintf scope autoscale n setup up the waveform source iprintf scope waveform format word n input waveform preamble to controller iprintf scope digitize channell n iprintf scope waveform preamble n iscanf scope 10f pre command scope to send data iprintf scope waveform data n 82 Chapter 4 Using SICL with GPIB Communicating with GPIB Interfaces enter the data count 5000 iscanf scope S wb n amp count readings printf received d words n count void massage data float vdiv float off float sdiv float delay char id_str 50 vdiv 32 pre 7 off 128 pre 9 pre 7 pre 8 sdiv pre 2 pre 4 10 delay pre 2 2 pre 6 pre 4 pre 5 retrieve the scope s ID string ipromptf scope IDN n s id str print the statistics about the data printf nOscilloscope ID s n id str PINCE T SSsaeSaSse Current settings s S s n printf Volts Div f V n vdiv printf Offset f V n off printf S Div Sf S n sdiv printf Delay sf S n delay void print data unsigned char status char cmd 5 tell the scope to SRQ on operation complete iprintf scope SRE 32 ESE 1 n tell the scope to print iprintf scope print OPC n Chapter 4 83 Using S
285. seeees 178 LAN Timeout Functions norena a n E 178 Default LAN Timeout Values 00 cccccesceescecseesseceeeseceeeeeneeeseensees 179 Timeout Configurations to Be Avoided cccccccsseetceteeeteeeseesees 182 Application Terminations and Timeouts eseseeeees seese seeeeeereeee 183 Using Signal Handling with LAN 00 0 ceccecceessesteceeeeeeeeseeeteeesseneenes 184 SIGIO Signals cccccccescesscesseeseceeceseeeeeeeseesecsaecnsceeeeeeeeeeeesenseeees 184 SIGPIPE Sietial ssc cscdij a i a n a a eaaa 185 Summary of LAN Specific Functions cecceescesseesceeteceteeeeeeseeenees 186 9 Troubleshooting Your SICL Program Installing an Error Handler ccccceceesceesceccecseeeseceeeceeeeeseecseenseeneeees 189 Looking at Error Codes and Messages c ccsccsssesscsteceteeeeeeeseeseeeeees 190 Troubleshooting SICL ccccecceeccesseesseeseceseceeeeeseeeseceseceseeeeeeeeeessenseenes 192 Compile and Link Errors ccccccceeccceseceseeeeeeeseeeseessecnsecneeeeneenseensees 192 Run time Erro Seseo eneren iana OE debe a T E OE 194 Troubleshooting SICL over LAN Client and Server seseeeseseeeee 195 SICL LAN Client Problems and Possible Solutions 0000000000 197 SICL LAN Server Problems and Possible Solutions 006 199 Troubleshooting SICL over RS 232 cccscesscstecesceeeeeseeesseeteeeteeneeeees 202 No Response from Instrument cccccccsccesceseceeeeesceesseeteceeeesneeeaes 202 RS
286. sesssesseseessesesseossssesseosesseseessesreseessesees 54 SRO Handlers nonae easee sas tees asta Mae Sedat Oh Se 54 Interrupt Handlers encsi ae a ea n aaa aa 55 Temporarily Disabling Enabling Asynchronous Events 55 Asynchronous Events and Unix Signals cccccccssesceeteeneesteensees 57 Interrupt Handler Example ccceccescceseeseeeseeseeesteeseeeeeeeseeeeeeseens 59 Using Error Handlers iiss ts cvesteasvesta tee setene a aE 61 Contents 7 Error Handler Example ccccccccsccessceseesseeecesecesecneeeseeeeeeeeeseenas 62 Using Ocha gy 2cd asteeacsinecccsteaecgut saves atezengs bi aecgadeacectty inedvs e a 64 DOCK A CHOMS oiiae ra banned tanta dase see a 65 Locking in a Multi user Environment ccececeeceeseeeeceeceeeeeeeeeeeees 66 Locking Examples sions olen ae ane E Ee 67 4 Using SICL with GPIB Creating a Communications Session with PD Bache scared cc ty ewe ce secede E A NE poles 71 Communicating with GPIB Devices cccecccesceeseeseeseeteceteeeseeseeensees 72 Addressing GPIB DevVices cccccecsesseeseceseceeeeeseeeseeeseseeeeeeeesaeesaees 72 SICL Function Support with GPIB Device Sessions ceee 74 GPIB Device Session Example ccccccecsceesecesceeeeeeseeseeeseceseeeseeenes 75 Communicating with GPIB Interfaces 0 cccccccecsceeseesteeeteeteeeseeeeeesees 77 Addressing GPIB Interfaces ccccecccssecssceeeceseeeteeeecneeneeeeneeesees 77 SIC
287. si coitus stendenstendurdctdvgsdendeausgnious snadesasneauntuendensscotapegen 329 ISERIA LC PRU e225 e Set ees E E se dastuict sxdoestugseret spueteaud viens eens 330 TSERTALMCOL CER eeii a deansis testa ecole Aa 334 ISERTALMCUSTA Treeren a a a a othe 335 ISERIALS TAT o aE E esate TA A A ERE 336 ISEFBU F eara a ea A T N E esieeatearadeevies 340 ISETDAT As 3 liii toi n A a A A ASE 342 SIDANE M EE E E E A E 343 ISEFLEOCK WAT os scs tn scisvssechisotshabesashets sshesscnatedencguazeniaeanet RO EAA 351 TSEVES TU Baicsceiecset leadaes astdeet io caedehesdisecsiadueasnadteategutedsounavessanguts ange sien iA 352 ISELUBUE EEEE EE lies auata that das onde evel cost rand tack sesh taawtaagess 353 TS WAP ratana eenei Eaa eaa n a aaa aa EE ES RE a 355 ITERMCHR civentinen eioten ons er a aE R A A ARAE 357 TMEO UT a a A A E E a 358 IFRIGGER aoi a n E E E AEE 359 IUNEOC RK ond aea E a EE E AR 361 MIN MUASP a E A A ES E A 362 TUNMAB YS oe a ia EAE TE OA EON ER REA ER ERNER 364 IVERSTON agree a a a Ea ea 365 TVXIBUSSTATU S E a a E EALE E EE VET 366 IVXIGETTRIGROUTE ertasi scseestesssestescsesscoessbosacevosssesensasncsvtensesnes 369 IVXIRMI FO rectoren RAE tents E 370 IVXISERVANTS na a a a AE A S 372 IV XITRIG OBB 2 8 ie hess A e A A EE E E 373 IVXITRIGON rarai aron taint daroa eaaa rae er eE E aE a 375 IVATTRIGR OU TE Artei eie e E EE E E 377 IV XIWATTNORMOP 5 n e e Aea E EE E EEEE Ea 379 IVXIWS eea e R NE E NA 380 IWAITHDE R ocssisadedseesdsdbaisd tove
288. sion interrupts that can be used See Session i setintr in Chapter 10 for information on the interface session interrupts Interrupts f sat 4 3 There are no device specific interrupts for the GPIB interface 78 Chapter 4 GPIB Interface Sessions and Service Requests Checking the Bus Status Using SICL with GPIB Communicating with GPIB Interfaces GPIB interface sessions support Service Requests SRQ On the GPIB interface when one device issues an SRQ the library will inform a GPIB interface sessions that have SRQ handlers installed See ionsrq in Chapter 10 It is good practice to ensure that a device isn t requesting service before leaving the SRQ handler The easiest technique for this is to service all devices from one handler GPIB Interface Session Examples The following example program is an ANSI C program that retrieves the GPIB interface bus status information and displays it for the user Chapter 4 79 Using SICL with GPIB Communicating with GPIB Interfaces hpibstatus c The following example retrieves and displays HPIB bus status information include lt stdio h gt finclude lt sicl h gt main INST id session id int rem remote enable a int srq service request nid int ndac not data accepted int sysctlr system controller int actctlr active controller int talker talker E int listener listener x7 int addr bus address 80
289. size int reason unsigned long actualcnt Description This function reads a block of data from the device via the formatted I O read buffer the same buffer used by iscanf The buf argument is a pointer to the location where the block of data can be stored The bufsize argument is an unsigned long integer containing the size in bytes of the buffer specified in buf The reason argument is a pointer to an integer that upon exiting ifread contains the reason why the read terminated If the reason parameter contains a zero 0 then no termination reason is returned The reason argument is a bit mask and one or more reasons can be returned Values for reason include I_ TERM MAXCNT bufsize characters read I TERM END END indicator received on last character I_TERM CHR Termination character enabled and received The actualcnt argument is a pointer to an unsigned long integer which upon exit contains the actual number of bytes read from the formatted I O read buffer If a termination condition occurs the i fread will terminate However if there is nothing in the formatted I O read buffer to terminate the read then ifread will read from the device fill the buffer again and so forth Chapter 10 223 Return Value See Also SICL Language Reference IFREAD This function obeys the itermchr termination character if any for the specified session The read terminates only on one of the following conditions
290. ss to read successive memory locations while writing to a single memory FIFO location Thus they can transfer entire blocks of data The id although specified is normally ignored except to determine an interface specific transfer mechanism such as DMA To prevent using an interface specific mechanism pass a zero 0 in this parameter The sre argument is the starting memory address for the source data The fifo argument is the memory address for the destination FIFO register data The cnt argument is the number of transfers bytes words or longwords to perform The swap argument is the byte swapping flag If swap is zero no Chapter 10 313 SICL Language Reference IPUSHFIFO swapping occurs If swap is non zero the function swaps bytes if necessary to change byte ordering from the internal format of the controller to from the VXI big endian byte ordering Note Ifa bus error occurs unexpected results may occur Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IPOPFIFO IPOKE IPEEK IMAP 314 Chapter 10 SICL Language Reference IREAD m Supported sessions n onanan device interface commander Affected by functions 00 0 0 00 eae ilock itimeout C Syntax include lt sicl h gt int iread id buf bufsize reason actualcnt INST id char buf unsigned long bufsize int reason
291. ssion to the SICL LAN server the first diagnostic to try is the ping utility This command allows you to test general network connectivity between your client and server machines Using ping might look something like the following gt ping instserv hp com PING instserv hp com 64 byte packets 64 bytes from 128 10 0 3 icmp seq 0 time 3 ms 64 bytes from 128 10 0 3 icmp seq l time 3 ms 64 bytes from 128 10 0 3 icmp seq 2 time 2 ms Where each line after the PING line is an example of a packet successfully reaching the server If after several seconds ping does not print any lines use CTRL C to kill ping ping will report on what it found instserv hp com PING Statistics 4 packets transmitted 0 packets received 100 packet loss This indicates that the client was unable to contact the server In this situation you should contact your network administrator to determine what is wrong with the LAN Once the LAN problem has been corrected you can then retry your SICL LAN application See the ping 1M man page for more information Chapter 9 195 Troubleshooting Your SICL Program Troubleshooting SICL over LAN Client and Server e Another tool which can be used to determine where a problem might reside is rpcinfo Note that rpcinfo resides under the usr bin directory on HP UX 11i or usr sbin on Linux This tool tests whether a client can make an RPC call to a server The first rpcinfo option to try is p which w
292. ssumes the data is in big endian byte ordering big endian byte ordering is where the most significant byte of data is stored at the least significant address and converts the data to whatever byte ordering is native on this controller s architecture Or it takes the data that is byte ordered for this controller s architecture and converts the data to big endian byte ordering Notice that these two conversions are identical The ileswap function assumes the data is in little endian byte ordering little endian byte ordering is where the most significant byte of data is stored at the most significant address and converts the data to whatever byte ordering is native on this controller s architecture Or it takes the data that is byte ordered for this controller s architecture and converts the data to little endian byte ordering Notice that these two conversions are identical Depending on the native byte ordering of the controller in use either little endian or big endian that either the ibeswap or ileswap functions will always be a no op and the other will always swap bytes as appropriate Chapter 10 355 Note Return Value See Also SICL Language Reference ISWAP In all three functions the addr parameter specifies a pointer to the data The length parameter provides the length of the data in bytes The datasize must be one of the values 1 2 4 or 8 It specifies the size of the data in bytes and the size of the
293. st be a pointer to a short integer for C C i Corresponding arg must be a pointer to an integer in C C The library reads characters until an entire number is read If the number has a leading zero 0 the number will be converted as an octal number If the data has a leading 0x or 0X the number will be converted as a hexadecimal number If the 1 ell argument modifier is used the argument must be a pointer to a long integer in C C If the h argument modifier is used the argument must be a pointer to a short integer for C C f Corresponding arg must be a pointer to a float in C C The library reads characters until an entire number is read It will convert IEEE 488 2 HEX OCT BIN and NRf format numbers If the 1 ell argument modifier is used the argument must be a pointer to a double for C C If the L argument modifier is used the argument must be a pointer to a long double for C C e g Corresponding arg must be a pointer to a float for C C The library reads characters until an entire number is read If the 1 ell argument modifier is used the argument must be a pointer to a double for C C If the L argument modifier is used the argument must be a pointer to a long double for C C 324 Chapter 10 SICL Language Reference ISCANF ic Corresponding arg is a pointer to a character sequence for C C Reads the number of characters specified by field width default is 1 from the device into the buffer poi
294. stees 105 Register Based Devices ccccccecscessecsscessceeseeseecssenseceseenseeeseesseesaees 109 Communicating with VXI MXI Interfaces cceececeseeeeeeeteetecneeees 118 Addressing VXI MXI Interface Sessions cscesceeseeeceteeseeneeeeees 118 VXI MXI Interface Session Example cccccscesseeseeseceeeeeeeneees 120 Communicating with VME DeVIces cccccssecseesteceteeeeeeteeesseeneeeteeenes 121 Declaring Resources visie rtin enti A etait andnntn 122 Mapping VME Memory ccccecscssecssceesceeeeeseeeeesseceeeeeeeeeeesaeessees 123 Reading and Writing to the Device Registers 0 cceeeseseeeeeeeees 125 Unmapping Memory Space cccccccccscesceseeesseeseesecsecneeeseeeeseenaes 125 MME Interrufpts 33 cecs d zeancsssesveed noa e ta i T R oiie 125 VME Example aon a aaeain aaa a a a aiana a 126 Looking at SICL Function Support with VXI MXI 00 ecceeeeseeeeees 130 DEVICE SESSIONS aurie Gavten ees a cab ade tenet alae alain t lh nas hanes 130 Interface SESSIONS ornis na t a aa aaa i 131 Using SICL Trigger Lines 0 cccccecccceseeeseeecseseeeneecnecsseeeeeeeeeessenseenes 132 Using i blockcopy for DMA Transfers c cccccscecsseeseeeeeenseseeseeees 135 Using VXI Specific Interrupts cccecccescceseesceeseceeceeeeeeeeeseeeseeeaeenes 138 Processing VME Interrupts Example cccccccescessceereeeeesteeeees 140 Summary of VXI MXI Specific FUnctions cccccceesesseeseceeeeeeeeesees 141
295. strument followed by the newline character n Note that this will work only if the instrument supports this command iclear Sends a break aborts any pending writes discards any data in the receive buffer resets any flow control states such as XON XOFF and resets any error conditions To reset the interface without sending a break use the following function iserialctrl id I SERIAL RESET 0 ionsrq Installs a service request handler for this session Service requests are supported for both device sessions and interface sessions See the section titled SICL Function Support for RS 232 Interface Sessions later in this chapter RS 232 Device There are specific device session interrupts that can be used See Session jsetintr in Chapter 10 for information on the device session interrupts Interrupts for RS 232 148 Chapter 7 Using SICL with RS 232 Communicating with RS 232 Devices RS 232 Device Session Example serialdev c This example program takes a measurement from a DVM using a SICL device session include lt sicl h gt include lt stdio h gt finclude lt stdlib h gt main INST dvm double res Log message and terminate on error ionerror I_ ERROR EXIT Open the multimeter session dvm iopen COM1 488 itimeout dvm 10000 Reset the multimeter iprintf dvm RST n iprintf dvm SYST REM n Take a measurement i
296. t error producing mode is enabled Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also ILOCK IUNLOCK ISETLOCK WAIT Chapter 10 235 C Syntax Description Return Value See Also SICL Language Reference IGETLU IGETLU Supported sessions 00005 device interface commander include lt sicl h gt int igetlu id lu INST id int lu The iget1u function returns in u the logical unit interface address of the device or interface associated with a given session id For C programs this function returns zero 0 if successful or a non zero error number if an error occurs TOPEN IGETLUINFO 236 Chapter 10 C Syntax Description Return Value See Also SICL Language Reference IGETLUINFO IGETLUINFO finclude lt sicl h gt int igetluinfo lu luinfo int lu struct lu_info luinfo The igetluinfo function is used to get information about the interface associated with the u logical unit For C programs the u_info structure has the following syntax struct lu info long logical_unit same as value passed into igetluinfo char symname 32 symbolic name assigned to interface char cardname 32 name of interface card long intftype same value returned by igetintftype x Notice that in a given implementation the exact structure and
297. t match the logical unit orsymbolic name specified in the system configuration Other possible interface names are GPIB gpib HPIB EEE4 88 etc Chapter 4 77 Using SICL with GPIB Communicating with GPIB Interfaces The following example opens a interface session with the GPIB interface INST hpib hpib iopen hpib SICL Function Support with GPIB Interface Sessions The following describes how some SICL functions are implemented for GPIB interface sessions iwrite Sends the specified bytes directly to the interface without performing any bus addressing The iwrite function always clears the ATN line before sending any bytes thus ensuring that the GPIB interface sends the bytes as data not command bytes iread Reads the data directly from the interface without performing any bus addressing itrigger Performs a GPIB group execute trigger GET without additional addressing This function should be used with the igpibsendcmd to send an UNL followed by the device addresses This will allow the itrigger function to be used to trigger multiple GPIB devices simultaneously Passing the I TRIG STD value to the ixtrig routine also causes a broadcast GPIB group execute trigger GET There are no other valid values for the ixtrig function iclear Performs a GPIB interface clear pulses IFC and REN which resets the interface GPIB Interface There are specific interface ses
298. t need to rebuild the kernel for changes to take effect Chapter 8 181 Using SICL with LAN Using Timeouts with LAN Timeout Configurations to Be Avoided The LAN timeout used by the client should always be set greater than the SICL timeout used by the server This avoids the situation where the client times out while the server continues to attempt the request potentially holding off subsequent operations from the same client This also avoids having the server send unwanted replies to the client The SICL timeout used by the server should generally be less than infinity Having the LAN server wait less than forever allows the LAN server to detect clients that have died abruptly or network problems and subsequently release resources associated with those clients such as locks Using the smallest possible value for your application will maximize the server s responsiveness to dropped connections including the client application being terminated abnormally Using a value less than infinity is made easy for application developers due to the Server Timeout configuration value in the LAN interface configuration Even if your application uses the SICL default of infinity or if it imeout is used to set the timeout to infinity by setting the Server Timeout value to some reasonable number of seconds the server will be allowed to timeout and detect network trouble if it has occurred and release resources Note that another way to ensure that th
299. t will be masked off and the result will be placed into the buffer I SERIAL RESET This will reset the serial interface The following actions will occur any pending writes will be aborted the data in the input buffer will be discarded and any error conditions will be reset This differs from iclear in that no BREAK will be sent Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also ISERIALSTAT Chapter 10 333 C Syntax Description Return Value See Also SICL Language Reference ISERIALMCLCTRL ISERIALMCLCTRL Supported sessions 00 0 cece cece ene interface Affected by functions 000 00 eee ilock itimeout include lt sicl h gt int iserialmclctrl id sline state INST id int sline int state The iserialmclctrl function is used to control the Modem Control Lines The s ine parameter sends one of the following values I S E S ERIA ERIA RTSReady To Send line DTRData Terminal Ready line If the state value is non zero the Modem Control Line will be asserted otherwise it will be cleared For C programs this function returns zero 0 if successful or a non zero error number if an error occurs TISERIALMCLSTAT IONINTR ISETINTR 334 Chapter 10 SICL Language Reference ISERIALMCLSTAT ey ISER
300. ta may be read until an END indicator is read Chapter 10 325 SICL Language Reference ISCANF 326 The field width must be present to specify the maximum number of elements the buffer can hold For C C programs the field width can be a pound sign If the field width is a pound sign then two arguments are used to fulfill this conversion type The first argument is a pointer to a long that will be used as the field width The second will be the pointer to the buffer that will hold the data After this conversion is satisfied the field width pointer is assigned the number of elements read into the buffer This is a convenient way to determine the actual number of elements read into the buffer If there is more data than will fit into the buffer the extra data is lost If no argument modifier is specified the array is assumed to be an array of bytes If the w argument modifier is specified then the array is assumed to be an array of short integers 16 bits The data read from the device is byte swapped and padded as necessary to convert from IEEE 488 2 byte ordering big endian to the native ordering of the controller The field width is the number of words If the 1 ell argument modifier is specified then the array is assumed to be an array of long integers 32 bits The data read from the device is byte swapped and padded as necessary to convert from IEEE 488 2 byte ordering big endian to the native ordering of t
301. ted by functions 00 0 0 0 00 ee ilock itimeout C Syntax include lt sicl h gt int igpibgettldelay id delay INST id int delay Description This function retrieves the current setting of t1 delay on the GPIB interface associated with session id The value returned is the time of t1 delay in nanoseconds Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IGPIBSETT1DELAY Chapter 10 249 SICL Language Reference IGPIBLLO IGPIBLLO Supported sessions 0 cece eee eee eee eens interface Affected by functions 00 00 0000 eee ilock itimeout C Syntax include lt sicl h gt int igpibllo id INST id Description The igpibllo function puts all GPIB devices on the given bus in local lockout mode The id specifies a GPIB interface session This function sends the GPIB LLO command to all devices connected to the specified GPIB interface Local Lockout prevents you from returning to local mode by pressing a device s front panel keys Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IREMOTE ILOCAL 250 Chapter 10 SICL Language Reference IGPIBPASSCTL IGPIBPASSCTL Supported sessions 0 eee eee eee eens interface Affected by functions 00 0 0 00 000 ilock itimeout C Syntax in
302. ter is zero 0 then all handles must be zero and all offsets must be either local memory or directly dereferencable VXI pointers The svc_handle argument is the starting memory address for the source data The dest_handle argument is the starting memory address for the destination data These handles must either be valid handles returned from the imapx function indicating valid VXI memory or zero 0 indicating local memory Both src_width and dest_width must be the same value they specify the width in number of bits of the data Specify them as 8 16 or 32 Offset values src_offset and dest_offset are generally used in memory transfers to specify memory locations The increment parameters specify whether or not to increment memory addresses The cnt argument is the number of transfers bytes words or long words to perform The swap argument is the byte swapping flag If swap is zero no swapping occurs If swap is non zero the function swaps bytes if necessary to change byte ordering from the internal format of the controller to from the VXI big endian byte ordering If a bus error occurs unexpected results may occur For C programs this function returns zero 0 if successful or a non zero error number if an error occurs IPEEKX8 IPEEKX16 IPEEK X32 IPOKEX8 IPOKEX16 IPOKEX32 IPOPFIFO IPUSHFIFO IDEREFPTR 216 Chapter 10 SICL Language Reference ICAUSEERR ICAUSEERR Supported sess
303. terface specific interrupts for the RS 232 interface are I INTR SERIAL MSL This interrupt occurs whenever one of the specified modem status lines changes states The secval argument in ionintr is the logical OR of the Modem Status Lines to monitor In the interrupt handler the sec argument will be the logical OR of the MSL line s that caused the interrupt handler to be invoked Note that most implementations of the ring indicator interrupt only deliver the interrupt when the state goes from high to low that is a trailing edge This differs from the other MSLs in that it s not simply just a state change that causes the interrupts The status lines that can cause this interrupt are DCD CTS DSR and RI Chapter 10 347 SICL Language Reference ISETINTR I_INTR_ SERIAL BREAK I_INTR_ SERIAL ERROR I INTR SERIAL DAV I INTR SERIAL TEMT This interrupt occurs whenever a BREAK is received This interrupt occurs whenever a parity overflow or framing error happens The secval argument in ionintr is the logical OR of one or more of the following values to enable the appropriate interrupt In the interrupt handler the sec argument will be the logical OR of these values that indicate which error s occurred I SERIAL PARERR Parity Error I SERIAL OVERFLOW Buffer Overflow Error I SERIAL FRAMING Framing Error This interrupt occurs whenever the rec
304. terrupter Name 1234567 1234567 v700ctlir X X X X X XK X vximxi hpvximxi pwrmeter dev1 dvm VXI MXI IRQ Routing Name T o2 3 A 5 67 vximxi hpvximxi I MXI gt VXI O VXI gt MXI Not Routed OH OH OH OH OH OH O VXI MXI Registers Name vximxi laddr window register 0x5b80 range 128 159 a24 window register disabled a32 window register disabled Interrupt Configuration Register 0x7f7f hpvximxi laddr window register 0x7b80 range 128 159 a24 window register disabled a32 window register disabled Interrupt Configuration Register 0x7f00 Appendix D 431 Customizing your VXI MXI System ivxisc 432 Appendix D Customizing your VXI MXI System ivxisc Appendix D 433 Customizing your VXI MXI System ivxisc 434 Appendix D Glossary Glossary address A string uniquely identifying a particular interface or a device on that interface bus error An action that occurs when access to a given address fails either because no register exists at the given address or the register at the address refuses to respond bus error handler Programming code executed when a bus error occurs commander session A session that communicates to the controller of this bus controller A computer used to communicate with a remote device such as an instrument In the communications between the controller and the device the controller is in charge of and controls the flow of communication that is d
305. than the drivers Need to update drivers Chapter 9 191 Troubleshooting Your SICL Program Troubleshooting SICL Troubleshooting SICL When using SICL you typically have to go through a compile link process and then run the program You can get errors in either of these steps This section is divided into two subsections e Compile and Link Errors e Run time Errors Compile and Link Errors Compile Errors You get a list of errors where the compiler doesn t recognize SICL symbols Unexpected For example CC CC CC CC symbol example example example example for c line 12 error 1000 Unexpected symbol id c line 12 error 1573 Type of id is undefined c Crs line 16 error 1588 I ERROR EXIT undefined line 19 error 1549 Modifiable lvalue required assignment operator Possible Solution This error indicates that some of the SICL declarations are undefined during the compile process Check to make sure you added the sicl h header file Use the include command at the beginning of your program followed by the sicl h header file See Compiling and Linking an SICL Program in Chapter 2 for more information 192 Chapter9 Link Errors Unsatisfied symbols Compile Link Error Undefined id Troubleshooting Your SICL Program Troubleshooting SICL The linker doesn t recognize the SICL function calls For example bin ld Unsatisfied symbols I_BRROR_EX
306. the LAN software These values are used by the software to calculate timeout values if the application has not previously called ilantimeout Server Timeout Client Timeout Delta imeout value passed to the server when an application either uses the SICL default timeout value of infinity or sets the SICL timeout to infinity 0 Value specifies the number of seconds the server will wait for the operation to complete before returning I_ERR_ TIMEOUT A value of 0 in this field will cause the server to be sent a value of infinity if the client application also uses the SICL default timeout value of infinity or sets the SICL timeout to infinity 0 Value added to the SICL timeout value server s timeout value to determine the LAN timeout value client s timeout value Value specifies the number of seconds See the V O Libraries Installation and Configuration Guide for information on setting these values Chapter 8 179 Note Using SICL with LAN Using Timeouts with LAN Once ilantimeout is called the software no longer sends the server timeout to the server and no longer attempts to determine a reasonable client side timeout It is assumed that the application itself wants full control of timeouts both client and server Also note that i Lantimeout is per process That is all sessions which are going out over the network are affected when ilantimeout is called If the application has not called the
307. then formats a string using the writefmt string and the first n arguments necessary to implement the prompt string The write buffer is then flushed to the device It then uses the readfmt string to read data from the device and to format it appropriately The writefmt string is identical to the format string used for the iprintf function The readfmt string is identical to the format string used for the iscanf function It uses the arguments immediately following those needed to satisfy the writefmt string This function returns the total number of arguments used by both the read and write format strings TIPRINTF ISCANF IFLUSH ISETBUP ISETUBUF TFREAD IFWRITE 312 Chapter 10 SICL Language Reference IPUSHFIFO IPUSHFIFO C Syntax include lt sicl h gt int ibpushfifo id src fifo cnt INST id unsigned char src unsigned char fifo unsigned long cnt int iwpushfifo id src fifo cnt swap INST id unsigned short src unsigned short fifo unsigned long cnt int swap int ilpushfifo id src fifo cnt swap INST id unsigned long src unsigned long fifo unsigned long cnt int swap Note Not supported over LAN Description The i pushfifo functions copy data from memory on one device to a FIFO on another device Use b for byte w for word and 1 for long word 8 bit 16 bit and 32 bit respectively These functions increment the read addre
308. ticular device or set of devices However as explained in the previous section Using Locking remember that an interface session can access a device locked from a device session In general it is not friendly behavior to lock a device at the beginning of an application and unlock it at the end This can result in deadlock or long waits by others who want to use the resource The recommended way to use locking is per transaction Per transaction means that you lock before you setup the device then unlock after all the desired data has been acquired When sharing a device you cannot assume the state of the device so the beginning of each transaction should have any setup needed to configure the device or devices to be used 66 Chapter3 Using SICL Using Locking Locking Example The following example show how device locking can be used to grant exclusive access to a device by an application This example uses an HP Agilent 34401 Multimeter locking c This example shows how device locking can be used to grant exclusive access to a device include lt sicl h gt include lt stdio h gt main INST dvm char strres 20 Print message and terminate on error ionerror I_ERROR_ EXIT Open the multimeter session dvm iopen hpib 16 itimeout dvm 10000 Lock the multimeter device to prevent access from other applications ilock dvm Take a measurement iwrite dv
309. ting with RS 232 Interfaces RS 232 Interface Session Example serialintf c This program does the following 1 gets the current configuration of the serial port 2 sets it to 9600 baud no parity 8 data bits and 1 stop bit and 3 Prints the old configuration include lt stdio h gt finclude lt sicl h gt main INST intf interface session id unsigned long baudrate parity databits stopbits char parity str Log message and exit program on error ionerror I_ERROR_ EXIT open RS 232 interface session intf iopen COM1 itimeout intf 10000 get baud rate parity data bits and stop bits iserialstat intf I SERIAL BAUD amp baudrate iserialstat intf I SERIAL PARITY amp parity iserialstat intf I SERIAL WIDTH amp databits iserialstat intf I SERIAL STOP amp stopbits determine string to display for parity if parity I SERIAL PAR NONE parity str NONE else if parity I else if parity I I I S _ SERIAL PAR ODD parity str ODD _ SERIAL PAR EVEN parity str EVEN __ SERIAL PAR MARK parity str MARK SERIAL PAR SPACE else if parity else parity parity str SPACE 154 Chapter 7 Using SICL with RS 232 Communicating with RS 232 Interfaces set to 9600 NONE 8 iserialctrl intf I SERIAL BAUD 96
310. tions are described as follows e The iread function reads raw data from the device or interface specified by the id parameter and stores the results in the location where buf is pointing iread id buf bufsize reason actualcnt e The iwrite function sends the data pointed to by buf to the interface or device specified by the id parameter iwrite id buf datalen end actualcnt See Chapter 10 for more information on these functions 52 Chapter3 Using SICL Sending I O Commands Non formatted The following example illustrates using non formatted I O to communicate I O Example with a Multimeter over the GPIB interface The SICL non formatted I O functions iwrite and iread are used for the communication A similar example is used to illustrate formatted I O later in this chapter nonformatio c This example program measures AC voltage on a multimeter and prints out the results include lt sicl h gt include lt stdio h gt main INST dvm char strres 20 Print message and terminate on error ionerror I_ ERROR EXIT Open the multimeter session dvm iopen hpib 16 itimeout dvm 10000 Initialize dvm iwrite dvm RST n 5 1 NULL Set up multimeter and take measurement iwrite dvm CALC DBM REF 50 n 16 1 NULL iwrite dvm MEAS VOLT AC 1 0 001 n 23 1 NULL Read measurements iread dvm strres 20 NULL NULL P
311. to a IEEE 488 2 NR3 number H Converts to a IEEE 488 2 hexadecimal number Q Converts to a IEEE 488 2 octal number B Converts to a IEEE 488 2 binary number Prefixes number with sign or Left justifies result space Prefixes number with blank space if positive or with if negative Use alternate form For o conversion print a leading zero For x or X a nonzero will have Ox or OX as a prefix For e E f g or G the result will always have one digit on the right of the decimal point 0 Causes the left pad character to be a zero for all numeric conversion types The following example converts numb into a IEEE 488 2 floating point number NR2 and sends it to the session specified by id int numb 61 iprintf id s 2d numb Sends 61 000000 44 Chapter3 Using SICL Sending I O Commands Field Width Field width is an optional integer that specifies the minimum number of characters in the field If the formatted data has fewer characters than specified in the field width it will be padded The padded character is dependent on various flags You can use an asterisk in place of the integer to indicate that the integer is taken from the next argument The following example pads numb to six characters and sends it to the session specified by id int numb 61 iprintf id 6d numb Inserts four characters for a total of six characters 61 Precision Precision is an optional intege
312. trigger lines and leaves them deactivated The which parameter uses all of the same values as the ixtrig command namely I TRIG ALL I TRIG TT I TRIG TT I TRIG TT I TRIG TT I TRIG TT I TRIG TT I TRIG TT I TRIG TT I TRIG EC LO Tk L2 3 L4 L5 L6 L7 I TRIG EC I TRIG EC I TRIG EC Chapter 10 All standard triggers for this interface that is the bitwise OR ofall valid triggers TTL Trigger Line 0 TTL Trigger Line 1 TTL Trigger Line 2 TTL Trigger Line 3 TTL Trigger Line 4 TTL Trigger Line 5 TTL Trigger Line 6 TTL Trigger Line 7 ECL Trigger Line 0 ECL Trigger Line 1 ECL Trigger Line 2 ECL Trigger Line 3 373 Note Return Value See Also SICL Language Reference IVXITRIGOFF I TRIG EXTO External BNC or SMB Trigger Connector 0 I TRIG EXT1 External BNC or SMB Trigger Connector 1 Any combination of values may be used in which by performing a bit wise OR of the desired values To simply fire trigger lines assert then de assert the lines use ixtrig instead of ivxitrigon and ivxitrigoff For C programs this function returns zero 0 if successful or a non zero error numb er if an error occurs TVXITRIGON IVXITRIGROUTE IV XIGETTRIGROUTE IXTRIG 374 Chapter 10 SICL Language Reference IVXITRIGON es IVXITRIGON Supported sessions 0 0 0 0 cece eee eee eens interface Affected by functions 00 0 0
313. ts will be converted The letter e will be used with e and the letter E will be used with E g G Corresponding arg is a double in C C The argument is converted to exponential e with g or E with G or floating point format depending on the value of the arg and the precision The exponential style will be used if the resulting exponent is less than 4 or greater than the precision otherwise it will be printed as a float n Corresponding arg is a pointer to an integer in C C The number of bytes written to the device for the entire iprintf call is written to the arg No argument is converted F Corresponding arg is a pointer to a FILE descriptor The data will be read from the file that the FILE descriptor points to and written to the device The FILE descriptor must be opened for reading No flags or modifiers are allowed with this conversion character Return Value This function returns the total number of arguments converted by the format string 310 Chapter 10 Buffers and Errors See Also SICL Language Reference IPRINTF Since iprintf does not return an error code and data is buffered before it is sent it cannot be assumed that the device received any data after the iprintf has completed The best way to detect errors is to install your own error handler This handler can decide the best action to take depending on the error that has occurred If an error has occurred during an iprintf with no error handler inst
314. turn Value none include lt stdio h gt include lt stdlib h gt finclude lt unistd h gt Chapter 6 135 Using SICL with VXI MXI Using i blockcopy for DMA Transfers finclude lt sicl h gt extern char optarg static void error usage const char main int argc char argv long o INST id static char a24 buf static char shr_ buf unsigned long bufsize 1024 2 char addr NULL while o getopt argc argv a b i n EOF switch o case a addr optarg break default error usage argv 0 break if addr NULL error usage argv 0 ionerror I ERROR _NO EXIT id iopen addr shr buf imap id I MAP SHARED 0 0 0 a24 buf imap id I MAP A24 0x20 0x8 0 printf Shared memory to A24 D16 n n iwblockcopy id unsigned short shr buf unsigned short a24 buf bufsize 0 printf A24 to Shared memory D16 n n iwblockcopy id unsigned short a24 buf 136 Chapter 6 Using SICL with VXI MXI Using i blockcopy for DMA Transfers unsigned short shr buf ld v 1 0 printf Shared memory to A24 D32 n n ilblockcopy id unsigned long shr buf unsigned long a24 buf bufsize 0 3 printf A24 to Shared memory D32 n n ilblockcopy id unsigned long a24 buf unsigned long shr buf bufsize 0 z static void error usage const char progname printf U
315. uct sigaction oldact Handler called when there s a bus error It prints an error message and exits static void be handler int fprintf stderr ERROR Bus Error n exit 1 Function to catch the bus error void catch buserror struct sigaction newact Assign be handler to be called when action is to be taken newact sa_ handler void be handler Assign SIGBUS as signal to be caught Sigemptyset amp newact sa_mask Sigaddset amp amp newact sa_mask SIGBUS Set sa_flags to 0 newact sa_flags 0 Sigaction SIGBUS amp newact amp oldact Function to release bus error void uncatch_ buserror Sigaction SIGBUS amp oldact 0 Chapter 6 117 Note Using SICL with VXI MXI Communicating with VXI MXI Interfaces Communicating with VXI MXI Interfaces Interface sessions allow you direct low level control of the interface You must do all the bus maintenance for the interface This also implies that you have considerable knowledge of the interface Additionally when using interface sessions you need to use interface specific functions The use of these functions means that the program can not be used on other interfaces and therefore becomes less portable Addressing VXI MXI Interface Sessions To create an interface session on your VXI MXI system specify either the interface symbolic name or logical unit in t
316. uct vxiinfo The function fills in the structure with the relevant data The structure struct vxiinfo defined in the file sici n is listed on the following pages For C programs the vxiinfo structure has the following syntax struct vxiinfo Device Identification short laddr Logical Address char name 16 Symbolic Name primary char manuf name 16 Manufacturer Name char model name 16 Model Name unsigned short man _id Manufacturer ID unsigned short model Model Number unsigned short devclass Device Class Self Test Status short selftest 1 PASSED O FAILED Location of Device short cage_num Card Cage Number short slot Slot 1 is unknown 2 is MXI Device Information unsigned short protocol Value of protocol register xy unsigned short x protocol Value from Read Protocol 370 Chapter 10 SICL Language Reference IVXIRMINFO command unsigned short servant_area Value of servant area Memory Information page size is 256 bytes for A24 and 64K bytes for A32 unsigned short addrspace 24 A24 32 A32 O none unsigned short memsize Amount of memory in pages unsigned short memstart Start of memory in pages Misc Information short slot0_laddr LU of slot 0 device 1 if unknown i short cmdr_laddr LU of commander 1 if top level Interrupt Inf
317. uld use whatever mechanism is best suited for improving overall system performance The driver should use whatever mechanism is best suited for improving I O performance Keep the following in mind as you make your suggestions to the driver Chapter 10 269 Note Return Value SICL Language Reference IHINT DMA tends to be very fast at sending data but requires more time to set up a transfer It is best for sending large amounts of data in a single request Not all architectures and interfaces support DMA Polling tends to be fast at sending data and has a small set up time However if the interface only accepts data at a slow rate polling wastes a lot of CPU time Polling is best for sending smaller amounts of data to fast interfaces Interrupt driven transfers tend to be slower than polling It also has a small set up time The advantage to interrupts is that the CPU can perform other functions while waiting for data transfers to complete This mechanism is best for sending small to medium amounts of data to slow interfaces or interfaces with an inconsistent speed The parameter passed in ihint is only a suggestion to the driver software The driver will still make its own determination of which technique it will use The choice has no effect on the operation of any intrinsics just on the performance characteristics of that operation For C programs this function returns zero 0 if successful or a non zero error number
318. unctions to send and receive data This example opens an GPIB communications session with a Multimeter and sends a comma operator to send a comma separated list to the Multimeter The 1 conversion characters are then used to receive a double back from the Multimeter formatio c This example program makes a multimeter measurement with a comma separated list passed with formatted I O and prints the results include lt sicl h gt include lt stdio h gt main INST dvm double res double list 2 1 0 001 char buf 80 Print message and terminate on error ionerror I_ ERROR EXIT Open the multimeter session dvm iopen hpib 16 itimeout dvm 10000 Initialize dvm iprintf dvm RST n Set up multimeter and send comma separated list iprintf dvm CALC DBM REF 50 n iprintf dvm MEAS VOLT AC 21f n list Read the results iscanf dvm Slf amp xres Print the results printf Result is f n res Close the multimeter session iclose dvm Chapter 3 49 Format String Formatted I O Buffers Using SICL Sending I O Commands The format string for iprintf puts a special meaning on the newline character n The newline character in the format string flushes the output buffer All characters in the output buffer will be written with an END indicator included with the last byte the newline character This me
319. used to send a BREAK on the interface specified by id Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs Chapter 10 329 SICL Language Reference ISERIALCTRL ISERIALCTRL Supported sessions 2 0 0 0 cece cece een eens interface Affected by functions 0 0 0 00a ee ilock itimeout C Syntax include lt sicl h gt int iserialctrl id request setting INST id int request unsigned long setting Description The iserialctr1 function is used to set up the serial interface for data exchange This function takes request one of the following values and sets the interface to the setting The following are valid values for request I SERIAL BAUD The setting parameter will be the new speed of the interface The value should be a valid baud rate for the interface for example 300 1200 9600 The baud rate is represented as an unsigned long integer in bits per second If the value is not a recognizable baud rate an err_param error is returned The following are the supported baud rates 50 110 300 600 1200 2400 4800 7200 9600 19200 38400 and 57600 I_ SERIAL PARITY The following values are acceptable values for setting I SERIAL PAR_EVEN Even parity I SERIAL PAR_ODD Odd parity I_ SERIAL PAR_NONE No parity bit is used I_ SERIAL PAR MARK Parity is always one I SERIAL PAR_SPA
320. ust be specified using igpioctrl See Chapter 10 for details With 16 bit data widths only the low least significant byte is used Provides a method of triggering using either the CTLO or CTL1 control lines This function pulses the specified control line for approximately 1 microsecond The following constants are defined TRIG_STD Pulse CTLO line _ TRIG_GPIO_CTLO Pulse CTLO line _ TRIG_GPIO_CTL1 Pulse CTL1 line Same as ixtrig I_ TRIG STD Pulses the CTLO control line Pulses the P_RESET line for approximately 12 microseconds aborts any pending writes discards any data in the receive buffer and resets any error conditions Optionally clears the Data Out port depending upon the mode configuration specified during the SICL configuration 93 Using SICL with GPIO Communicating with GPIO Interfaces ilonsrq ireadstb Installs a service request handler for this session The concept of service request SRQ originates from GPIB On an GPIB interface a device can request service from the controller by asserting a line on the interface bus On GPIO the EIR line is assumed to be the service request line Chapter 10 says that ireadstb is for device sessions only Since GPIO has no device sessions ireadstb is allowed with GPIO interface sessions The interface status byte has bit 6 set if EIR is asserted otherwise the status byte is 0 zero This allows normal SRQ programming techniques in GPIO SRQ
321. val INST id long reason long secval Where id The INST that refers to the session that installed the interrupt handler Chapter 10 291 SICL Language Reference IONINTR reason Contains a value which corresponds to the reason for the interrupt These values correspond to the isetintr function parameter ininum See a listing of the values below secval Contains a secondary value which depends on the type of interrupt which occurred For I_ INTR_TRIG it contains a bit mask corresponding to the trigger lines which fired For interface dependent and device dependent interrupts it contains an appropriate value for that interrupt The reason parameter specifies the cause for the interrupt Valid reason values for all interface sessions are I_INTR_INTFACT Interface became active I_INTR_INTFDEACT Interface became deactivated I_INTR_TRIG A Trigger occurred The secval parameter contains a bit mask specifying which triggers caused the interrupt See the ixtrig function s which parameter for a list of valid values I_INTR_ Individual interfaces may use other interface interrupt conditions Valid reason values for all device sessions are I_INTR_ Individual interfaces may include other interface interrupt conditions To remove the interrupt handler pass a zero 0 in the proc parameter By default no interrupt handler is installed Return Value This function returns zero 0 if successful or a non zero
322. val INST id unsigned int cval For device sessions the igpibppollconfig function enables or disables the parallel poll responses If cval is greater than or equal to 0 then the device specified by id is enabled in generating parallel poll responses In this case the lower 4 bits of cval correspond to bit 3 Set the sense of the PPOLL response A 1 in this bit means that an affirmative response means service request A 0 in this bit means that an affirmative response means no service request bit 2 0 A value from 0 7 specifying the GPIB line to respond on for PPOLL s If cval is equal to 1 then the device specified by id is disabled from generating parallel poll responses For commander sessions the igpibppollconfig function enables and disables parallel poll responses for this device that is how we respond when our controller PPOLL s us For C programs this function returns zero 0 if successful or a non zero error number if an error occurs IGPIBPPOLL IGPIBPPOLLRESP Chapter 10 253 C Syntax Description Return Value See Also SICL Language Reference IGPIBPPOLLRESP IGPIBPPOLLRESP Supported sessions 0 0 00 cece cece eens commander Affected by functions 00 000 00 eee ilock itimeout finclude lt sicl h gt int igpibppollresp id sval INST id int sval The igpibppollresp function sets the state of the PPOLL bit the state of the PPOLL bit w
323. ves the current termination character set with itermchr e An error occurs Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IWRITE ITERMCHR IFREAD IFWRITE 316 Chapter 10 SICL Language Reference IREADSTB ay IREADSTB Supported sessions 00 cece cece ee eens device Affected by functions 2 0 0 000s ilock itimeout C Syntax include lt sicl h gt int ireadstb id stb INST id unsigned char stb Description The ireadstb function reads the status byte from the device specified by id The stb argument is a pointer to a variable which will contain the status byte upon exit Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IONSRQ ISETSTB Chapter 10 317 C Syntax Description Return Value See Also SICL Language Reference IREMOTE IREMOTE Supported sessions 2 0 0 0 0 cece cence ence eens device Affected by functions 00 00 0000 ee ilock itimeout finclude lt sicl h gt int iremote id INST id Use the iremote function to put a device into remote mode Putting a device in remote mode disables the device s front panel interface For C programs this function returns zero 0 if successful or a non zero error number if an error occurs
324. width in bits of a GPIO interface For the HP Agilent E2074 S interface the acceptable values for width are 8 and 16 While in 16 bit width mode all i reaa calls will return an even number of bytes and all iwrite calls must send an even number of bytes 16 bit words are placed on the data lines using big endian byte order most significant bit appears on data line D_15 Data alignment is automatically adjusted for the native byte order of the computer This is a programming concern only if your program does its own packing of bytes into words The following program segment is an iwrite example The analogous situation exists for iread System automatically handles byte order unsigned short words 5 Programmer assumes responsibility for byte order unsigned char bytes 10 Using the GPIO interface in 16 bit mode igpiosetwidth id 16 This call is platform independent iwrite id words 10 264 Chapter 10 Return Value SICL Language Reference IGPIOSETWIDTH This call is NOT platform independent iwrite id bytes 10 This sequence is platform independent ibeswap bytes 10 2 iwrite id bytes 10 There are several notable details about GPIO width The count parameters for iread and iwrite always specify bytes even when the interface has a 16 bit width For example to send 100 words specify 200 bytes The itermchr function always specifies an
325. work to a LAN server such as a Series 700 HP UX workstation a PC or an HP Agilent E2050 LAN GPIB Gateway The LAN server is connected to the instrumentation or devices that must be controlled Once the LAN server has completed the requested operation on the instrument or device the LAN server sends a reply to the LAN client This reply contains any requested data and status information which indicates whether the operation was successful Chapter 8 163 Using SICL with LAN Overview of SICL LAN Series 700s Windows95 PCs or Windows NT PCs Client LAN HP E2050 LAN HP IB Gateway Server HP IB bus l EN Series 700s Windows95 PCs or Windows NT PCs Gateway EET EE HP IB bus ry ce Ne or other CeL Frrr FERFE Frrr rrr Frrr IETS Instruments Instrument Using the LAN Client and LAN Server Gateway The LAN server acts as a gateway between the LAN that your client system supports and the instrument specific interface that your device supports Due to the LAN server s gateway functionality we refer to devices or interfaces which are accessed via one of these LAN to instrument_interface gateways as being a LAN gatewayed device or a LAN gatewayed interface 164 Chapter 8 Using SICL with LAN Overview of SICL LAN
326. x application was linked with the SICL shared library then no modification or re compiles are necessary If your SICL 9 x application was linked with the SICL archive library then you can do one of the following Re compile your SICL 9 x application on HP UX 111 with the SICL shared library This is the recommended method See Compiling and Linking an SICL Program in Chapter 2 Getting Started with SICL of this manual OR Execute the opt sicl bin sicl_tl script as super user to install transition links to allow you SICL 9 x executables to run without modification or re compiling To create symbolic links opt sicl bin sicl tl install To remove symbolic links opt sicl bin sicl_ tl remove Appendix B 399 Note Updating HP UX 9 SICL Applications Linking with the Archive Library on HP UX 9 Linking with the Archive Library on HP UX 9 For future compatibility we recommend that you link with the SICL shared library as shown in Chapter 2 Getting Started with SICL SICL for HP UX 9 is shipped with both a shared library and an archive library By default SICL programs are built with the shared library unless you specify the archive library The following command creates the idn executable file while linking in the archive library cc o idn idn c Wl E a archive lsicl Wl a shared ldld or cc o idn idn c usr lib libsicl a Wl E ldld The W1 option specifies the compile
327. x00000200L 0x00000100L 0x00000080L Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IVXITRIGON IVXITRIGOFF 368 Chapter 10 SICL Language Reference IVXIGETTRIGROUTE E IVXIGETTRIGROUTE Supported sessions 00 ees interface Affected by functions 00 0 0 00 00 ee ilock itimeout C Syntax include lt sicl h gt int ivxigettrigroute id which route INST id unsigned long which unsigned long route Description The ivxigettrigroute function returns in route the current routing of the which parameter See the ivxitrigroute function for more details on routing and the meaning of route Return Value For C programs this function returns zero 0 if successful or a non zero error number if an error occurs See Also IVXITRIGON IVXITRIGOFF IVXITRIGROUTE IXTRIG Chapter 10 369 SICL Language Reference IVXIRMINFO IVXIRMINFO Supported sessions 0 00008 device interface commander C Syntax include lt sicl h gt int ivxirminfo id laddr info INST id int laddr struct vxiinfo info Description The ivxirminfo function returns information about a VXI device from the VXI Resource Manager The id is the INST for any open VXI session The laddr parameter contains the logical address of the VXI device The info parameter points to a structure of type str
328. xi device and prints it out include lt stdio h gt include lt sicl h gt void main int laddr struct vxiinfo info INST id get instrument logical address printf Pleas nter the logical address of the register based instrument for example 24 n scanf Sd amp laddr install error handler ionerror I_ ERROR EXIT open a vxi interface session id iopen vxi itimeout id 10000 read VXI resource manager information for specified device ivxirminfo id laddr amp info print results printf Instrument at address d n laddr printf Manufacturer s Id s n Model s n info manuf name info model_ name close session iclose id 120 Chapter 6 Note Using SICL with VXI MXI Communicating with VME Devices Communicating with VME Devices Not supported over LAN Many people assume that since VXI is an extension of VME that VME should be easy to use ina VXI system Unfortunately this is not true Since the VXI standard defines specific functionality that would be a custom design in VME some of the resources required for VME custom design are actually used by VXI Therefore there are certain limitation and requirements when using VME in a VXI system Note that VME is not an officially supported interface for SICL Use the following process when using VME devices in a VXI MXI mainframe Declaring Resource
329. y e Handle spurious signals that is signals intended for the previous handler or other portions of your application Install a signal handler once per process and never remove the handler e Don t block signals by default However blocking unblocking around short critical operations is okay e Use sigaction to install signal handlers Other signal handling mechanisms supported by Unix are not compatible with SICL which uses Sigaction 184 Chapter 8 Using SICL with LAN Using Signal Handling with LAN SIGPIPE Signals The SICL LAN client also installs a signal handler for SIGPIPE This ensures that a broken network connection will not cause the SICL application to terminate or exit unexpectedly The SICL LAN client does no special processing when it receives a SIGPIPE signal but will pass the signal along to a previously installed SIGPIPE handler unless configured not to during the SICL configuration If an application installs a SIGPIPE handler it should chain handlers in the same manner as described for SIGIO Chapter 8 185 Using SICL with LAN Summary of LAN Specific Functions Summary of LAN Specific Functions Note Using these LAN interface specific functions means that the program can not be used on other interfaces and therefore becomes less portable Function Name Action ilantimeout Sets LAN timeout value ilangettimeout Returns LAN timeout value igetgatewaytype Indicates whether the sess
330. y from the iproc daemon It cannot be run a second time manually without asserting the VXI SYSRESET iclear command or cycling the mainframe power Example ivxirm p Appendix D 427 Syntax Description Examples Customizing your VXI MXI System ivxisc ivxisc ivxisc sdvfphmij directory The ivxisc command reads the operating configuration file etc opt sicl vxiLU rsrcmgr out where LU is the logical unit of the VXI MXI interface and prints a human readable display of the current configuration This display includes slot number tables for each VXI bus in the configuration and logical address tables for each MXI bus a device table VME device information a list of failed devices a protocol support table the commander servant hierarchy an A24 A32 memory map and an interrupt line allocation table The default command no arguments prints all tables Parameters Prints bus slot tables Prints device table Prints VME device table Prints failed device table Prints protocol table Prints hierarchy 3 5DU h lt 4 Qu Prints memory map i Prints IRQ table directory Operating file directory default etc opt sicl vxiLU For the VXI interface at logical unit LU 16 ivxisc etc opt sicl vxil6 A sample output follows VXI Current Configuration VXI Bus 0 Device Logical Addresses 0 127 Slots O 2 2 3 4 5 E fp 8 901 TT 2 428 Appendix D Customizing your VXI MXI System ivxisc Empty Oo
331. your VXI cardcage This file is also used by the ivxisc utility to print out information about the devices The irq cf Configuration File The irq cf file is a database that maps specific interrupt lines to VXI interrupt handlers If you have non programmable interrupters and you want the interrupters to be recognized by a VXI interrupt handler you must make an entry in this file Additionally if you have programmable interrupters and you want them to be recognized by a device other than what s assigned by the resource manager the commander of that device you can make an entry in this file to override the default Keep in mind that not all VXI devices need to use interrupt lines and not all interrupt lines need to be assigned Note that any interrupt lines assigned in this file cannot also be assigned in the vmedev c f configuration file Appendix D 415 Customizing your VXI MXI System The VXI MXI Configuration Files The cmdrsrvt cf Configuration File The cmdrsrvt cf file contains a commander servant hierarchy other than the default for the VXI system The resource manager will set up the commander servant hierarchy according to the commander s logical addresses and the servant area switch However you can use this file to override the default according to the commander s switch settings This file should only contain changes from the normal The names cf Configuration File The names cf file is a database that contains a
332. yte ordering Also if a bus error occurs unexpected results may occur See Also IPOKE IMAP 296 Chapter 10 SICL Language Reference IPEEKX8 IPEEKX16 IPEEKX32 IPEEKX8 IPEEKX16 IPEEKX32 C Syntax include lt sicl h gt int ipeekxs id handle offset value INST id unsigned long handle unsigned long offset unsigned char value int ipeekx16 id handle offset value INST id unsigned long handle unsigned long offset unsigned short value int ipeekx32 id handle offset value INST id unsigned long handle unsigned long offset unsigned long value Note Not supported over LAN Description The ipeekx8 ipeekx16 and ipeekx32 functions read the values stored at handle and offset from memory and returns the value from that address These functions are generally used in conjunction with the SICL imapx function to read data from VXI address space Note The ipeekxs8 and ipeekx16 functions perform byte swapping if necessary so that VXI memory accesses follow correct VXI byte ordering Also if a bus error occurs unexpected results may occur See Also IPOKEX8 IPOKEX16 IPOKEX32 IMAPX Chapter 10 297 Note C Syntax Note Description Note See Also SICL Language Reference IPOKE IPOKE Not recommended for new program development Use IPOKEX8 IPOKEX16 IPOKEX32 instead include lt sicl h gt void ibpoke addr val unsigned char adadr unsign
333. zing your VXI MXI System VXI MXI Configuration Utilities VXI MXI Configuration Utilities The following SICL utilities are available to help you configure your VXI MXI system iproc itrginvrt ivxirm e ivxisc The utilities are located in the following directory opt sicl bin Each of these utilities is described in detail in the sections that follow 422 Appendix D Description Note Customizing your VXI MXI System iproc iproc iproc is designed to run at system boot time It performs various SICL system initialization functions including the creation of SICL device files dev sicl contains device files In addition it is configurable by the system administrator to execute programs at boot time or on certain asynchronous events such as VXI SYSRESET This configuration is done by editing the file iproc cf which is read only when the iproc daemon begins execution It consists of lines beginning with keywords which determine the actions of the iproc program The iproc cf file is located in the following directory etc opt sicl Only one iproc daemon is allowed to be running on a specific system The format of the configuration lines is as follows keyword action or keyword interface name action The functions of the keywords are described below boot This keyword will execute the action when the iproc daemon begins execution The normal time for iproc to run is when the system boots Appendix D 423 Cust

Download Pdf Manuals

image

Related Search

Related Contents

Klipsch Speaker System SB 3 User's Manual  Samsung K5 2GB Käyttöopas  XG-SV100W/SV200X Operation-Manual ES  Online Capacity Tester MK70 User and PC-Software  LRP Power Pack 3000  Info-lettre. Avril 2014 - internet voirie pour tous  Aver F17HD Spec Sheet  LG Electronics BD270 DVD Player User Manual  brick mobile Datasheet  マニュアル・仕様・外形図  

Copyright © All rights reserved.
Failed to retrieve file