Programming Considerations Chapter 5
GPIB-1014 User Manual 5-20 © National Instruments Corporation
Whether terminating on the END message or the EOS message (or whenever the DMA transfer
does not complete properly), the DMAC must be stopped by issuing a software abort to Channels
0 and 1 by writing to the CCR with the SAB bit set. You then must write to the CSR to clear the
ERR flag set by the software abort.
Using Programmed I/OProgramming considerations for using programmed I/O data transfers are explained in the
following paragraphs.
Sending and Receiving Data
When using programmed I/O to send or receive a GPIB data byte, the DMAO and DMAI bits in
IMR2 must be cleared. The contents of other GPIB-1014 DMA registers are irrelevant.
To send data, wait until the TLC has been programmed or addressed to talk and the CDOR is
empty. When this occurs, the DO bit in the ISR1 is set, indicating that it is safe to write a byte to
the CDOR. The DO bit is set again once that byte has been received by all Listeners.
To receive data, wait until the TLC has been programmed or addressed to listen and the DIR is
full. When this occurs, the DI bit in ISR1 is set, indicating that the GPIB Talker has written a
byte to the DIR. Once that byte has been read, the DI bit is set again when a new byte is received
from the Talker.
To determine if the CDOR is empty or if the DIR is full, either poll ISR1 until the DO or DI
status first appears, or allow a program interrupt to occur on the respective event. Remember,
however, that the status bits and the interrupt signals are cleared when the ISR1 is read, so the
absence of a true DO or DI status does not unambiguously indicate that the CDOR is still full or
that the DIR is still empty.
Sending END or EOS
Send the GPIB END message by issuing the Send EOI auxiliary command just before writing the
last data byte to the CDOR. To send the GPIB EOS message, make the last byte the EOS code.
Terminating on END or EOS
The END status bit or interrupt is used to inform the program of the occurrence of an END
message or an EOS message.