Why instead of averaging 10 readings don't you average only eight (or sixteen) readings ? Eight or sixteen are far more easy to divide by (divide by eight <=> shift right 3 bits, divide by sixteen <=> shift right 4 bits) Cheers Joan > -----Mensaje original----- > De: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]En nombre de Paul Chicofsky > Enviado el: miircoles, 28 de febrero de 2001 19:54 > Para: PICLIST@MITVMA.MIT.EDU > Asunto: [PIC]division in assimbly > > > 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.