Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Serial 2 button keypad

Status
Not open for further replies.

west4948

New Member
Hey,

Currently I am trying to setup two spst pushbuttons to send button press data via a serial port. And I am completely lost as to how I should do this so that the computer can recognize the data being sent. Any help would be appreciated.

Thanks.
 
What kind of program are you using to read the serial port? Can you set the port parameters to 1200baud,N81? Can you read chars from the port?
Seems like you could bias the serial line to the Mark level, and then capacitively couple in the Space level when a switch is pushed. Each switch push would cause the line to go from Mark to Space (START bit) as each switch is pushed.
To distinguish one switch from the other, use two different capacitors to create different RC time constants, such that in one case the Space level lasts ~ 3 baud, and the other lasts ~ 6 baud. The characters read in at each switch push will be different enough so that you can recognize from the received characters which switch was pushed. Setting the RC time-constant depends on the baud rate the port is set for. By using No Parity, every puesdo character will be read in...
 
Last edited:
You could use the CTS and DSR lines as these can be read directly. You don't state which computer or programming language and so it's difficult to advise further.

@MikeMl
I like that idea but you would need good switches to avoid contact bounce or change to an even lower speed. Hyperterminal will manage 110 baud.

Mike.
 
Thanks for the input.

I really am looking for a solution involving a script without the need of programming a circuit board or PIC, if that is even possible. I was curious if there was a way to recode pins 1 and 2 as inputs and have the computer detect any changes in these two pins, as a response.

I am open to any programming languages or suggestions.

At the moment I am just trying to figure out the basics of how to do it so that I can research it. This is for a windows xp 32-bit computer.

Thanks.
 
Last edited:
Connect the switches (with pull-up or pull-down resistors) to the handshake lines, not the actual serial port, then monitor the handshake lines in the program.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top