Author Topic: i want send Hex data to com port1  (Read 12842 times)

Jane

  • Newbie
  • Posts: 10
  • I'm a llama!
    • View Profile
i want send Hex data to com port1
« 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?

« Last Edit: June 13, 2008, 01:30:55 AM by Jane »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:i want send Hex data to com port1
« Reply #1 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
Email: support@triplc.com
Tel: 1-877-TRI-PLCS