Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/14/07 18:30
Read: times


 
#143274 - mmmhhh one more time
Responding to: ???'s previous message
>> Ya i did post my real code...

If so, where is your display code ?

>> I used signed or unsigned char...

do you know the difference between signed and unsigned ?

>> adc_sum >>=4; // /16 => 8 BIT result

take a look at the given code example. Due to the loop (for) you will take 16, 8 BIT, adc samples.

adc_sum += ADC0H; short form of
adc_sum = adc_sum + ADC0H;

will add those 16 samples to adc_sum (adc_sum is declared as an integer because 8 BIT + 8 BIT is at least more then 8 BIT ;-)) and

adc_sum >>=4;

will divide it by 16 so you get the average of 16 samples and the result will fit in to 8 BIT. Hope you understand whats going on? If you simply take just one sample how do you know that this is not a peak that you measure ? therefore you should take a couple of samples and build an average.

>> and my LCD display this: {{{{{{{{

So again, where is your display code ? Without seeing your complete code its impossible to help. Watch out for ITOA.

If you are still interested in getting some help then please take your time and:

1. post your complete code
2. try to understand the given code
3. describe the steps you tryed to make the code up and running

List of 30 messages in thread
TopicAuthorDate
ADC Problem            01/01/70 00:00      
   Circuit ?            01/01/70 00:00      
   Clarify?            01/01/70 00:00      
   Crosspost            01/01/70 00:00      
      Clarification            01/01/70 00:00      
         Still no circuit            01/01/70 00:00      
         Power supply            01/01/70 00:00      
   What about the adc lowbyte ?            01/01/70 00:00      
      Power Supply            01/01/70 00:00      
         Power supply            01/01/70 00:00      
            Power Supply            01/01/70 00:00      
      ADC lowbyte            01/01/70 00:00      
         sorry for confusing you but            01/01/70 00:00      
            Thanks for the time            01/01/70 00:00      
               mmmhhh one more time            01/01/70 00:00      
                  LCD code            01/01/70 00:00      
                     No majic            01/01/70 00:00      
                     delay            01/01/70 00:00      
                        Writing Timing Loops in C            01/01/70 00:00      
                           Lucky            01/01/70 00:00      
                              Very true!            01/01/70 00:00      
                                 Your adc value must be 123. {            01/01/70 00:00      
                                    Power Supply Problem            01/01/70 00:00      
                                       We can not see what you are looking at            01/01/70 00:00      
                                          current limiting power supply?            01/01/70 00:00      
                                             Power Supply            01/01/70 00:00      
   Power Supply            01/01/70 00:00      
   ADC0804 with 8051            01/01/70 00:00      
      Start a new thread!            01/01/70 00:00      
      Sorry Dude!!!            01/01/70 00:00      

Back to Subject List