HI,
Please help me i am using CC2530 ADC but not getting correct values after conversion. Please find attached files used in program and results found.
#include <ioCC2530.h> unsigned char data_H,data_L; unsigned int x=0; void uart() { CLKCONCMD = CLKCONSTA & 0xB8; //clock control while(CLKCONSTA & 0x40); PERCFG&=~0x01; //Alernative 1 selected for UART0 peripheral. P0SEL |= 0x0C; //P0.2 and P0.3 peripheral mode enabled.` U0CSR |= 0xC0; //UART mode selected for USART0. U0UCR |= 0x00; //H/w flow control disabled U0GCR |= 0x08; U0BAUD = 0x3b; //Baud rate set to 9600 bps } void delay() { for(unsigned int i =0;i<50000;i++); //15msdelay for(unsigned int i =0;i<50000;i++); } int main() { P0SEL |= 0x01; APCFG |= 0x01; //Anable the analog i/p channel ADCCON2 = 0x30; // enable the AVDD5 pin reference & 12 bit,AIN0 channel select ADCCON3 |= 0xB0; ADCCON1 |= 0x3F; //enable the start conversion sequence,start select & disable the random generators while(!(ADCCON1 & 0x80)); //chech the eoc bit enable or not while(ADCCON1 & 0x40); //check the any conversion is running or not ADCCON1 |= 0x40; //enable the start conversion sequence,start select & disable the random generators while(!(ADCCON1 & 0x80)); //chech the eoc bit enable or not data_H = ADCH; data_L = ADCL; uart(); U0DBUF=0xAA; while(!(U0CSR & 0x02)); U0DBUF=(data_H & 0x0F); while(!(U0CSR & 0x02)); delay(); U0DBUF= data_L; while(!(U0CSR & 0x02)); while(1); }