Appendix C
Sample Programs
© National Instruments Corporation
C-17
GPIB-1014P User Manual
|
| * * * * * * * * * * * * * * * * * * * * * * * * *
| * COMMAND SEND - CSEND *
| * * * * * * * * * * * * * * * * * * * * * * * * *
|
| Summary:
| - Called by CMD to send interface command messages
|
| Assumptions on entry:
|
- The GPIB-1014P is Active Controller
|
- The d0 register contains the number of bytes to
|
send
|
- The a0 register contains the address oc cmdbuf
|
| Actions:
| - Initialize a count variable
|
- Wait until the CDOR is empty
|
- Write a byte and increment the counter
|
- Check for a GPIB error
|
- Loop until all bytes are transferred
|
- On an error, set d0 to -1
|
| Status on return:
|
- d0 register contains number of bytes sent or -1 if an
|
error occurred
|
|
68000 Code
| Comments
------------------------------------------------------------------------------------------------------------------------------------------------
|
CSEND:
clrw
count.L
| Initialize count variable
|
CSEND1: btst
#CO,ISR2.L
| Wait till CDOR is empty
beq
CSEND1
|
cmpw #count,d0
| Have all commands been sent?
beq CSEND3
| Yes
addw #1,count.L
| No--Increment counter and write
movb (a0)+,CDOR.L
| the next command
btst #ERR,ISR1
| If there are no Listeners, return -1
bne CSEND2
| in d0 register
add1 #1,a0
|
bra CSEND1
|
CSEND2: movw #-1,d0 |
CSEND3: rts
|