<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Differences in programming 8-bit ADC and 12-bit ADC</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/22332/differences-in-programming-8-bit-adc-and-12-bit-adc</link><description> 
Hi, 

 
I am currently trying to modify an existing code to display 12 bit
data (C8051F206) instead of 8 bit data (C8051F226). 

 
When I download the existing codes and run the program, my LCD is
able to display some values. However, when I modify</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Differences in programming 8-bit ADC and 12-bit ADC</title><link>https://community.arm.com/thread/99632?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2007 00:31:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7a4db29e-88ff-4a0c-b398-fd75b8726fbe</guid><dc:creator>AM Tang</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hey thanks!&lt;/p&gt;

&lt;p&gt;
It was my mistake in the syntax. You are right about the float
issue. Also, my analog input pin was faulty. After I reconfigured
another pin as input, it worked.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differences in programming 8-bit ADC and 12-bit ADC</title><link>https://community.arm.com/thread/88514?ContentTypeID=1</link><pubDate>Mon, 10 Sep 2007 10:57:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:757cd121-188d-4a6c-81af-6c04db680e04</guid><dc:creator>Neil Kurzmam</dc:creator><description>&lt;p&gt;&lt;p&gt;
First output the counts on the display. To make sure the A2D is
configured and working. Then Output more and more of the conversions.
Read your code. Note that going from 8 to 12 bits can make 16 bit
values overflow.&lt;br /&gt;
value=value*256 is good for 8 bits, but overflows at 12.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differences in programming 8-bit ADC and 12-bit ADC</title><link>https://community.arm.com/thread/99631?ContentTypeID=1</link><pubDate>Sun, 09 Sep 2007 23:19:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0d7f99f9-17cc-440a-b53d-1ea86f91eff3</guid><dc:creator>AM Tang</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Dan,&lt;/p&gt;

&lt;p&gt;
Thanks for your reply. However, when I changed from &amp;quot;3&amp;quot; to &amp;quot;3.0&amp;quot;,
I still could not get the program working.&lt;/p&gt;

&lt;p&gt;
I am wondering if there is anything wrong with my syntax or is
there anything needed to be changed to my current ADC
configuration:&lt;/p&gt;

&lt;pre&gt;
/*----------------
 ADC Configuration
 -----------------*/
        AMX0SL = 0xE0;  // AMUX Channel Select Register; Analog input at P0.0

        ADC0CF = 0x78;  // ADC Configuration Register
        ADC0CN = 0x40;  // ADC Control Register

        ADC0LTH = 0x00; // ADC Less-Than High Byte Register
        ADC0GTH = 0x00; // ADC Greater-Than High Byte Register
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differences in programming 8-bit ADC and 12-bit ADC</title><link>https://community.arm.com/thread/88515?ContentTypeID=1</link><pubDate>Sun, 09 Sep 2007 21:18:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3d855a72-064e-4d33-9b8c-cf999e5ec38a</guid><dc:creator>Dan Henry</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;bit_value = 3.2/(256);&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Here, a float constant divided by an integer constant yields a
float result to be assigned to the float variable &amp;#39;bit_value&amp;#39;.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;bit_value = 3/(4096);&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Here, the integer constant 3 divided by the integer constant 4096
an integer result of zero to be assigned to the float variable
&amp;#39;bit_value&amp;#39;.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differences in programming 8-bit ADC and 12-bit ADC</title><link>https://community.arm.com/thread/48549?ContentTypeID=1</link><pubDate>Sun, 09 Sep 2007 20:33:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b5b75f51-fdea-4f85-ad5f-0dd95b6fcbad</guid><dc:creator>AM Tang</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sorry another correction to my 8 bit code:&lt;/p&gt;

&lt;p&gt;
value=ADC0L;&lt;br /&gt;
value=value*256;&lt;/p&gt;

&lt;p&gt;
should be removed and replaced by:&lt;/p&gt;

&lt;p&gt;
value=ADC0H;&lt;/p&gt;

&lt;p&gt;
only.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differences in programming 8-bit ADC and 12-bit ADC</title><link>https://community.arm.com/thread/48548?ContentTypeID=1</link><pubDate>Sun, 09 Sep 2007 20:19:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f2b0228c-f9b2-4f6d-bd76-3c5ce2a90a37</guid><dc:creator>AM Tang</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sorry, this is for the 12 bit code:&lt;/p&gt;

&lt;pre&gt;
/*------------------------------------------------------
// Bit Resolution: result = Voltage reference*(4095/4096)
 -------------------------------------------------------*/

void bit_resolution()
{

        bit_value = 3/(4096);
        result = totvalue*bit_value;

}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>