Jump to content
emailcausey

Measuring external voltage

Recommended Posts

I am using the adc_soc example to convert an analog voltage signal to a digital one. The pins that the example uses are ADCINA (J1.6) and ADCINA2 (J1.8). I first connected

 

J1.6 : 3.3 V pin

J1.8 : GND pin

 

and received very nice digital values of ~4096 and 0, respectively. What is important is that each of these functions individually. In other words, if I disconnect pin J1.8, for example, I still have a reading of 4096 V from J1.6.

 

However, what I really want to do is measure the voltage signal from a battery pack (which is also divided by a voltage divider) which is equal to ~2.88 V. So, I connected

 

J1.6 : 2.88 V

J1.8 : analog GND

 

and received digital values of ~3200 and ~250, respectively. Moreover, when I measure these pins individually these values change to ~1900 and ~1800.

 

I realize that I need a good reference value (or I need to incorporate this into my code), but I am uncertain how I should proceed. I read that I need to do something with VREFLO and VREFHI, but that there are no pins designated for VREFLO and VREFHI. How should I set these reference values?

post-1078-1426471721988_thumb.jpg

Share this post


Link to post
Share on other sites

I found the document:

 

TMS320x2802x, 2803x Piccolo Analog-to-Digital
Converter (ADC) and Comparator Reference guide

 

To be helpful, if you dont have it.

 

Search for SPRUGE5F on TI's site.

 

I think in your ADC_init code you want:

 

ADC_setVoltRefSrc(myAdc, ADC_VoltageRefSrc_Int);   // sets adc to internal reference

According to the chips data sheet pin 12 on the Tms320F28027 is VREFLO.

Datasheet also says it always tied to ground.

 

or for external source:

 

ADC_setVoltRefSrc(myAdc, ADC_VoltageRefSrc_Ext);  // for external reference source

In this case you would have your VREFHI connected to pin 10 on the micro(J5.6 on C2000 launchpad)

 

I looked at the example you are using and its in there as an internal source.

 

Hope this helps

Tim

 

 

Share this post


Link to post
Share on other sites

The error you're seeing could also be caused by the first sample errata on these parts.  Basically when you fire off a SOC, the first conversion it does has some error to it.  In the examples you should see that two SOC are configured for the same trigger source.  The result from the first sample is throw away and the second is used.  Make sure you are doing this in your code.

 

Another thing to consider is that for really high quality A to D conversion you want to buffer the signal you're trying to read.  This is more of an issue for dynamic signals, but do be mindful of the impedance you are driving the ADC with.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×