Reading A 16-Bit Word; Debugging Basic Register-Based Programs - Agilent Technologies E1330B User's Manual And Scpi Programming Manual

75000 series b quad 8-bit digital i/o module
Hide thumbs Also See for E1330B:
Table of Contents

Advertisement

Reading a
16-Bit Word
Debugging
Basic
Register-
Based
Programs
130 Agilent E1330B Digital I/O Module Register Information
IOEOI (7L, 0); IOEOL (7L, " ", 0);
IOOUTPUTS (70900L, "DIAG:POKE ", 10);
IOEOI (7L, 1); IOEOL (7L, state, 0);
IOOUTPUTA (70900L, send_data, 3);
}
To read a 16-bit word, two consecutive ports are required (i.e. ports 0 and 1, 1 and
2, 2 and 3, or 3 and 4). Both ports must be configured exactly the same. Configuring
consecutive port registers by addressing the lower port's register and sending a
16-bit word. Handshaking is accomplished using the lower port's handshake lines.
Register-based programming may at times be difficult but this difficulty can be
greatly minimized by having a little helpful code to ease the debugging task.
In order to do rapid debugging you need to be able to see program flow, program
variables, and instrument errors. A good ERROR and TIME OUT handling shell is
an essential part of this.
The main line of program PIR_INT (lines 10-240) act as a shell that prevents your
BASIC program from ever hanging up due to an I/O that is not proceeding. It will
identify the LINE NUMBER of lines that have RUN TIME ERRORS or that have
TIMED OUT. The shell will then call the subprogram E13xx_errors which will
query instruments for errors. Often time outs are caused by doing an ENTER after
having sent incorrect commands to instruments.
Since the shell prevents I/O hang ups, BASIC's PAUSE, STEP, and CONT may
now be used effectively to debug programs. When a program does not seem to be
proceeding correctly, use PAUSE then STEP to trace the flow, type variable names
to see their value when PAUSEd, and finally use CONT to proceed at full speed.
The main line of this program is the error handler. It will catch all TIME OUTS and
ERRORS that are not caught by lower level contexts. Five softkeys are defined:
QUIT& ?
will check for instrument errors and then stop.
END!
will end the program immediately with no error checking.
Reg_dump will print the contents of all Agilent E1330 registers.
Res0_0
will drive line sts0 to a logic zero.
Res0_1
will drive line sts0 to a logic one.
In order for this shell to catch errors and time outs, all application codes must start
in the Subprogram Main (lines 390-680). The subprogram Reg_dump (lines
760-910) will read all registers on the Agilent E1330 and display them in both
decimal and hex format. When developing a program you may temporarily place
calls to Reg_dump in your program. This will allow you to see what the registers
contain and accelerate your understanding of them. The subprogram Reg_dump has
also been assigned to a softkey so you may see the registers at any time.
The subprogram Res0_0 and Res0_1 are used to provide stimulus. These routines
may be embedded in lines of code or the softkeys that have been assigned to them
may be used to provide a testing stimulus. The important thing to make note of is
the way that a testing stimulus has been made very visible, which will ease the
testing and debugging of programs.
Appendix B

Advertisement

Table of Contents
loading

Table of Contents