mmm

ADC IN DEMO9S08QG8

Discussion created by mmm on Dec 10, 2008
Latest reply on Dec 10, 2008 by Tony Papadimitriou
I want to do an ADC using the demo. To check that it converts, I have done this program, where the input channel is connected to the port B, pin 7 output:

(...)
                mov  #$80,PTBDD   ;port B, pin 7=1
init_adc:   mov  #$40,ADCSC1
                mov  #$00,ADCSC2
                mov  #$98,ADCCFG
                mov  #$01,APCTL1
                   

wait:      lda  ADCSC1                              ; waits for bit COCO=1
             and  #80h
             cbeqa  #80h, converted
              jmp  wait
          
                    
converted: lda  ADCRH
                 and  #03h
                 sta  sumh
                 lda    ADCRL
                sta  suml

(...)

I've tried, but it doesn't work, it doesn't start converting.
Can someone help me? Where is the mistake?

Outcomes