12-Bit Adc

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
luthra_arun
Posts: 18
Joined: Wed Nov 11, 2009 7:39 am

12-Bit Adc

Post by luthra_arun »

Hi to all,
I am using pic controller having the 12-bit adc .I just read the data from the Adc channel 0 in ReadasInt and display on the LCD when i vary from 0-5 v i got the value from 0-1023 instead of 0-4095. below i had set the settings in flow code.

/**** Macro Substitutions ****
0 = Which ADC Channel
100 = Acquisition time
3 = Conversion Speed
0 = VRef+ Option
500 = VRef Voltage x 0.01V
******************************/

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times

Re: 12-Bit Adc

Post by Sean »

The Flowcode ADC ReadAsInt macro currently returns a 10-bit value regardless of the resolution of the target hardware (maintaining compatibility between devices).

If full 12-bit resolution is required, it should be possible to modify a copy of the appropriate fcd and adc C code file to achieve this (simulation will remain at 10-bit resolution).

Which chip are you using?

luthra_arun
Posts: 18
Joined: Wed Nov 11, 2009 7:39 am

Re: 12-Bit Adc

Post by luthra_arun »

hi sean,
I am using pic18f4523 having the 12-bit adc.There is a problem with the C code using in flow code the problem is the variable i had declare in the flow code is not called in c code macro.The other way what i thing is to same the adc value in controller innternal eeprom and read in the flow code but it will take the time .What you suggest.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times

Re: 12-Bit Adc

Post by Sean »

There are several postings on the forum showing how Flowcode variables can be used within C code:
Convert all characters in the variable name to upper-case and add the prefix FCV_ for global variables, or FCL_ for macro local variables.

I will look into some options for the ADC resolution issue. This is now a Flowcode V4 topic.

If you can post your ADC question in the Flowcode V4 section of the Forum, I will reply to it early next week.

luthra_arun
Posts: 18
Joined: Wed Nov 11, 2009 7:39 am

Re: 12-Bit Adc

Post by luthra_arun »

If you can post your ADC question in the Flowcode V4 section of the Forum, I will reply to it early next week.
But in Flowcode V4 fourm the new post botton is not visible.That is why i am posting my problems in General PICmicro programming.

User avatar
Steve
Matrix Staff
Posts: 3434
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: 12-Bit Adc

Post by Steve »

Please see the "posting on the V4 forum" for information about this:
http://www.matrixmultimedia.com/mmforum ... &sk=t&sd=a

Post Reply