Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 09:18:21 21:18


Login with username, password and session length


Pages: [1]
Print
Author Topic: RS485 Interface  (Read 10142 times)
0 Members and 1 Guest are viewing this topic.
Help
Junior Member
**
Offline Offline

Posts: 37

Thank You
-Given: 33
-Receive: 0


« on: November 04, 2007, 11:12:49 11:12 »

Hi,

I would to use RS485 for my interfacing between PC and few other serial module.

What's the step should i start on the Hardware and Firmware(Protocol) side?
Example I had 3 node (node1=PC, node2=MCU1, node3=MCU2).
My PC only had one serial RS232 port, and the MCU also only had one serial. If i would like to use standard RS232 for all the node in interface, so i just have to put a RS485-RS232 convertor? If yes, how the node recognize the protocol?

Did anyone have a simple sample code for RS485? I just want to get some idea. I had no problem with using RS232.

Thank You.
Logged
Dembo
Guest
« Reply #1 on: November 04, 2007, 11:53:30 11:53 »

Hi
If You move from poimt-to point (RS232) to network like RS485, You shouldd think about a lot of issues:
1. Who will be a master? how many masters allowed?
2. How to prevent simultaneous transmit? (collisions)
3. How You handle errors?

this is only a small part of problems in networking, even when only 3 nodes in it...

So dont try to create your own protocol, start from something ready, I recommend You ASCII mode MODBUS protocol, it's very simple and reliable. It divides the protocol to transport and application layers good enough, and there are a lot of samples about it implementation.

http://www.modbus.org/

http://en.wikipedia.org/wiki/Modbus

Logged
Help
Junior Member
**
Offline Offline

Posts: 37

Thank You
-Given: 33
-Receive: 0


« Reply #2 on: November 09, 2007, 07:02:07 07:02 »

Hi fren,

Can you guide me how to use the rs485 modbus? Where can i get the sample code for modbus?

I did find some source in net. But very few sample code is provided.

http://www.protocessor.com/techsupport/signup.asp
I try download the Free Modbus Source Code from this link but they not send the password to my email. Do you have the passward, please can you share with me?

The attach file is the modbus sample code also. After i look through the code, the sample is for TCP. and some of the function is missing.
libmodbus-1.2.1.tar

Please help me. 

Thank You.
Logged
bogdantk
Active Member
***
Offline Offline

Posts: 100

Thank You
-Given: 40
-Receive: 18


« Reply #3 on: November 09, 2007, 07:26:48 07:26 »

Hello
Password (case sensitive): ProtoCessor.com
All the best
Bogdan
Logged
lillbear
Senior Member
****
Offline Offline

Posts: 276

Thank You
-Given: 223
-Receive: 182



« Reply #4 on: November 09, 2007, 08:25:35 08:25 »

Well have looked at S.N.A.P Protocol its quite easy to implement also and there is examples for PIC, AVR and Parallax BasicStamps  Cheesy
Logged
Xwing
Active Member
***
Offline Offline

Posts: 210

Thank You
-Given: 588
-Receive: 1530



« Reply #5 on: November 09, 2007, 01:12:24 13:12 »

Quote
so i just have to put a RS485-RS232 convertor? If yes, how the node recognize the protocol?

For transceiver use MAX485, for software protocol modbus or snap.
Logged
Help
Junior Member
**
Offline Offline

Posts: 37

Thank You
-Given: 33
-Receive: 0


« Reply #6 on: November 09, 2007, 02:19:01 14:19 »

Hi,

Thank you everyone. Smiley

I'm using at89c52 microcontroller. Do you all use "modbuspw" ( http://www.protocessor.com/techsupport/signup.asp ) for this type of controller? This modbus is for PIC application. Please anyone can guide me how to apply "modbuspw" code for my microcontroller?

This "modbuspw" code got abit difficulty for me. Hope can get help from you all..

Thank You.
Logged
Silent_Thunder
Junior Member
**
Offline Offline

Posts: 69

Thank You
-Given: 56
-Receive: 20



« Reply #7 on: November 10, 2007, 09:42:03 09:42 »

Hi;
RS485 is not a comunication protocol, it is a network based on the 485 chips, the protocol you build yourself.
Regarding the MODbus, it is an industrial standard comunication protocol, quite good for building rubost network, but hard to impliment in small systems, and whatever you use it or make your own there is no different as long as you take care of the major point that Dembo mentioned earlier,
1- Which devices will be masters ?. and if you gonna build your protocol, it is better to make only one master and all the others will be slaves, in this case you could eleminate data collisions.
2- You sould map your network and assign an address for each device.
3- Your program should handle errors and deal with them, for example by getting confirmation from the slave you address and if you got no answer resend.
4- Determine the length of you data and minimize it as you can if you gonna use slow baud rates, and better to tell the slave how many data bytes it gonna recive and more better to send a check sum for the data sent, so the slave can confirm a succesful recive.
I think this is the major points you have to consider when building a network


Regards
 
Logged
microled
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 15
-Receive: 2


« Reply #8 on: November 20, 2007, 09:47:39 21:47 »

you can also use 485 for its added distance, ie point to point just like 232 or use master/slave with polling
Logged
spl
Newbie
*
Offline Offline

Posts: 21

Thank You
-Given: 35
-Receive: 1


« Reply #9 on: January 09, 2008, 05:56:33 05:56 »

Try to See www.rs485.com 
 They have circuit diagram for RS485  , Repeater ,HUB
 It work! Grin
Logged
waicon
Active Member
***
Offline Offline

Posts: 134

Thank You
-Given: 57
-Receive: 79


I'm learning to Dream...not Relaxing...zzZ


« Reply #10 on: August 30, 2009, 04:21:37 16:21 »

Hi;
RS485 is not a comunication protocol, it is a network based on the 485 chips, the protocol you build yourself...

i'm a beginner on RS485, did some PC to MCU projects using RS485; have some own learning protocol to share, its only transfer 3 bytes only:-
http://rapidshare.com/files/273454707/RS485_communication_protocol.rar

i having some interferance on signal line in my project, maybe its near to 32 notes where RS485 max. points, and A-B' voltage range measure which less 200mV( max. load effact) , i think should need a RS485 repeater, 1 repeater for 20 notes. any one kindly show me the link to buy or to make DIY ? 



   
Logged
spacetime
Guest
« Reply #11 on: September 30, 2009, 07:48:51 19:48 »

In general, there is no difference between RS232 and RS485 from the protocol point of view except that RS485 is not duplex and you need to switch between RX and TX mode.
You can have a multi/master configuration with some suitable algorithm.
If you know how to communicate with RS232 then you know also RS485.Just switch to TX before you start sending and back to RX when the packet is sent.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC