• Aucun résultat trouvé

FADEXS - EXAMPLE PROGRAM 5

Dans le document SERIES DT3362 (Page 122-129)

OT3362 SERIES MEMORY BOARD

8.6 FADEXS - EXAMPLE PROGRAM 5

PROGRAMMING EXAMPLES FADEXS - EXAMPLE PROGRAM 5

This program is again essentially the same as the previous two in that 100 conversions with the same channel-list are to be made and put into main memory. The only difference is that the external trigger with List Scan mode is selected. In this mode each external clock tick will cause the DT3362 series ~u ~~au

through the channel-list once. Thus each scan of the list will produce four conversions, requiring 25 external clock ticks to gather 100 data points. As the DT3362 series is bursting through the channel-list at its maximum speed, a processor wait is required to ensure that the AID had full access to the Q-bus to avoid overrun errors. Here again, control returns to the calling program when the required number of data conversions have been taken.

. ENABLE LC

. TITLE FADEX1 Fast AID (DT3362) Programming Example 1 .SBTTL Functional description

25 Mar 81

Channel File Programming Register.

DMA Control & Status Register.

MOVB 8053, @ ttADCSR + 1 select start addrs., mode 01

MOVB ttOOO, @ .CFPR + 1 5et initial pointe .... to zero.

MOVB .063, @ 4tADCSR + 1 select final addrs. , mode 01

MOVB ttOOO, @ .CFPR + 1 set end pointer to ze .... o.

Now to form the gain and channel byte.

MOV GAIN. RO Get the gain information.

Must move Gain value over to bits 6-7

SWAB RO Move left 8 bits

ASR RO Move back (right) one

...

"'~v

ASR RO Move back (right) one bit

Now ADD in channel value. (ADD is Logical OR if no bits match) ADD CHAN,RO ; ADD <OR) in channel select First select channel arraq page zero and starting word 0

MOV ; page 00, mode 10 and byte 0

Then write the channel and gain byte into the first location.

MOVB RO, @ .CFPR gain and channel are in RO

Now Preload and Enable the Multiplexer logic.

MOVB MOVB MOVB

.006, @ .ADCSR + 1 .000, @ .CFPR

.000, @ 4tADCSR + 1

Preload Multiplexer, mode 11 Give it a kick.

Enable counters, mode 00 Now set DMACSR to indicate use of Programed I/O method .

MOVB • 000. @ 4tDMACSR i Select Programmed 1/0 mode.

Now start converter by setting start bit in ADCSR. Note that the other control bits like channel page select and trigger ext must be set correctly also.

MOVB .001, @ 4tADCSR Set start bit.

Now the converter is running. This example will continue to test the A/D Control

&

Status register looking for the completion bit.

RTEST: TSTS

BPL

@ .ADCSR RTEST

If done bit set, byte is negative If it hasn't changed loop around.

Program continues when done bit is set. This should indicate that data has been collected.

MOV @ 4tADBUF, DATA Get data from converter boa .... d.

. ENABLE LC

. TITLE FADEX2 Fast AID (DT3362) Programming Example 2 .SBTTL Functional description

Te~t.d: 25 Mar 81

This routine is a programming example designed to operate the Data Translation Fast AID converter; OT3362 .

In this example the Converter is re~uired to make one hundred

conversions in Interrupt driven mode. ihe~e conv.r~ions will each be initiated by the external clock. The multiplexer channels

and their gain values are specified in the data block below.

In this example the channel array specifies that channel *3 will be read with a gain of 1, then again with a gain of 2.

then channel *7 will be read with a gain of 1, and finallv channel *2 will be read with a gain of one.

The interrupt service routine appears at the bottom of th is listing.

· SSTTL BASE = 170400 ADCSR = BASE AOBUF

-=

BASE+2

CFPR = BASE+4 DHACSR = BASE+6 DMAWCR = BASE+I0 DMACAR = BASE+12

I NVEC :I: 400

AID data block, and control block de~initions.

Base address of Fast AID converter.

AID Control and Status Register AID Oat. Buffer Regi~ter

Channel File Programming DHA Control ~ Status

DHA Word Count Reg ister. (not used)

DMA Current Address Reg ister. (not used) Address of Interrupt vector.

Gain 8c channel selection array follows

GANDC; · BYTE 005 Gain 1 (code 0) , channel 5

· BYTE 105 Gain 2 (code 1 ) , channel 5

· BYTE 007 Gain 1 (code 0) , channel 7

. BYTE 002 Gain 1 (code 0) I channel 2

The Data descripters are reset each time the startup code is executed.

PDATA: DATA DATA: . BLKW DCNT: 100.

Pointer to Data array.

100 Data array .

Data count. (number of conversions)

.SBTTL Initialization (in case of powe~up o~ ~eset) Block other interrupts Set I.S. address (error) Block other interrupts Here the Data array pointer FDATA ana tnw Data cuunt

Now Preload and Enable the Multiplexer logic.

Preload Multiplexer, mode 11 Qi ve i t a k i c k.

.SBTTL Interrupt Service Subroutine.

This code will be executed after each conversion is completed. Increment Data painter

to the next word.

Decrement Data Count If last point go to DONE

Return from interrupt The following code is only executed if the converter detects an error. This indicates that. d.ta overrun has occured.

· ENABLE LC

. TITLE FADEX3 Fast AID CDT3362) Programming Example 3 .SBTTL Functional description

Tested: 25 Mar 81

This routine is a programming example designed to operate the Data Translation Fast AID converter: DT3362 .

In this example the Converter is required to make one hundred conversions in DMA Burst mode. These conversions are intiated

by the software and will all be taken as quickly as the converter can go. The multiplexer channels

and their gain values are speei~ied in the data block below.

In this example the channel array specifies that channel 15 will be read with til gain of 1. then again with a gain of 2, then channel 17 will be read with a gain of 1, and finally channel 12 will be read with a gain of one.

The interrupt service routine appears at the bottom of th is listing.

· SBTTL

BASE

=

170400 ADCSR

=

BASE

ADBUF

=

BASE+2

CFPR

=

BASE+4

DMACSR II: BASE+6

Dans le document SERIES DT3362 (Page 122-129)