For best resolution, you need to do a 16 bit multiply (B * 255) and then divide by A. Graham ----- Original Message ----- From: Peter Betts To: Sent: Wednesday, April 11, 2001 7:16 AM Subject: Re: [PIC]: Maths on a 16F876 > See. > > http://www.piclist.com/techref/microchip/math/basic.htm > > for maths routines. > > Search the PICLIST.COM web pages they have a world of information that has > helped me a lot. > > Pete > > > -----Original Message----- > > From: ext David Duffy [mailto:piclist@AUDIOVISUALDEVICES.COM.AU] > > Sent: Wednesday, April 11, 2001 3:07 AM > > To: PICLIST@MITVMA.MIT.EDU > > Subject: [PIC]: Maths on a 16F876 > > > > > > Hi, > > I need to implement the following equation in a 16F876. > > RESULT = (255 / A) * B > > A and B are bytes (each have possible values of 01 to FF) > > RESULT is a word (unsigned) for a timer routine counter. > > Speed is not an issue. Code space is not really either. > > What's the best way to do this sort of thing? > > Regards... > > > > -- > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu