View previous topic :: View next topic |
Author |
Message |
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
How to Establish RS-485 communication |
Posted: Wed Nov 10, 2010 4:32 am |
|
|
hi,
I want to establish Rs-485 communication, I went through the modbus site and got some idea about it, moreover, I did go through the modbus example provided with the complier..however i did not understand much.
I need to send my analog values using 485. I need to make a slave and the master will be PC.
Please suggest something, wherein I can read more documents, understand the communication and proceed ahead.
Thanks,
Sid |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Wed Nov 10, 2010 6:18 am |
|
|
Sounds like your project is to have a PC get an analog reading from a PIC.
If so you certainly do not need MODBUS protocol for that program!
Start simple, program the PIC to 'echo' anything it receives back to the PC. Examples are in the compiler examples folder...
Big stumbling block will be the PC. Unless it has a real RS232 comport, you'll have to use a USB-RS232 interface or something else. Be sure to use a 'max232' chip with the PIC.
There are plenty of examples with the compiler for communications, you just have to start small and build upon what you learn.
Once you have the communications working, code and add the 'read the analog' segment to the communications segment. Again, examples are in the examples folder.
The more time and effort you spend reading, coding, testing, re-reading....etc. the better you'll understand these neat little PICs ! |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Wed Nov 10, 2010 10:48 pm |
|
|
Thanks for the reply,
I have tried establishing communication successfully, however, I'm finding it difficult to implement modbus. I don't understand the holding registers, CRC etc. I would like to learn the basics of modbus, so please suggest to me something wherein I can understand the fundamentals of modbus.
thanks,
Sid |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
|
Posted: Wed Nov 10, 2010 10:58 pm |
|
|
If you have just one master and a slave in the network then you may not need RS 485, as RS 485 is meant for several slaves connected to a master(s).
Also if the distance between the PC and the slave is not much (say less than 5 feet), then RS 232 may be OK.
Search in google for RS 485/RS 232 projects there are numerous examples there, also search this forum.
For RS 485 you need an interface IC like the SN75176. On the PC side a RS232-RS485 converter is also required. A simple one can be made using a RS232 IC and the SN75176.
I suggest you start by reading up on the basics, its possible RS 232 may do the job for you, this will reduce the hardware components and complexity of the project.
thanks
a |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Thu Nov 11, 2010 5:08 am |
|
|
thanks for your reply,
Well i have a distance that is more than 15 feet and needs to connect my PC to multiple devices. the device is an analog receiver and i need to transmit them to PC via 485, Rs-232 is not possible in this case.
My PC will be master and my Device will be slave.
So i read quite a few forums and got a fair bit of idea about 485 communication and modbus protocol.
However, reading through the Modbus code provided with the examples with picc it was difficult to understand.
Do revert back if someone can suggest me where I can learn more about the communication and protocol.
Thanks,
Sid |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 11, 2010 12:41 pm |
|
|
Use Google with the following search string. There's tons of stuff on
Modbus out there:
|
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
|
|
|