User manual
Register-Based Programming 111Appendix B
The multimeter’s Status bit 5 is monitored to determine when the analog-
to-digital (A/D) conversion is in progress and, thus, when to advance the
channel. This enables each channel to be measured before the readings are
read from the buffer. The multimeter’s Autozero is often turned on to detect
when bit 5 is active.
The channel can also be advanced by monitoring bit 4 (Data Ready).
However, before measuring the next channel, readings from the previous
channel must be read from the buffer in order to clear the bit.
Example: Reading ID,
Device Type,
and Status Registers
This C programming example reads the Module ID, Device Type, and Status
Registers from the module.
#include <stdio.h>
#include <chpib.h>
#include <cfunc.h>
#define LOG_ADDR 112L
#define BASE_ADDR (long) ((0x1FC000) + (64 * LOG_ADDR))
main( )
{
int reg_addr;
float send_data[3], read;
char state[2] = {13,10};
send_data[1] = 16;
send_data[2] = 0;
send_data[0] = BASE_ADDR + 0;
IOEOI (7L, 0); IOEOL (7L, " ", 0);
IOOUTPUTS (70900L, "DIAG:PEEK?", 11);
IOEOI (7L, 1); IOEOL (7L, state, 2);
IOOUTPUTA (70900L, send_data, 2);
IOENTER(70900L, &read);
printf("/nIdentification Register = %X",(int)read);
send_data[0] = BASE_ADDR + 2;
IOEOI (7L, 0); IOEOL (7L, " " , 0);
IOOUTPUTS (70900L, "DIAG:PEEK?", 11);
IOEOI (7L, 1); IOEOL (7L, state, 2);
IOOUTPUTA (70900L, send_data, 2);
IOENTER(70900L, &read);
printf("/nDevice Register = %X",(int)read);
send_data[0] = BASE_ADDR + 4;
IOEOI (7L, 0); IOEOL (7L, "", 0);
IOOUTPUTS (70900L, "DIAG:PEEK?" , 11);
IOEOI (7L, 1); IOEOL (7L, state, 2);
IOOUTPUTA (70900L, send_data, 2);
IOENTER(70900L, &read);
printf("/nStatus Register = %X",(int)read);
return 0;
}