home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
ddjmag
/
ddj8706.arc
/
MUSSLST.JUN
< prev
next >
Wrap
Text File
|
1987-05-05
|
2KB
|
104 lines
Listing 1
;
;
;--------------------------------------------------
;
; ANALOG TO DIGITAL CONVERTER DRIVER
;
; Written by John Musselman
;
;--------------------------------------------------
;
;
INBIT: EQU 1 ;INPUT BIT POSITION
OUTBIT: EQU 2 ;OUTPUT BIT POSITION
;
PERIOD: EQU 1000 ;# OF INTERRUPTS IN A CONVERSION
;
;
HIGH: DS 2 ;COUNT OF HIGH BITS
COUNT: DS 2 ;CONVERSION CYCLE COUNTER
RESULT: DS 2 ;RESULT OF CONVERSION
;
;
;--------------------------------------------------
; INITIALIZATION...
;--------------------------------------------------
;
; MUST BE INCLUDED IN THE SYSTEM
; INITIALIZATION BEFORE INTERRUPTS
; ENABLED
;
;
MOVD #PERIOD-1,COUNT+1
;
;
;--------------------------------------------------
; INTERRUPT ROUTINES...
;--------------------------------------------------
;
; THE FOLLOWING ROUTINES MUST APPEAR
; IN AN INTERRUPT WHICH OCCURS
; AT REGULAR INTERVALS
;
;
;--------------------------------------------------
; I/O...
;--------------------------------------------------
;
;
; SEE IF INPUT BIT IS HIGH OR LOW...
;
;
ATOD: MOVP APORT,B
BTJO #INBIT,B,HI
;
;
; IF IT'S LOW, GENERATED VOLTAGE IS
; BELOW THE UNKNOWN VOLTAGE. OUTPUT A
; HIGH. COUNT ONE MORE HIGH BIT...
;
;
LO: ORP #OUTBIT,APORT
DECD HIGH+1 ;NOTE ONES COMPLEMENT COUNT
JMP IODONE
;
;
; IF IT'S HIGH, GENERATED VOLTAGE IS
; ABOVE THE UNKNOWN VOLTAGE. OUTPUT A
; LOW...
;
;
HI: ANDP #255-OUTBIT,APORT
;
;
IODONE:
;
;
;--------------------------------------------------
; CONVERSION CYCLE...
;--------------------------------------------------
;
;
; SEE IF CONVERSION CYCLE DONE...
;
;
DECD COUNT+1
JC ATODDN
;
;
; IF CONVERSION DONE, SAVE RESULT
; AND RESET COUNTERS...
;
;
MOVD HIGH+1,B ;RESULT IS ONES COMPLEMENT
COM A ;OF COUNT
COM B
MOVD B,RESULT+1
;
MOVD #-1,HIGH+1 ;ONES COMPLEMENT OF ZERO
MOVD #PERIOD-1,COUNT+1
;
;
ATODDN: