Go Down

Topic: RS485 to PC/Hyperterminal (Read 6 times) previous topic - next topic

Piplodocus

Hello!

I want to control an Arduino down a long cable in a noisy RF enviroment, so I figured RS485 is best (balanced and long cables).

So I'll used an RS232 to 485 converter on the PC, then as far as I can tell, I connect my cable to a 120? terminating resistor and MAX485 chip, then connect the TTL side of this to my arduino serial pins. I'll then use MS hyperterminal (until I write some better software) to send it a multi-character string. The arduino then acknowledges the command, works out the command and performs it, then replies to say it's complete.

Will that work? Do the hyperterminal serial messages via RS232, then converted to RS485 signal make sense to the Arduino or does it have other characters/handshaking stuff that'll confuse my Arduino sketch, or does it "just work!"?

If I do need data interpretation are there any C/Arduino libraries etc I can use (been randomly looking at modbus libraries and anything that mentions 485 in the description, without it making much sense)? Still a bit confused about the interfacing from a data point of view! In at the deep end with this project at the mo'!   :smiley-sad-blue:

Thanks!

Piplodocus

P.S. Read this, but didn't follow all the code. http://real2electronics.blogspot.com/2009/09/arduino-and-rs485-english-version.html

Would I really need all that bit to do handshaking?

robtillaart

Quote
I'll then use MS hyperterminal (until I write some better software)


There are much better terminal programs than hyperT. e.g putty - http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Piplodocus

Putty will do! Will it work by just typing a command into putty? Obviously I can turn flow control, XON/XOFF, etc off if required.

I just know hyperterminal better!  :~

Igor R

#4
Apr 02, 2011, 06:39 pm Last Edit: Apr 02, 2011, 06:49 pm by Igor R Reason: 1
Hi,

You can use a terminal soft to test your comms. It´s not a problem.
The RS485 only defines a physical layer (voltages), because of that, you need to create a protocol (rules, messages, etc). The code which you can follow in my blog is an example based on a professional product. It´s just an example, but you can create your own. I mean, if you send an "a", you are going to receive an "a" in your Arduino. You don´t need to do anything special... But for sure, create a protocol is the best thing to do.
Another example of protocol is modbus over rs485.(http://www.modbus.org/docs/Modbus_over_serial_line_V1.pdf)

If you use CAN bus in stead of RS485, the controller is going to do all the "dirty" job (messages, rules, CRC, ...) for you. You can follow some examples here (http://secuduino.blogspot.com/). I´m afraid, at the moment it´s only in spanish.

Regards,  ;)


Igor

Go Up