02.07.2013 Views

PDP11 PeripheralsHbk 1972 - Trailing-Edge

PDP11 PeripheralsHbk 1972 - Trailing-Edge

PDP11 PeripheralsHbk 1972 - Trailing-Edge

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

starts the ADC; tests the READY (CONVERSION COMPLETE) bit until the bit is<br />

set; and then transfers the data from the digital output line of the ADC to the processor.<br />

A possible sequence of instructions to perform this task is given below.<br />

This program selects an input, waits for the device to complete the conversion,<br />

and then transfers the result to register 4.<br />

READY:<br />

MOV<br />

TSTB<br />

BPL<br />

MOV<br />

INPUT.ADMUX<br />

ADCSR<br />

READY<br />

ADDBR.R4<br />

lSELECT ANALOG INPUT<br />

lCHECK FOR CONVERSION COMPLETE<br />

lNO.TEST AGAIN<br />

lYES.OBTAIN DATA<br />

INPUT IS A LOCATION CONTAINING THE NUMBER OF THE DESIRED ANALOG<br />

INPUT LINE.<br />

A SUBROUTINE TO EXAMPJE A SERIES OF INPUTS MIGHT BE ',fRITTEN AS FOLLO'",S:<br />

MUXSCN:<br />

LOOP:<br />

DONE:<br />

'.olHERE:<br />

MOV<br />

CLR<br />

TSTB<br />

BPL<br />

MOV<br />

CMP<br />

BEQ<br />

INC<br />

BR<br />

RTS<br />

BUFADR.R4<br />

ADMUX<br />

ADCSR<br />

LOOP<br />

ADDBR.(R4)+<br />

ADMUX.#77<br />

DONE<br />

ADMUX<br />

LOOP<br />

R7<br />

;INITIALIZE DATA POINTER<br />

;SELECT INPUT LINE ZERO<br />

;CHECK FOR CONVERSION COMPLETE<br />

;NO.TEST AGAIN<br />

;YES.PLACE DATA IN BUFFER<br />

;LAST LINE?<br />

;YES.GO TO DONE<br />

lNO.GO TO NEXT INPUT<br />

;GO TO LOOP<br />

;EXIT FROM SUBROUTINE<br />

BUFADR IS A LOCATION IN CORE CONTAINING THE ADDRESS OF THE<br />

FIRST WORD ON A 64-WORD BUFFER<br />

ADCSR IS THE INTERFACE STATUS REGISTER<br />

ADMUX IS THE MULTIPLEXER REGISTER<br />

ADDBR IS THE DATA REGISTER<br />

This subroutine is called by the instruction: JSR R7, MUXSCN. The subroutine initializes<br />

general register 4 as a pointer to the buffer; initializes the multiplexer register<br />

to zero; and sequentially reads the 64 inputs into the corresponding buffer<br />

location. When each input has been read once, control returns to the calling program<br />

with the contents of general register 4 as the address of the word after the<br />

last word of the buffer.<br />

Since loading the multiplexer register starts operation of the device cycle, ADMUX<br />

should not be accessed as a destination operand except by a TST, BIT, or CMP instruction.<br />

In addition, the INC ADMUX instruction should follow the CMP instruction.<br />

This avoids initiating unwanted device operation and allows the subroutine<br />

to be immediately recalled.<br />

3.3 INTERRUPT SERVICED INTERFACE<br />

The interface to an analog-to-digital converter would be more versatile if it included<br />

an interrupt capability. An interrupt serviced interface with this capability<br />

can be formed simply by adding an M7820 Interrupt Control Module and one bit<br />

to one of the registers in 'the programmed device interface described in Paragraph<br />

3.2.<br />

The interrupt serviced 'interface allows the processor to concurrently execute instructions<br />

of another program while the analog-to-digital converter (ADC) performs<br />

a cycle of operation. The processor responds to a READY (CONVERSION<br />

COMPLETE) signal from the ADC by interacting with the device and analyzing the<br />

251

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!