AD转换控制输出高电平或低电平,高电平正常 为什么低电平不是0V而是4V 谢谢大神们
code section
;
ORG ROMStart
_Startup:
LDHX #RAMEnd+1 ; initialize the stack pointer
TXS
CLI ; enable interrupts
adc1ch1_init:
mov #$9B,ADC1CVL
bset 1,APCTL1
mov #$B0,ADC1CFG
mov #$30,ADC1SC2
mov #$21,ADC1SC1
rts
io_init:
lda #$FF
sta PTDD
sta PTDDD
rts
main: clra
sta SOPT
jsr io_init
jsr adc1ch1_init
again:
brset 7,ADC1SC1,led_on
mov #$FF,PTDD
bra again
led_on: mov #$00,PTDD
bclr 7,ADC1SC1
bra again
; Insert your code here
NOP
feed_watchdog
BRA mainLoop
|