In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bernoulli wrote: John, Maybe the following will help. I just sat down to do this, and it appears to work correctly. I am not saying this is exactly what you want, but I believe it may give you insight as to how to make yours work. ...I hope. Gary [code] ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- IByte var byte ' byte to be converted HByte var byte ' bytes to represent Hundreds digit TByte var byte ' bytes to represent Tens digit SByte var byte ' bytes to represent Singles digit TByteTemp var byte ' temporary byte ' ========================================================================= PROGRAM Start ' ========================================================================= Start: Main: IByte = 123 ' initial byte to be converted to 3 ASCII values HByte = IByte/100D ' divide decimal value of 100 TByteTemp = IByte //100D ' remainder after diving by decimal value of 100 Tbyte = TByteTemp/10D ' divide hundreds remainder by decimal value 10 SByte = TByteTemp//10D ' remainder after dividing by decimal value of 10 HByte = HByte + 48D ' add decimal value 48 to convert to ASCII value TByte = Tbyte + 48D ' add decimal value 48 to convert to ASCII value SByte = SByte + 48D ' add decimal value 48 to convert to ASCII value GOTO Main [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=260591#m260811 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)