Software Overview
.elseif (R4BIT_RESOLUT) |
|
@CR1_SEND ^= #RES_10_BIT | ; clear bit for |
@CR1_SEND = #RES_4_BIT | ; set |
.endif |
|
.if (EXTERNAL_CLOCK) |
|
@CR0_SEND ^= #CLK_INTERNAL | ; clear CLK_INTERNAL bit if one |
@CR0_SEND = #CLK_EXTERNAL | ; set CLK_EXTERNAL mode |
.endif |
|
.if (AUTO_PWDN_ENABLE) |
|
@CR1_SEND ^= #NO_AUTO_PWDN | ; clear NO_AUTO_PWDN bit if one |
@CR1_SEND = #AUTO_PWDN | ; set AUTO_PWDN mode |
.endif |
|
.if (DIFF_INPUT_MODE)
@CR0_SEND ^= #SINGLE_END ; clear single ended input bit if one @CR0_SEND = #DIFFERENTIAL ; set differential input mode
.endif
.if (IME_CALIBRATION)
call CALIBRAT_INTERNAL_MID_SCALE
.endif
.if (SME_CALIBRATION)
call CALIBRAT_SYSTEM_MID_SCALE
.endif
****************************
*ADC_INI:
*set ADC register CR0/CR1
****************************
ADC_INI:
*write CR1 (to reset old CSTART mode initialization, because otherwise, the ADC never sets
*back its int– pin to show a sample is available:
@CR_PROBLEM = #(SW_PWDNNO_AUTO_PWDNNO_2COMPLEMENTNO_DEBUGRES_10_BITRD_CONV_START);
port(ADC) = @CR_PROBLEM | ; Address | decoder sets CS low, | ||||
| ; WR– low | and send CR_PROBLEM value to the ADC | ||||
NOP | ; wait for tW(CSH)=50ns | |||||
* write CR1: |
|
|
|
|
|
|
|
|
|
|
|
| |
port(ADC) = @CR1_SEND | ; Address decoder sets CS low, | |||||
| ; WR– low and send CR1 value to the ADC | |||||
|
|
|
| |||
port(DEACTIVE) = @ZERO | ; deselect ADC (CS high) | |||||
NOP | ; wait for tW(CSH)=50ns |