In SX Microcontrollers, SX/B Compiler and SX-Key Tool, FORD wrote: Hi All, Am just wondering if I am going about this the right way, in SXBasic. I have serial data coming into an SX pin, and want to shift that data into a byte variable. I'm just not sure if its working correctly... string is a byte variable. RA.0 is the serial input pin immediately after I detect the start bit it goes something like this... pauseus 417 'align the first data bit to the middle of the bit, correct for 1200bps startbit = RA.0 'get start bit pauseus 833 'pause 1 bit period for counter = 0 to 7 'loop for 8 bits of data string.7 = RA.0 'get the serial input pin state and put it into bit 7 of 'string' variable string = string SHR 1 'shift bits right pauseus 833 next parity = RA.0 'get parity bit pauseus 833 stopbit = RA.0 'get stop bit pauseus 833 Is there a problem with getting a pin state into a variable this way ? I mean can you just put any bit of a byte variable directly onto a pin ? I cant use the serin command, because its E81 comms. Cheers, Chris, Weastern Australia. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=187628 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)