LCALL SDAC
;
POP
ACC
LCALL SDAC
;
SETB
DAC_SYNC
RET;
;
---------
;
;
SDAC ROUTINE
;SEND 8 bits of the ACC to the DAC
---------
;
SDAC:
PUSH
B
MOV
B,#8
DACL: RLC
A
MOV
SER_DI,C
SETB
SER_CLK
CLR
SER_CLK
DJNZ
B,DACL
POP
B
RET
;
;
------------
;
;
ADC ROUTINE
;
INPUT:
;
OUTPUT:
;
NOTE:
------------
;
ADC:
PUSH
B
SETB
SER_DI
SETB
ADC_CS
CLR
SER_CLK
;
ANL
A,#7
PUSH
DPH
PUSH
DPL
MOV
DPTR,#MUX_TABLE
MOVC
A,@A+DPTR
POP
DPL
POP
DPH
SETB
ACC.7
;
CLR
ADC_CS
SETB
SER_CLK
NOP
CLR
SER_CLK
;
MOV
B,#4
MUXL: RLC
A
MOV
SER_DI,C
SETB
SER_CLK
NOP
CLR
SER_CLK
DJNZ
B,MUXL
;
MOV
A,#0
MOV
B,#8
;send to the DAC
;send to the DAC
;STROBE DATA OUT
A = MUX ADRESS (0-7(
A = ACTUAL ADC VALUE
Stop timer (if is on) while using this routine
;we use B as a counter
;for START bit
;clear ACC.3-ACC.7 (leave 0-7(
;for single mode (not differential(
;latch and shift START BIT to the ADC
;for sending 4 bits of mode and address
;latch and shift one BIT to the ADC
;for reading 8 bits of the analog channel value
88
SES Scientific Educational Systems