communication protocol

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
saravana_3
Posts: 61
Joined: Thu Dec 20, 2007 4:23 pm
Location: singapore
Contact:

communication protocol

Post by saravana_3 »

Hi friends,
what is the meaning of the communication protocol, what is the purpose of it, what I found we can give any value for the any variable to declare as the communication protocol, but the condition is the hex value must be same for master and slave declaration.
thanks
Saran
saran

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: communication protocol

Post by Benj »

Hello Saran

In the past I have created systems like this.

Master - Sends out commands with data depending on operation.

eg

0x80 - Master Present
0x81 - Master Polling Nodes
0x82, 0x40, 0x50 - Slave do something with the data values 0x40, 0x50.
etc

Slave - Receives commands and then checks the following bytes for data.

eg
if(incoming_byte >= 0x80 && incoming_byte < 0xFF)
{
change command mode to new command
}
else if (incoming_byte < 0x80)
{
receiving data to go with last received command.
}
else nothing received

Hope this helps.

Post Reply