I would just take 8 samples and do 3 bit shifts to the right to divide by 8. Or leave it as it is and use the 3 right most bits as the decimal part of your = result.... 0/8 to 7/8's >> Hi every body, >> I am trying to use the A/D of the PIC16F977. I have to collect 10 >> readings >> from the A/D register ADRESH. Then add them and take the average of the >> total which divide by 10. Fore example, if i get >> 2.5 volts which is 0111 1111 in bits at ADRESH register because i only >> care >> about the 8 high bits, (Right) >> 1.25 volts which is 0011 1111 in bits, (Right) >> . >> . >> . >> so on >> until 10 readings and then take the average. >> First, i have no clue how to implement the division >> Second,adding all that will be more than 8 bits. >> Can any body lead me to a program that do division in PIC?. Also, is it >> possible to stor more than 8 bits in a register until the division come >> along because after dividing the register the value will be reduced back >> to >> 8 bits. It is just the matter of storing the 10 bits? >> Thank you >> regards, >> Paul >> _________________________________________________________________________ >> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. >> -- >> http://www.piclist.com hint: The PICList is archived three different >> ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.