Software Overview
.if (AUTO_PWDN_ENABLE)
@CR1_SEND ^= #NO_AUTO_PWDN @CR1_SEND = #AUTO_PWDN
.endif
.if (DIFF_INPUT_MODE)
@CR0_SEND ^= #SINGLE_END @CR0_SEND = #DIFFERENTIAL
.endif
****************************
*ADC_INI:
*set ADC register CR0/CR1
****************************
ADC_INI:
* write CR1:
port(ADC) = @CR1_SEND
port(DEACTIVE) = @ZERO
NOP
* write CR0
port(ADC) = @CR0_SEND port(DEACTIVE) = @ZERO
NOP
;clear NO_AUTO_PWDN bit if one
;set AUTO_PWDN mode
;clear single ended input bit if one
;set differential input mode
;Address decoder sets CS low,
;WR low and send CR1 value to the ADC
;deselect ADC (CShigh)
;wait for tW(CSH)=50ns
;send CR0 value to the ADC
;deselect ADC (CShigh)
;wait for tW(CSH)=50ns
*******************************************
*ADC_mono_IRQ_Start:
*read samples and store them into memory
*******************************************
ADC_mono_IRQ_Start:
STEP2: @TEMP | = port(ADC) | ; select ADC (CS low) (change address bus signal) | ||||||||
STEP3: repeat(#4) |
|
|
|
|
|
|
|
|
| |
NOP |
| ; wait for | ||||||||
|
|
|
|
|
|
|
|
|
|
|
STEP4: XF | = 0 | ; clear RD | ||||||||
STEP5: |
|
|
|
|
|
|
|
|
|
|
.if POLLING_DRV |
|
|
|
|
|
|
|
|
| |
* wait until INT– goes low in polling the INT0 pin: | ||||||||||
| = |
|
|
|
|
|
|
| ||
M1: TC | ; test, is the INT0 Bit in IFR=1? | |||||||||
|
|
|
|
|
| |||||
if (NTC) goto M1 | ; wait until INT signal goes high | |||||||||
|
|
|
|
| ||||||
IFR | = #1 | ; reset any old interrupt on pin INT0 |
.elseif INT0_DRIVEN
*user main program area (this could execute additional code)
*go into idle state until the INT0 wakes the processor up
USER_MAIN: IDLE(2) | ; the user software could do something else here |
goto USER_MAIN | ; |