From: Fred Bloggs
User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
X-Accept-Language: en-us, en
Subject: Re: RS232 newbie - in need of assistance!
Date: Fri, 03 Jan 2003 15:57:27 GMT
NNTP-Posting-Date: Fri, 03 Jan 2003 07:57:27 PST
Organization: EarthLink Inc. -- http://www.EarthLink.net
Matt Foster wrote:
> Hmm no code, sounds easy - but expensive?
> Here's my basic request then (I figured I need 5 switches now)
> 5 push to make switches, (say 1,2,3,4,5), when switch 1 is pressed, I'd like
> the screen to say "1" and the same for 2 3 4 5.
> The final thing will be a bit more complex oin the software side, all I need
> the hardware to do is send one of 5 characters (they can be anything) to the
> serial port (does it need to be followed by a line feed or anything?) so
> that the program can recognise what was pressed.
> If it's simple and possible, then I'd like the PCB to filter out which
> button was pressed first out of 1,2,3 and 4 - then not accept any more
> inputs until switch 5 is pressed (a reset). But I can do this software side
> if necessary.
You cannot send arbitrary binary 8-bit patterns over the RS-232, you
should stick to the printable ASCII character codes. Since you have only
5 switches that would make it only 32 different characters. The simplest
thing to do would be to dedicate each switch to a fixed bit position,
parallel load the total switch state into a shift register and shift
through a RS-232 driver to the port at the required baud rate-this
process repeating at a fixed scan rate like 100Hz. This can be done with
a single low-cost in-circuit-programmable PLD from Lattice Semiconductor: