In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: Bean's right, you need to use an external clock source for serial. You can use a 4 MHz resonator since your rate is so slow. On the receive side you may want to allow for upper- and lowercase letters in your command header; here's how we do it at EFX-TEK with our serial accessories: [code]' Use: theByte = RX_BYTE { ConvertToUppercase } ' -- converts "a".."z" to "A".."Z" if "ConvertToUppercase" bit 0 is 1 FUNC RX_BYTE IF __PARAMCNT = 1 THEN ' option specified tmpB2 = __PARAM1 ' yes, save it ELSE tmpB2 = 0 ' no, set to default ENDIF IF BaudRate = BR2400 THEN SERIN Sio, BaudSlow, tmpB1 ' for Prop-1/BS1 ELSE SERIN Sio, BaudFast, tmpB1 ' for Prop-2/BS2 ENDIF IF tmpB2.0 = Uppercase THEN ' convert to uppercase? IF tmpB1 >= "a" THEN ' lowercase? IF tmpB1 <= "z" THEN tmpB1.5 = 0 ' ...yes, make uppercase ENDIF ENDIF ENDIF RETURN tmpB1 ENDFUNC[/code] If you're expecting a character to be a letter then the function above can convert it to uppercase by using this calle: [code]char = RX_BYTE 1[/code] In my programs I use a constant called "Uppercase" so my listing is more readable: [code]char = RX_BYTE Uppercase[/code] If a non-letter character is received it is not changed by the function. Note, too, that the function above checks the baud rate jumper on our boards; you can remove this check for a fixed baud system. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=195677#m195798 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)