Internet PLC Forum

General => Technical support => Topic started by: Jane on June 13, 2008, 01:23:18 AM

Title: i want send Hex data to com port1
Post by: Jane on June 13, 2008, 01:23:18 AM
hi

i want send and receive Hex data to com port1 with protocol 10(ie creating user own custom protocol.)

i want send hex data " &HE1 &HE1 &HFE &H01 &H01 &H01 &HE3 &H53 &H53 &H0D"

i coded that

'------send hex data to com port1

A$=HEX$(&HE1)+HEX$(&HFE)+HEX$(&H01)
A$=A$+HEX$(&H01)+ HEX$(&H01)
A$=A$+HEX$(&HE3)+HEX$(&H53)+HEX$(&H53)+HEX$(&HOD)

B$=NETCMD$(1,A$+"~")

'-------receive hex data from com port1
E$ = INPUT$(1)




How can i send and receive hexa data?

Title: Re:i want send Hex data to com port1
Post by: support on June 13, 2008, 03:36:02 PM
NETCMD$ only works if the response is ASCII string terminated with Carriage return (ASCII 0D hex).

You can use OUTCOMM to send binary number out of the serial port and INCOMM to receive binary number.

For a working example of implementation communication using INCOMM and OUTCOMM, please download the sample program: "modbusFunction04.zip" from the following link:

http://www.tri-plc.com/yabbse/index.php?board=2;action=display;threadid=298