Sample Programs Appendix C
GPIB-1014 User Manual C-10 © National Instruments Corporation
|
68000 Code | Comments
--------------------------------------------------------------------------------------------------------------------------------------------
|
RCV: movb #TMODE,DCR0 | Set DMA transfer mode
movb #TMODE,DCR1 |
|
movb #GTM,OCR0 | Set control registers
movb #MCU,SCR0 |
|
movb #FF,CSR0 | Clear status registers
movb #FF,CSR1 |
|
movl a0,MAR0 | Point channel 0 to buffer
|
cmpb #0,cic | Is GPIB-1014 Controller-In-Charge
beq RCV1 |
|
| Yes, set up carry cycle feature
|
movb #GTM+ACHN,OCR1 | - Enable chaining on channel 1
|
movl #ccary,BAR1 | - Point channel 1 to ccary
|
movw #2,BTC1 | - 2 elements in ccary
|
movl #HLDA,ccary | - First ccary address points to HLDA
|
movw d0,d1 | - Set channel 0 transfer count
subw #1,d1 | to transfer all but the last
movw d1,MTC0 | byte
|
movl a0,d2 | - Second ccary address points to
addl d2,d1 | last data byte
movl d1,ccary+6 |
|
|
movb #BRG+ECC+IN,CFG2 | - configure CFG2 for carry cycle
|
movb #AUXRA+022,AUXMR | - Set HLDE and BIN in AUXRA
|
movb #GO,CCR1 | - Start channel 1
bra RCV2 |
|
RCV1: movb #BRG+IN,CFG2 | No - no carry cycle
movb #AUXRA,AUXMR | Clear any HLDE or HLDA in effect
movw d0,MTC0 | Channel 0 transfers all bytes
|
RCV2: movb #GO,CCR0 | Start channel 0
movb #DMAI,IMR2 | Enable DMAs from the DIR
movb #FH,AUXMR | Release any handshake holdoff in progress
|
RCV3: btst #ENDRX,ISR1 | Loop waiting for ENDRX or PCT (DMA done)
bne RCV4 |
btst #PCT,CSR1 |
beq RCV3 |