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.

[50pts]RS485 Network with 1 Master and 2 PIC slaves

Status
Not open for further replies.

mouzid

Full Member level 5
Joined
Jun 22, 2007
Messages
248
Helped
9
Reputation
18
Reaction score
0
Trophy points
1,296
Activity points
2,876
rs485 network

Hello,

I've just designed an RS485 network. The network was successfully tested by connecting two PCs to the network using the Hyperterminal.
In the second step of my ork, my goal is to control 2 Matrix led displayer from the PC. The 2 Matrix led Displayer are connected to the Netwok via an interface RS232/485 and displays the data coming from the PC. A pic 16F876 is used for communication with the PC and also for controling the led matrix.

If I send a data from the PC, will the two led Matrix display it ?
How to send data fo different destination, I mean send a text to be displayed to one Displayer and another data for the second displayer ?

Danke.
 

pic rs485

well i hope there is some micropoccesor at the diplay end , too. so that they can convert RS485/RS232 into the format diplay understand.

Be specific when u ask questions
 

    mouzid

    Points: 2
    Helpful Answer Positive Rating
pic rs485 network

use a controller as a filter at each end
and design your own frame format
which contains some type of addressing (eg 1Byte)
 

    mouzid

    Points: 2
    Helpful Answer Positive Rating
rs485 pic

Thanks you for replying my friends.

sau_sol said:
use a controller as a filter at each end
and design your own frame format
which contains some type of addressing (eg 1Byte)

According to your reply, this mean that when I the PC send the data the two microcontrollers will receive it and control the led matrix making the same message readable.

I liked your Idea sau_sol but I can't see how to implement it.
Actually the PIC uses the usart that reads the data in a serilal manner.
Suppose that I affect an adress to each PIC let say 00 Hexa for PIC1 and FF for PIC2.
The best and most simple way to select which PIC to communicate with is to chose the frame format such that we select first the PIC and then send the data to It. For exemple, suppose the frame is 5 byte data ie 11 00 22 33 44 hexa. So, to display a message in the Display2 (contoled by the PIC2) the frame is: 11 00 22 33 44 FF.
The problem in this exemple is the 5th byte (00). Once detected, the first PIC will consider this byte an adress and consequently will read the next byte and will wait for the reste of the frame.

Do you know how to resolve the problem ?
 

how to control rs 485 network

mouzid said:
Thanks you for replying my friends.
Do you know how to resolve the problem ?
the simpliest way to select one byte as escape character,
for example 0xAA
if MCU sees this byte it means next byte would be command byte.
command byte could be for example:
0x00 - switch on receiver MCU1,
0x01 - switch on receiver MCU2,
0x02 - switch off receiver MCU1,
0x03 - switch off receiver MCU2,
0xAA - receive 0xAA character.
switch off means do not receive and process any character but 0xAA, (to be able to switch on).

but better to send frames like:
[sync byte/addr byte] [dat len] [data byte0] .. [data byte N] [CRC].
 

pic slave 485

What i use is a simple frame format

[address][data]
1B any


store all this in a array (because you know the maximum size of your data frame )
and compares the first byte with the address
if it matches then use the frame else reset the array index to 0 (i.e discard the frame)

now your problem is how to know the frame
so the standard method is waiting for 5 character space
i.e. whenever you receive a byte start timer for a time equal to 5 character receiving time and if you receive another byte within that time reset the timer to 0
or what I use is the timeout of about 60ms
 

Re: rs485 network

mouzid said:
Hello,

I've just designed an RS485 network. The network was successfully tested by connecting two PCs to the network using the Hyperterminal.
In the second step of my ork, my goal is to control 2 Matrix led displayer from the PC. The 2 Matrix led Displayer are connected to the Netwok via an interface RS232/485 and displays the data coming from the PC. A pic 16F876 is used for communication with the PC and also for controling the led matrix.

If I send a data from the PC, will the two led Matrix display it ?
How to send data fo different destination, I mean send a text to be displayed to one Displayer and another data for the second displayer ?

Danke.

Could you or any one else please explain to me how does PIC can scroll the Matrix and receive data from the PC at the same time ?
As my knowledge the receiving function is an infinite loop that halt when a byte is detected. Since the RS232 receiving is based upon interrupt/Loop the PIC will no longer scroll the matrix when waiting for new data from PC.
How did you resolve this problem ?
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top