Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 09, 2016, 08:40:36 08:40


Login with username, password and session length


Pages: [1]
Print
Author Topic: Problem communication PC to PIC using RS485  (Read 5756 times)
0 Members and 1 Guest are viewing this topic.
We2
Guest
« on: July 08, 2008, 11:14:20 11:14 »

Hi,

I have problem about communication between PC to PIC16F877 using 485 protocol. can any one give me a sample program for PIC to communicate PC and PIC. and circuit for RS232 to Rs485 converter??
Logged
maddoc
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 49
-Receive: 14


« Reply #1 on: July 08, 2008, 12:06:57 12:06 »

RS485 isn't a protocol, it's just a standard for sending signals. You alone decide on the protocol that you want to use for communication.

I have only used PIC to PIC over RS485 and it is very simple.

On the software side, in the PIC program you have to set up serial communication according to your needs.
The TTL to RS485 converter chip I used was the TI SN75176. Its RE receive enable pin is active LOW and its DE driver enable pin is active HIGH, so you can use just a single I/O line to controll it.

For the PIC to receive data you have to keep the RE receive enable pin of the converter LOW (to GND) and the DE driver enable pin of the converter to LOW (to GND).

For the PIC to send data you have to keep the RE receive enable pin of the converter HIGH (to Vcc) and the DE driver enable pin of the converter to HIGH (to Vcc).
You cannot receive and send at the same time over a 2 line data bus.

On the PC side you will have to use a line besides TX and RX to handle the DE/RE pins of the converter chip. You will also have to use a RS232 to TTL converter (MAX232) to connect the TI SN75176 to a PC serial port.
Logged
DTiziano
Active Member
***
Offline Offline

Posts: 102

Thank You
-Given: 35
-Receive: 159


« Reply #2 on: July 08, 2008, 12:33:49 12:33 »

I suppose you have some knowledge on RS485 standard.
With the annex circuit you do not need to worries about change the drive direction.
The 74123 will do it automatically on every character the PC send out.
The 485 driver is nomally set in input mode (485 > 232), the start bit trigger the 123 that switch the driver direction for some time.
The circuit is setted to work at max 9600 boud (pulse time on 123 output about 2 mS set by R6-C9 value).
I suggest to set the switch time to al least 2 character length (at 9600 boud 1 char = 1 mS).



Logged
We2
Guest
« Reply #3 on: July 08, 2008, 06:30:14 18:30 »

Thanx u about the reply...but i already test connection between PC and PIC but it not work. my connection is
PC - RS232 - Max485  ------  max485 - PIC. my problem is RE and DI, i connect it to RTS pin in PC and i try to send data using mikrobasic terminal and it not any data received by PIC. what wrong?? can any one give me a sample circuit for this connection and sample program for PIC. Thanx u very much....
Logged
Silent_Thunder
Junior Member
**
Offline Offline

Posts: 57

Thank You
-Given: 28
-Receive: 17



« Reply #4 on: July 12, 2008, 08:56:07 08:56 »

Hi;
In the link below, you gonna find a circuit that automatically handle the RS232 <> RS485 data flow.
hope this resolve your problem, and be carefull to set the PC and the PiC to the same baud rate.

http://www.rs485.com/pasc24wr.html
Logged
pelctronics
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 8
-Receive: 11


« Reply #5 on: July 12, 2008, 12:41:35 12:41 »

You have Sample of HWW connection  in microbasic libraries help...also include source code Wink
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