Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CC2541: Getting ADC converter going

$
0
0

Part Number:CC2541

Adding ADC function to an existing product that uses  CC2541.  Having a tough go getting the ADC going on P0_7

Confirmed that the output of a differential opamp is putting just over 2 VDC  on P0_7  (pin 12)

Have tried to distill down to the simplest form but haven't gotten it running yet.

Probably missing something.  Have played with it for a while and read as much as I could find here.

Any assistance appreciated.

This code runs very early on boot up: 

P0DIR = 0x00;

P1DIR = 0x00;

P2DIR = 0x00;

P0INP = 0x00;

P1INP = 0x00;

P2INP = 0x00;

P0SEL = 0x80; // P0_7 is A/D

P1SEL = 0x00;

P2SEL = 0x00;

APCFG = 0x80;

HalAdcInit();

HalAdcSetReference(HAL_ADC_REF_AVDD);

uint16 reading = HalAdcRead(HAL_ADC_CHANNEL_7, HAL_ADC_RESOLUTION_12);

printf("Reading = %d \r\n", reading);

 


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>