What is IIRC? Dean Matthews Reliability Engineering Ford Engine Plant Bridgend Waterton industrial estate cf31 3pj South Wales, U.K Tel No: 0044(1656)672597 Fax No: 0044(1656)672558 Email: dmatth14@ford.com Room 25/118 ` Please consider your environmental responsibility before printing this e-mail -----Original Message----- From: Bond, Peter [mailto:PBond@TANDBERGTV.COM] Sent: 21 February 2002 09:35 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]:working out percentages > I am using a PIC16f877 and CCs compiler. Is there a maths > function that will enable me to calculate 50% of an integer > variable in a register and store the answer in another > variable, or would I calculate it myself. I may be missing something here, but is there a problem with doing a right shift? Or are you looking for something more generalised than /2 ? > Also is an integer 8 bit or 16 bit long. some books say it > is 8bit and others 16 bit. "It depends on the compiler" is the short answer. I'm assuming here that if you're referring to integer types, you are using a compiler... With the stuff I more normally use (gcc on 860s), an int is 32 bit, a short int 16 and a byte (usually defined as an unsigned char) is 8 - but, for portability, you should never depend upon those being consistent. This has been discussed before IIRC - perhaps a search of the archives would help? Peter This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television. If received in error please notify the sender and destroy the original message and attachments. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads