BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 10:41 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Re: Atom 2 Atom Hser Communications w/o RS-232
PostPosted: Thu Apr 26, 2007 8:04 am 
Hi.
RS232 levels (+/- 25 Volts, +/- 12V typically) are not needed. TTL levels (0 - 5 Volts), as come out of the PIC naturally, will do the job.

All the RS232 chips do is allow the PIC to A. talk over long distances, or B. talk to a PC, where the serial port uses RS232 levels by default.

Also, after you wire the two pins together, you don't have to invert the levels of these signals.
Two pins are Ok if you plan on doing half-duplex, where one device talks at a time. This is used in Master-Slave situations, where one device ONLY starts a conversation. It then switches the same pin to input and waits for a response. The Slave starts the pin as an input. After receiving and processing the message, its pin is set to output and the response sent out.
Full-Duplex needs four pins. This allows both devices to send and receive at the same time.
HSer is the only way to go. This gives you a small buffer in hardware to trap a number of bytes. This allows the CPU to crunch code largely undisturbed and not miss any traffic coming in.
Software serial is something of a pain, but is OK for slow traffic. However, you have to distract the processor to constantly monitor the serial input or risk losing the start bit and therefor bollix the value of the incoming byte.

'Luck on your project!
kenjj


Top
  
 
 Post subject: Re: Atom 2 Atom Hser Communications w/o RS-232
PostPosted: Thu Apr 26, 2007 8:07 am 
Oops. TTL levels are good IF THE TWO PICS ARE CLOSE, like, on the same board, say like a foot apart. Otherwise, if on seperate boards any distance apart, you need RS232 chips, like the MAX232.

kenjj


Top
  
 
 Post subject: Atom 2 Atom Hser Communications w/o RS-232
PostPosted: Thu Apr 26, 2007 10:49 am 
I have several manuals, searched this site (found great stuff!) gone blind on endless data sheets, including PIC16F87XA Data Sheet (way deep for me) and it appears to me that the Hser is intended (at least) to communicate Hserout to Hserin and to do so between each atom, from p14 to p15, inverted only. Neat!

All in the background, all "automatic", you just pick up your messages when you want.
EXCEPT*
*you MUST use extra external RS-232 circuitries (not included) or it wont work?
This disappoints me a bit

I may just be me; I am self-taught about computers, electronics and etc.
(which basically means I know where my keyboard is, usually)
I don't really know anything yet about RS-232 and already have a long list of fascinating micro-computer things I'm working to learn. =)

So my question, can anyone confirm:
Is it true that Hser between atoms (basic) will not make ANY type of communications, stand-alone?
An external RS-232 is required for any and all communication?

If it's true, learning about RS232 goes right to the top of my priority list, no regrets. =)
I'm sure its a good idea sometime soon anyway.

Should I keep looking for the way Hser will work stand-alone or slow down on that, and focus on RS-232 communications.


I thank you for any opinions you have about this


BEX


Top
  
 
 Post subject: Re: Atom 2 Atom Hser Communications w/o RS-232
PostPosted: Thu Apr 26, 2007 10:00 pm 
Offline
Citizen

Joined: Sat Mar 08, 2003 11:00 am
Posts: 40
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.


Top
 Profile  
 
 Post subject: Re: Atom 2 Atom Hser Communications w/o RS-232
PostPosted: Thu Apr 26, 2007 10:00 pm 
Outstanding!
kenjj, allanlane, you two rock!

Thank you, both, for this information!
This is a big help.


BEX


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO