NNTP-Posting-Date: Fri, 03 Jan 2003 12:45:52 -0600
From: firstname.lastname@example.org (John Fields)
Subject: Re: RS232 newbie - in need of assistance!
Date: Fri, 03 Jan 2003 18:39:52 GMT
Organization: Austin Instruments, Inc.
X-Newsreader: Forte Agent 1.5/32.451
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
On Fri, 03 Jan 2003 12:46:34 GMT, "Matt Foster"
>Hmm no code, sounds easy - but expensive?
No, maybe 20 bucks, tops.
>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.
OK. My plan is to send you characters when the buttons are pressed,
and no characters when the buttons aren't pressed. You shouldn't
need a line feed or anything else, all you'll need to do is
recognize the characters and use them to switch between the various
routines you'll use to write characters to the screen.
Here's the scheme:
Two 74HC165's will allow you to parallel load a 16 bit bit word and
spit it out in serial, so if we load your switch data in parallel
and then send it to the serial port at the baud rate you specify,
then your software should be able to read it. If we start with a 16
bit word and use 10 bits to send character data (1 start bit, 8 data
bits, 1 stop bit) with six bit times left over, which might come in
handy. If we use the 74HC193 to keep track of where we are, in
time, then all that's left to do is figure out how to handle the
LOAD/SHIFT, determine whether we need to debounce the switches or
not and, basically, bring the thing to life!^)
Here's what the data word will look like:
____ __ __ __ __ __ __ __ __ ________
Where the "boxcars" indicate that either a 1 or a 0 could be located
More specifically, if the leftmost data bit represented the position
of the first switch, and that switch was pressed, the data stream
would look lke this:
____ __ ________
If the second switch was pressed it would look like this:
____ __ ________
and so on. Thinking about it a little more, it might be possible to
get rid of the counter by recirculating the data through both shift
registers. That would get rid of a chip and maybe allow the
function you mention next to be easily implemented in hardware. I
don't know, I'll have to think about it for a bit.
>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
Professional circuit designer