Anyone see anything that would make this print out one byte off? The var sizes are mixed... 1 byte, 2 byte.... but the cprintf that prints em out<br>
thinks they are all 2 byte? How does a %d know if it has a byte or an int for a param?? Sorry about losing the indent.... hope its not too wierd to read....<br>
<br>
<FONT color=#008000 size=2><FONT color=#008000 size=2>

<div>//---ram copy of eeprom vars with order reversed size 40------------</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>int</B> ad4vraw; </FONT></FONT><FONT color=#008000 size=2>//823-&gt;0x33f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;---2 bytes</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> dispF; </FONT></FONT><FONT color=#008000 size=2>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;---1 byte</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> nunitsmax; </FONT></FONT><FONT color=#008000 size=2>//needle units max</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> nunitsmin; </FONT></FONT><FONT color=#008000 size=2>// min</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> ev2unitsmax; </FONT></FONT><FONT color=#008000 size=2>//extv1 units max</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> ev2unitsmin; </FONT></FONT><FONT color=#008000 size=2>// min</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> ev1unitsmax; </FONT></FONT><FONT color=#008000 size=2>//extv1 units max</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> ev1unitsmin; </FONT></FONT><FONT color=#008000 size=2>// min</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> emv2max; </FONT></FONT><FONT color=#008000 size=2>//extv1 mv max</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> emv2min; </FONT></FONT><FONT color=#008000 size=2>//extv1 mv min</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> emv1max; </FONT></FONT><FONT color=#008000 size=2>//extv1 mv max</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> emv1min; </FONT></FONT><FONT color=#008000 size=2>//extv1 mv min</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>unsigned</B> <B>char</B> voltsonbdisp; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> voltsontdisp; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> voltsonneedle; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>unsigned</B> <B>char</B> thermonbdisp; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> thermontdisp; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> thermonneedle; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> readtherm; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>unsigned</B> <B>char</B> extv2onbdisp; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> extv2ontdisp; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> extv2onneedle; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> readextv2; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>unsigned</B> <B>char</B> extv1onbdisp; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> extv1ontdisp; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> extv1onneedle; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> readextv1; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>int</B> needleoffset; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
</FONT><FONT color=#008000 size=2>//---eeprom init 40 bytes-------</FONT><FONT size=2><br>
<FONT color=#000000>#pragma data:eeprom //default config params set up for combo egt/boost deg F<br>
<B>int</B> eeneedleoffset=0; </FONT></FONT><FONT color=#008000 size=2>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;---2 bytes</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eereadextv1=1; </FONT></FONT><FONT color=#008000 size=2>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;----1 byte</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eeextv1onneedle=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eeextv1ontdisp=1; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eeextv1onbdisp=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eereadextv2=1; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eeextv2onneedle=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eeextv2ontdisp=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eeextv2onbdisp=1; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eereadtherm=1; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eethermonneedle=1; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eethermontdisp=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eethermonbdisp=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eevoltsonneedle=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eevoltsontdisp=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eevoltsonbdisp=0; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> eemv1min=0; </FONT></FONT><FONT color=#008000 size=2>//extv1 mv min 0-5V sensor</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> eemv1max=5000; </FONT></FONT><FONT color=#008000 size=2>//extv1 mv max sensata 75psig sensor for 30 psi boost</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> eemv2min=0; </FONT></FONT><FONT color=#008000 size=2>//extv2 mv min</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> eemv2max=5000; </FONT></FONT><FONT color=#008000 size=2>//extv2 mv max sensata 75psig sensor for 30 psi boost</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> eev1unitsmin=0; </FONT></FONT><FONT color=#008000 size=2>// min</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> eev1unitsmax=5000; </FONT></FONT><FONT color=#008000 size=2>//extv1 units max</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> eev2unitsmin=0; </FONT></FONT><FONT color=#008000 size=2>// min</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> eev2unitsmax=5000; </FONT></FONT><FONT color=#008000 size=2>//extv2 units max</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>signed</B> <B>int</B> eenunitsmin=0; </FONT></FONT><FONT color=#008000 size=2>// min</FONT><FONT size=2><br>
<FONT color=#000000><B>signed</B> <B>int</B> eenunitsmax=240; </FONT></FONT><FONT color=#008000 size=2>//needle units max</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>unsigned</B> <B>int</B> eead4vraw=823; </FONT></FONT><FONT color=#008000 size=2>//ad reading for 4.00V 823-&gt;0x33f</FONT><FONT size=2><br>
<FONT color=#000000><B>unsigned</B> <B>char</B> eedispF=1; </FONT></FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
<br>
<FONT color=#000000><B>char</B> eenamestr[]="DAVE TEICHMAN";<br>
#pragma data:data<br>
<br>
</FONT></FONT><FONT color=#008000 size=2>//--------------------------</FONT><FONT size=2><br>
<FONT color=#000000><B>void</B> readeeprom(<B>void</B>){<br>
</FONT></FONT><FONT color=#008000 size=2>//read eeprom params to ram</FONT><FONT size=2><br>
<br>
<FONT color=#000000>INTR_OFF();<br>
EEPROMReadBytes((<B>int</B>)&amp;eeneedleoffset, (<B>void</B> *)&amp;needleoffset,40);&nbsp; //&lt;---I think there's 40 bytes in the eeprom<br>
INTR_ON();<br>
}<br>
<br>
</FONT></FONT><FONT color=#008000 size=2>//--------------------------</FONT><FONT size=2><br>
<FONT color=#000000><B>void</B> readnameeeprom(<B>void</B>){<br>
</FONT></FONT><FONT color=#008000 size=2>//read name from eeprom to ram</FONT><FONT size=2><br>
<br>
<FONT color=#000000>INTR_OFF();<br>
EEPROMReadBytes((<B>int</B>)&amp;eenamestr, (<B>void</B> *)&amp;namestr[0],<B>sizeof</B>(eenamestr)); <br>
INTR_ON();<br>
}<br>
<br>
</FONT></FONT><FONT color=#008000 size=2>//--------------------------</FONT><FONT size=2><br>
<FONT color=#000000><B>void</B> saveeeprom(<B>void</B>){<br>
</FONT></FONT><FONT color=#008000 size=2>//save ram to eeprom</FONT><FONT size=2><br>
<br>
<FONT color=#000000>INTR_OFF();<br>
EEPROMWriteBytes((<B>int</B>)&amp;eeneedleoffset, (<B>void</B> *)&amp;needleoffset,40); <br>
INTR_ON();<br>
}</FONT><br>
<br>
</div>


<div></FONT>//--------------------------</FONT><FONT size=2><br>
<B>void</B> calmenu(<B>void</B>){<br>
</FONT><FONT color=#008000 size=2>//user config params</FONT><FONT size=2><br>
<br>
cprintf("cfg cmds: q=quit\n\n"<br>
" a read extv1 %d\n"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&lt;----1 byte<br>
" 1 extv1 on ndl %d\n"<br>
" 2 extv1 on tdisp %d\n"<br>
" 3 extv1 on bdisp %d\n\n"<br>
" b read extv2 %d\n"<br>
" 4 extv2 on ndl %d\n"<br>
" 5 extv2 on tdisp %d\n"<br>
" 6 extv2 on bdisp %d\n\n"<br>
" c read thermo %d\n"<br>
" 7 therm on ndl %d\n"<br>
" 8 therm on tdisp %d\n"<br>
" 9 therm on bdisp %d\n\n"<br>
" d extv1 min mv %d\n"<br>
" e extv1 max mv %d\n"<br>
" f extv2 min mv %d\n"<br>
" g extv2 max mv %d\n"<br>
" h ndl units min %d\n"<br>
" i ndl units max %d\n"<br>
" j extv1 units min %d\n"<br>
" k extv1 units max %d\n"<br>
" l extv2 units min %d\n"<br>
" m extv2 units max %d\n"<br>
" n volts on ndl %d\n"<br>
" o volts on tdisp %d\n"<br>
" p volts on bdisp %d\n"<br>
" r temp deg F %d\n"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&lt;----1 byte<br>
" s a/d cal %d\n",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&lt;----2 bytes<br>
" t user name %s\n",<br>
readextv1,extv1onneedle,extv1ontdisp,extv1onbdisp,<br>
readextv2,extv2onneedle,extv2ontdisp,extv2onbdisp,<br>
readtherm,thermonneedle,thermontdisp,thermonbdisp,<br>
emv1min,emv1max,emv2min,emv2max,nunitsmin,nunitsmax,<br>
ev1unitsmin,ev1unitsmax,ev2unitsmin,ev2unitsmax,<br>
voltsonneedle,voltsontdisp,voltsonbdisp,dispF,ad4vraw,namestr); <br>
}<br>
<br>
</FONT><FONT color=#008000 size=2>//-------------------</FONT><FONT size=2><br>
<B>void</B> calloop(<B>void</B>){<br>
</FONT><FONT color=#008000 size=2>//called from mainloop</FONT><FONT size=2><br>
<B>char</B> c;<br>
<br>
<B>while</B>(c != 'q'){ </FONT><FONT color=#008000 size=2>//</FONT><FONT size=2><br>
calmenu();<br>
crlf();<br>
putc('&gt;'); </FONT><FONT color=#008000 size=2>//prompt for input</FONT><FONT size=2><br>
c=getche();<br>
crlf();<br>
<B>switch</B>(c){<br>
<B>case</B> 'a': readextv1 = !readextv1; <B>break</B>;<br>
<B>case</B> '1': extv1onneedle = !extv1onneedle; <B>break</B>;<br>
<B>case</B> '2': extv1ontdisp = !extv1ontdisp; <B>break</B>;<br>
<B>case</B> '3': extv1onbdisp = !extv1onbdisp; <B>break</B>;<br>
<B>case</B> 'b': readextv2 = !readextv2; <B>break</B>;<br>
<B>case</B> '4': extv2onneedle = !extv2onneedle; <B>break</B>;<br>
<B>case</B> '5': extv2ontdisp = !extv2ontdisp; <B>break</B>;<br>
<B>case</B> '6': extv2onbdisp = !extv2onbdisp; <B>break</B>;<br>
<B>case</B> 'c': readtherm = !readtherm; <B>break</B>;<br>
<B>case</B> '7': thermonneedle= !thermonneedle; <B>break</B>;<br>
<B>case</B> '8': thermontdisp = !thermontdisp; <B>break</B>;<br>
<B>case</B> '9': thermonbdisp = !thermonbdisp; <B>break</B>;<br>
<B>case</B> 'd': adjemv1min(); <B>break</B>;<br>
<B>case</B> 'e': adjemv1max(); <B>break</B>;<br>
<B>case</B> 'f': adjemv2min(); <B>break</B>;<br>
<B>case</B> 'g': adjemv2max(); <B>break</B>;<br>
<B>case</B> 'h': adjnunitsmin(); <B>break</B>;<br>
<B>case</B> 'i': adjnunitsmax(); <B>break</B>;<br>
<B>case</B> 'j': adjev1unitsmin(); <B>break</B>;<br>
<B>case</B> 'k': adjev1unitsmax(); <B>break</B>;<br>
<B>case</B> 'l': adjev2unitsmin(); <B>break</B>;<br>
<B>case</B> 'm': adjev2unitsmax(); <B>break</B>;<br>
<B>case</B> 'n': voltsonneedle = !voltsonneedle; <B>break</B>;<br>
<B>case</B> 'o': voltsontdisp = !voltsontdisp; <B>break</B>;<br>
<B>case</B> 'p': voltsonbdisp = !voltsonbdisp; <B>break</B>;<br>
<B>case</B> 'r': dispF = !dispF; <B>break</B>;<br>
<B>case</B> 's': adcal(); <B>break</B>;<br>
<B>case</B> 't': getname(); <B>break</B>;<br>
<B>default</B>: calmenu();<br>
}<br>
cfgchk();<br>
calcparams();<br>
saveeeprom();<br>
_StackCheck();<br>
}<br>
}<br>
<br>
</div>
</FONT><div id='u8CAAA71AF66E10A-1438-60' class='aol_ad_footer'><FONT style="color: black; font: normal 10pt ARIAL, SAN-SERIF;"><HR style="MARGIN-TOP: 10px"><A title="http://toolbar.aol.com/moviefone/download.html?ncid=aolcmp00050000000011" href="http://toolbar.aol.com/moviefone/download.html?ncid=aolcmp00050000000011" target="_blank">Get the Moviefone Toolbar</A>. Showtimes, theaters, movie news, & more!</FONT> </div>