I want send hex value through serial port.
The device manual shows that data should be like this:
Protocol sent ’ENQ’ ’0’ ’0’ ’3’ ’,’ ’0’ ’0’ ’0’ ’ETX’ Hexadecimal 05 30 30 33 2C 30 30 30 03
The code:
_serial.BaudRate = 9600;
_serial.Parity = Parity.None;
_serial.DataBits = 8;
_serial.StopBits = StopBits.One;
_serial.Open();
byte[] bytesToSend = new byte[9] { 05,30, 30, 33 , 2C , 30 , 30 , 30 , 03 }; // This should be represent bytes equivalent to hex value
_serial.Write(bytesToSend,0,9);
i know that i should send this using byte array but i don't know how to represent the hex value in data byte array.
0xin front of your values. Like0x05and0x2C.