twr k60 100 mhz ADC reading

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

twr k60 100 mhz ADC reading

960 Views
liatackerman
Contributor I

I am working with the twr k60d100m. I tried configuring the given demo of the 16bit ADC single ended temprature sensor reading (adc16_reading_example) so I can measure an external voltage connected to the A80/B34 pin but I always get random numbers, even if I lower of increase the voltage. is it possible to get a demo code for such a reading?

I tried for a long time, also using processor expert and the manual or configuring other demos but couldn't find the solution.

I would greatly appreciate your help.

Tags (1)
0 Kudos
Reply
1 Reply

701 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Liat,

I think you use TWR-K60F120 to test the external analog voltage, the A80/B34 pin on the TWR-K60F120 are connected to PTD6 pin, the pin is multiplexed with PTD6/ADC0_SE7B/SPI0_PCS3/UART0_RX/FTM0_CH6/FB_AD0/FTM0_FLT0, so I think this is the procedure:

1)configure the pin as ADC0_SE7B.

SIM_SCGC5|=0x1000; //enable the PORTD gated clock

SIM_SCGC6|=0x8000000; //enable ADC0 gated clock

PORTD_PCR6&=~(0x700);  //use the PTD0 as ADC_SE7B

PORTD_PCR6|=0x00;

ADC0_CFG2|=0x10; //set MUXSEL bit as 1 to select the ADC0_SE7B rather than a

2)start conversion

ADC0_SC1n=0x07; //launch ADC conversion

unsigned short sample;

while(1)

{

while(!(ADC0_SC1n&0x80)) {}

sample=ADC0_Rn; //reading sample

}

Pls refer to the above code. If you still have issue, pls update the ticket, I will have a try.

BR

XiangJun Rong

0 Kudos
Reply