[MC912DG128A] problem with ATD-Converter

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[MC912DG128A] problem with ATD-Converter

1,187 Views
hc12prog
Contributor I
Hello,
 
i would like to use the ATD in Multichannel-Mode. But it does not work. I get for all Channels the same values, but on Channal 2 and 3 are 2.5V and on Channel1 is only 0.25V. And "three1-3" have the value 58, also the right value for Channel1 with 0.25V .
I hope somebody can help me and find the mistake.
 
Thank you!
 
Code:
#include...int one, two,...;
//ATD init: 10Bit, right-justified, enable, SC1=0,ATD0CTL2=0x90; ATD0CTL3=0x00;ATD0CTL4=0xE1;one=0;two=0;void main (void){ATD0CTL5=0%00010000; //MULT=1=onwhile((ATD0CTL0&0x80)!=0x80)); //wait for end of the sequenzone=ADR00H;one=one<<8;two=ADR00L;three=one|two;one1=ADR01H;one1=one1<<8;two1=ADR01L;three1=one1|two1;one2=ADR02H;one2=one2<<8;two2=ADR02L;three2=one2|two2;}}

 
Labels (1)
0 Kudos
1 Reply

276 Views
kef
Specialist I
ATD0CTL5=0%00010000; //MULT=1=on
^^ is the same like ATD0CTL5=0;
 
 
0%00010000 is 0 mod octal 00010000 (decimal 4096).
 
If your compiler supports binary constants, then ir should be 0b00010000.
0 Kudos