Transmitting

[At master]

BYTE Srbuf[10];

 

Cmd[0] = 2;                                  //The number of listeners + 1 (here, there is one listener)

      Cmd[1] = TalkerAdrs;                     //The address of device that sends data (own address)

     Cmd[2] = ListenerAdrs;                        //The address of device that receives data

Ret = GpTalk(Cmd, Srlen, Srbuf);   //Srlen = data length: Srbuf = buffer that stores data

 

[At slave]

BYTE Srbuf[10];

 

Cmd[0] = 0;                                   //Indicates no multi line message

Ret = GpTalk(Cmd, Srlen, Srbuf);   //Srlen = data length: Srbuf = buffer that stores data

 

image\Line.gif

Notes: To send data, writing a terrible program may be needed, actually it can be done in several lines of code. As a flow, it is required only to specify the master, listener and data to be sent. At first, creates a array.

Cmd[0] = 2;                        //The number of listeners + 1 (here, there is one listener)

Cmd[1] = TalkerAdrs;      //The address of device that sends data (own address)

Cmd[2] = ListenerAdrs;   //The address of device that receives data

If there are two listeners, adds Cmd[3], and sets Cmd[0] to 3.

 

Next, uses the GPTalk function to send data. GpTalk function is described as follows.

GpTalk(Cmd, Srlen, Srbuf);

Specifies the beginning address of the Cmd array for the first parameter of the GpTalk function.

Please make sure that the value of Srlen must not exceed the number of data in Srbuf (the number of bytes). If exceeded, invalid data may be sent to the destination device, and the program operation may be unexpected.

Up to now, the transmission routine is created.