View Full Version : Configure stamp to handle 2 serial connections?

01-24-2010, 09:45 PM
Hi, I am building a small board that will serve as a middle man between a alarm controller and a PC. When the alarm is activated it will send serial data to the middle board which will perform tasks and then pass the serial message on to the PC. The communication must be bi-directional. If the PC sends a serial message to the middle board, it receives it performs some task and then passes the serial message on to the alarm board. Luckily there will never be a time when both the alarm controller or PC need to communicate simultaneously. So, the middle board stamp must be wired to ser comm with the alarm and also to ser comm with the PC. Has anyone ever tried this? I was planning on setting p0 for ser comm with the alarm and p1 with the pc. Any questions comments appreciated.

Mike Green
01-24-2010, 10:32 PM
A Stamp can send or receive serial data on any I/O pin, but only one operation at a time. The receive operation is not buffered, so the Stamp has to be executing a SERIN statement for it to "see" the data, otherwise it gets ignored. The problem with your proposal is that the Stamp can only listen to one I/O pin at a time. If there's some handshaking supported at the PC and alarm board, this could work out. In particular, if the alarm and PC only send if their CTS (clear to send) handshake line is true, the Stamp can provide that when a SERIN is executed (read the chapter on SERIN in the BASIC Stamp Syntax and Reference Manual).

01-25-2010, 01:19 AM
Thanks Mike I appreciate it.