What does a simple bit-shifting routine look like and how does it work. Most division examples on the piclist are confusing to me. I need a real basic example I can reverse engineer and understand. -----Original Message----- From: Drew Vassallo [mailto:snurple@HOTMAIL.COM] Sent: Monday, February 04, 2002 11:44 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]:Help! How do can I do simple division? >For example, I have a number between 0 and 255 and I want to know how many >times 10 can be divided into the number. >Is there a simple way to achieve this? Check out www.piclist.com and look for Nikolai's code generator for multiplication and division by a constant (in your case, 10). If you're not into REAL multiplication and division, you can always do this (I suppose this technique would qualify as "simple"): clrf Temp Div_By_10 movlw 0x0A subwf Your_Number, W btfss STATUS, C goto Done incf Temp, F movwf Your_Number goto Div_By_10 Done ..... at the end, "Temp" holds the whole number of times that your number is divided by 10. Note that I do not recommend this method, but it is worth mentioning that it IS a valid division method. It's just not nearly as fast in general as a real bit-shifting routine. --Andrew _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- 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