PDA

View Full Version : RS232 to RS485 to BSII microcontroller....... Need help with a concept or proc



Jimbo30
02-04-2010, 04:19 AM
For my project I will need to communicate at a distance of up to 200ft.· At the start point, I will be converting an RS232 signal to RS485 and at the end I will be using another RS485 chip to communicate with a BSII·microcontroller.· However, I am noticing some circuits differ with using the RTS (Request to send) line of the DB9.· This link shows the DB9's line being used
·
http://aquaticus.info/rs485_to_rs232#attachments
·
And this link shows the RTS line not being applied.· Furthermore, both RE and DE pins of the RS485 chip(s) are tied to ground both from the PC to the microcontroller:
·
http://rollette.com/rovrev2/rov2.jpg
·
Question is:· Do I absolutely have to utilize the RTS line?· Is it crucial?· I will be using a VB program to both send data to the BSII microcontroller and receive data, such as temp, depth and heading.·· Any help would be appreciated.··· http://forums.parallax.com/images/smilies/smile.gif

Mike Green
02-04-2010, 04:36 AM
As far as the Stamp is concerned, you only need RX, TX and ground. If available, the Stamp can make use of CTS / RTS and DTR / DSR for handshaking, but they're rarely used. With RS485, you can have a half-duplex connection (one pair of wires) or a full-duplex connection (two pairs of wires). With a half-duplex connection, each end has to be able to control the direction of the communications (transmit vs. receive) and that requires another line (like RTS). The Aquaticus adapter uses RTS for this purpose and you'd need that. In the case of the Stamp, you don't need the RS232 driver, only the RS485 driver since the Stamp already uses logic levels rather than RS232 (except for the programming port which is not intended for this sort of use because it echos everything received back to the sender).

Jimbo30
02-12-2010, 10:37 AM
Thanks Mike! I am learning a little here and a little there as I go. I was able to turn the ROV lights on a few days ago using a VB6 program and the BSII module. I have also found out that I do need the /RE and DE tied together and inputting to the BSII to control transmit or receive mode on the BSII. The only thing that concerns me, though, is NOT getting my commands conflicting with each other on the BSII and VB6 sides. I figured I could sequentially send my temp, depth and compass readings to the VB6 side, but wouldn't it conflict while I am sending my motor commands from the Joystick (Joystick commands are through the VB6 program)?

Mike Green
02-12-2010, 11:33 AM
I'm glad you're getting some things to work. It's not clear from your message just what you're asking and you haven't supplied much information about your setup.

If you have a half-duplex connection, you can only send information in one direction at a time and both ends of the connection have to know what they're doing at any time. It helps if one side is always the master. When one side is a Stamp, that's usually the best side to make master. Even with a full-duplex connection, a Stamp can only do one thing at a time, so it will either transmit or receive, but not both. When it's transmitting, it's not looking at the receive end of things and will miss anything sent from the other end.

In your particular case, it would help for the Stamp to be master. It could send motor commands to the PC or it could send a request for information from the PC and the PC would respond with the temp, depth, and/or compass readings.

Jimbo30
02-12-2010, 12:06 PM
I will snap some pictures tomorrow and post them later in the day. I will also go more in depth about the project and provide VB and BS code for the working lights. I was planning on using the BSII subsurface rather than topside. Thanks for all your insight.