|
KJennejohn has it right.
You CAN use HSERIN/HSEROUT to talk between Atoms. This uses a 'hardware' UART built in to the PIC 16F876 chip the Atom uses. And the SETHSERIAL command enables an interrupt driven buffer in the MBasic library, so that will work as you want it to.
RS-232 is both a signalling level standard (+-5 to +- 10 volts) as well as a byte-oriented protocol (send the start bit, bit 0,1,2,3,4,5,6,7, parity bit, stop bit) (all at a particular baud rate).
It turns out, it's possible to send the 'protocol', without doing the "level shift". This is sometimes called "TTL RS232", since it's the RS-232 byte protocol done over 0 and 5 volt lines. This will work fine between two Atoms, if they're on the same board.
If you want to use the HSERIN from an "external device" -- like your PC or a GPS unit -- THEN you're going to have to put a MAX232 level-shifter in there. www.kronosrobotics.com sells a nice DB-9 with MAX232 adapter for $15 or so.
It might be helpful to know that the MAX232 actually 'inverts' the signal -- a 0 volt TTL input becomes a +10 volt output, while a +5 volt TTL input becomes a -10 volt output. That's where all that "invert" or "not invert" stuff comes from in the manual -- the Atom can accept either one, on a SERIN/SEROUT command. The HSERIN/HSEROUT port doesn't have software 'inversion'.
But all that means is that between two Atoms, you're missing two inverters -- one for 'sender' and one for 'reciever' -- so in effect the resulting signal has all inversion cancelled out. Thus one Atom can send to another using HSERIN/HSEROUT.
|