Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Commicate PC to PIC16F877 using 485 protocol

Status
Not open for further replies.

Husanto

Junior Member level 1
Joined
Aug 16, 2007
Messages
16
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Activity points
1,375
pic16f877 rs485

Hi,

Can any one help me how to design circuit for convert RS232 to 485 converter?? i need to communicate PC and PIC16F877 using 485 protocol. if any one already try it, please let me know...

thanx...
 

485 protocol

Just as a side note, 485 is not a protocol just a electrical standard (physical layer ) https://en.wikipedia.org/wiki/Physical_layer, about the RS232 to RS485 conversion, search with Google give you a lot of info on the subject, e.g.:

**broken link removed**

https://www.rmv.com/232-485.pdf

and more others, also look at the attached schematic (not tested).



Regarding the protocol you've to build it from yourself, e.g. you can try to implement some standard one like the MODBUS or simply make your own.

Bye
Powermos
 

pic16f rs485

Thanx u for the information, but how to communicate PIC and PC using modbus??can give a sample program??


Thanx
 

pic16f877 and rs485

Hehe.....i means how to make system modbus using PIC, if using PLC is very easy and i already try it. but i don't know how to communicate to PIC?? Please help me....
 

pic16f877a rs485

i think you must find a free library of mudbus for pic in C..

:)
 

rs485 pic16f877

@Husanto

Well I think now is time to do some details.
What you're thinking to do, if I've understand right, is try to interconnect some devices over a RS485 bus using a master builded around a PIC microcontroller.

At first you've to define the device to use with the phisical layer, as you've to do a RS485 you need to use a differential transmitter-receiver with enable. To be more clever at first you've to choose the driver to use, some useful link here:

**broken link removed**

a widely used and also a low cost driver is the DS75176B model:

**broken link removed**

After that you've to think about the bus and how it work, you can think about one master and several slave, your master is the only device able to start a communication over the bus (otherwise you will have bus collision due to multiple access on the bus) all the other device will act as a slave then into the idle state every slave must be in listening mode with the receiver section of the driver enabled, the transmitting section of every slave must be disabled.

Now you've to think how reach every slave trough the bus, there is only a way, each slave device must have a different address, so for example slave can be from 001 to 999 and use for the master address 000.
About addressing you've to take in account this aspect when you're thinking about the protocol. Into the communication protocol you've to reserve a field for the address, in this way when the master start a communication only the slave which have the specified address will be allowed to reply.
After the master trasmission the output driver of the master should be turned off because the master now has to wait a reply from the requested slave.
When the desired slave have processed the command this one must have to active the trasmitting section and send the reply over the bus, when the reply is completed the transmission section will be deactivated to release the bus.
That's all, about the protocol you can start with a simple ASCII based one and then move to more efficient and complex binary type.
For example, as a simple ASCII protocol, you can use:

STX ADDRESS INFO ETX

where:

STX = Sart Of Transmission char (decimal code 2)
ADDRESS = may be three char address field from 000 to 999
INFO = char about the info that you've to transmit/request
ETX = End Of Transmission char (decimal code 3)

also you can think about a mixed protocol ASCII and binary.
Of course this is a very basical example bcz you don't have a CRC check about the data, you can append a binary field with CRC check and so on...

Hope this can be useful.
Bye
Powermos
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top