Doubts about the library RS-485

General discussion on mikroC.
Post Reply
Author
Message
legnar
Posts: 6
Joined: 19 May 2011 14:00

Doubts about the library RS-485

#1 Post by legnar » 19 May 2011 14:06

Good afternoon,

I'm developing a software that will run on a computer. He will talk to a board
PICPLC16B using the library's RS-485 is MikroC PIC version 8.2.0.0. I put the card PICPLC16B as a slave and the a network address, after I shot the message soon below:

dat [0] = 1;
dat [1] = 2;
dat [2] = 3;
RS485Slave_Send (dat, 3);

I captured this message from your computer:

150 1 3 1 2 3 253 169

After some testing I came to the conclusions below:

1. Byte 0 = 150 - Start of transmission.
2. Byte 1 = 1 - Address of network card
3. Byte 2 = 3 - Number of bytes transmitted
4. Byte 3 = 1 - Corresponds to the value of the variable dat [0]
5. Byte 4 = 2 - Corresponds to the value of the variable dat [1]
6. Byte 5 = 3 - Corresponds to the value of the variable dat [3]
7. Byte 6 = 253 - Byte used to validate the incoming message
8. Byte 7 = 169 - End of transmission

I have the following doubts about the interpretation of message received:

* Byte 6 = 253 - The Byte is used to validate the received message?
* What is the logic used to create this byte that validates the message?

I realize that byte (byte 6 = 253) varies depending on the network address and the message sent

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Doubts about the library RS-485

#2 Post by filip » 02 Jun 2011 14:47

Hi,

Please, look at the bottom of the RS-485 topic in the help file, it is explained there.

Regards,
Filip.

Post Reply

Return to “mikroC General”