MC9S12DB128 Port/ATD/Coding questions.

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

MC9S12DB128 Port/ATD/Coding questions.

649 Views
tastypotato
Contributor I

I'm going to apologize in advance for my lack of in depth knowledge of what's really going on here so please try and keep it simple with me. 

 

Here's the problem that my team and I have run into. We are trying to take 3 analog signals come into pins 51, 52, and 53 which are ATD0, ATD1, and ATD2. Since we are going to be putting these signals out over a 9600 baud Zigbee we need these to come out of the TX line on pin 66.

 

First off though, we need to figure out what we're doing wrong with the ATD because as of right now our project will compile correctly but when running a test on it with an o-scope we're not able to see anything coming off the pin 66.

 

I've included the .zip of the project if anyone wants to take a look, but be warned we're college students and this is our first attempt at anything like this. We've been doing research on a book that is at our library and that's what we've formed our current code off of.

Labels (1)
0 Kudos
Reply
1 Reply

344 Views
DPB
NXP Employee
NXP Employee

Hello

 

Some things to check, that may help in debugging.....

 

Are the VRH and VRL ATD reference voltages in spec?

 

When the code runs, do any of the CCF bits in ATDSTAT1 get set?

 

Does the SCF flag in ATDSTAT0 get set?

 

If the flags indicate a conversion has completed, check the contents of the ATDDRH/L registers after conversion.

Do these contents make sense? Do they make sense applying full scale and zero at the input pin?

 

ATD0CTL5 = 0xB8

Why does the code write a "1" to ATD0CTL5[3]? This bit is unimplemented.

 

ATD0CTL4[[7]=SRES8. In the code this is clear for 10-bit resolution.

ATD0CTL5[7] = DJM. In the code this is set, for right justified, but only the ATDDRL register is used, thus the 2 most significant bits are ignored. Is this intended? 

 

DPB

 

0 Kudos
Reply