12.07.2015 Views

spec - Local Sector 7 web page

spec - Local Sector 7 web page

spec - Local Sector 7 web page

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CAMAC, GPIB and SerialBesides the built-in hardware support for moving motors and counting using CAMAC(IEEE-583), GPIB (IEEE-488) and serial (RS-232C) interfaces, <strong>spec</strong> provides generalizedinput /output support over these interfaces from the command level.The ca_get(device, subaddress) command will return the contents of theaddressed module register (F=0 in the standard FNA CAMAC command code), whileca_put(data, device, subaddress) will write the 24-bit value data to theaddressed module register (F=16). The device argument is the I /O module indexfrom the configuration file and can be 0, 1 or 2. The CAMAC slot number of the moduleis set in the configuration file. The subaddress argument is the module’s subaddress(the A in the FNA).<strong>spec</strong> allows you to send a string of characters to a GPIB instrument at any GPIBaddress and to read a string of characters from any instrument. When reading characters,<strong>spec</strong> will accept a string terminated by either a newline or by carriagereturn—newline, or you can <strong>spec</strong>ify the number of bytes to be read. For example, toinitialize a particular voltmeter having GPIB address 12, you would issue the command:73.FOURC> gpib_put(12, "D0R0Z0B0T0K1M0G1X")74.FOURC>That instrument might then be read with:74.FOURC> {k_ohms = gpib_get(12); print k_ohms}100.02475.FOURC>The command75.FOURC> x = gpib_get(12, 4)76.FOURC>would read 4 bytes from device 12 and not look for terminators.When sending strings using gpib_put() ,you cannot send null bytes. Usually adevice that requires null lower order bits in a data byte will ignore the high order(parity) bit. In this case, you can usually set that highest bit to avoid sending a nullbyte.The ser_get(device, n) and ser_put(device, string) functions access the serialinterface, where device is the index from the configuration file and can be 0, 1 or 2.In ser_get() , n is the most number of bytes to read. The function will return afterreading one line (terminated by a newline or carriage return) from the device, even if34 USER MANUAL AND TUTORIALS INTERIM WORK-IN-PROGRESS (8/16/01) NOT FOR GENERAL DISTRIBUTION

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!