> Hola, I'm currently working on a project involving Analog's ADE7756 > Energy Meter chip. It has a 40-bit energy register to store the > accumulated energy. I'm coding in Hi-Tech C on a 16F876 and am having > troubles coming up with a good way to store the data and still be able > to use it as a simple atomic variable. > > PICC doesn't seem to care for long int's, and even still a long isn't > large enough to store the 40-bit number. A character array works for > now, but testing is becoming a pain since I'd like to be able to add and > multiply this number easily as well as output it using printf to my > console. > > A side note, Hi-Tech's printf produces G's, H's and I's when I print > using the %x format, last I heard those weren't hex values. :) > > Ideas? Suggestions? Is there a way to make a 40-bit int? Write 5 byte math routines in assembler and call them from C. You probably only need add, subtract, and maybe multiply and divide. These are easily extended from 4 byte routines. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.