Set SEREN signal active to enable send mode for the transceiver (and usually to disable receive).Send the required sequence of characters, waiting for the TDRE flag to become set, between characters.After the final character is sent, wait for the TC flag to become set.Set SEREN inactive to revert to receive mode.
Message Edited by bigmac on 2007-02-0802:25 PM
Daniel Morley wrote:The sendmessage works find. The recieve function is where I just cann't get a handle on. I am using the send message to check the SCI1D for any sign of life. It is giving me 000 as an output. Reguardless of what data I send.
I appologize for piggy-backing onto this discussion. But I too am about to start a RS-422/485 design, using a MC9S08QG8 as the master micro.
For development of the system, I am wondering what you all might recommend for hardware. For instance, is there a good eval board that has a 485 transceiver which can be connected to a PC for debug?
Thanks for your recommendations.
Dear Irob,
So you're promoting the QG8 as a master. Yoda would be proud huh?
If I had to do it w/ available stuff, I'd use the DEMO9S08GQ8, wich already has a RS-232 interface, a gender changer (change DB9 female to male) and use a shelf PC RS-232 to 485 converter. Remember to use one QG8 pin for flow control (RTS or DTR).
The same type of converter could be used for sniffing the network.
I hope it helps,
Celso
Hi Rob,
Yes, Realterm is great for this. (I think I may have put you on to it previously).
If you use a demoboard you can simply use say a MAX232 to convert the 232 back to TTL then you can use say a MAX491 to make your 485 interface (along with another output for transmitter control). I have several products that talk on a 2-wire RS-485 bus. I also make a converter with automatic flow control to interface RS-232-only devices onto the bus. This is simply a MAX232 and a MAX491 with a 555 monostable monitoring the Tx and driving the Tx enable for 1 byte time and a bit. Many commercial converters use a similar circuit. If you use an automatic converter then there is nothing special to do for RS-485 over RS-232. Even without the only difference between RS-232 and RS-485 is driving the Tx enable (if 2-wire). This is simply turn it on before write the SCI, then wait for the last byte to actually leave and turn it off.
Yes, that's right, Peg! I do have you to thank for with the discovery of RealTerm.
Not to muddy the waters, but in fairness, I recently purchased one of I2C chip's boards (which is the developer of RealTerm, I guess). Using RealTerm to debug I2C traffic was far from non-trivial. We had a very hard time with RealTerm's interface. Finally gave up and bought a competitor's product from The Board Shop.
But I digress.
Realterm sounds nice to me! I'll evaluate that! Thanks Irob!
Cheers,
Celso
For my development system, we had the actual boards in house pretty quick, so no eval board for the CPU.
The other end is quite important though, the data for your RS485 bus.
We started with a real low cost USB to RS485 device from an outfit called Light-O-Rama. Basically it's an FTDI chip in a small housing with RJ45 plugs for the RS485 interface.
I later switched to a quad serial port box from Quatech. These are switchable between RS232, 422 and 485. They have a version with voltage protection too.
For monitoring I went with Free Serial Port Monitor by http://www.hhdsoftware.com/ I find this software gives all that I expected from our old HP serial protocol analyzer.