I have a device which responds to serial port requests. Using portmon I can see a request formatted as a six byte hex string.
e.g. x'02031005E6 the last byte being a crc which I can work out.
I don't seem to be able to write this data to a comm port as if I write
[Byte[]] $request = 0x02,0x03,0x10,0x05,0xE6
$port.Write($request)
I see
0.00189600 powershell_ise IRP_MJ_WRITE LSerial0 SUCCESS Length 12: 32 20 33 20 31 36 20 35 20 32 33 30
where I was expecting Length 6: 02 03 10 05 E6
even if I write
[Byte] $request = 0x02
$port.Write($request)
I get
0.00188317 powershell_ise IRP_MJ_WRITE LSerial0 SUCCESS Length 1: 32
I have a nasty feeling I am misunderstanding how Powershell handles hex strings/arrays and will assume the sucking of air through clenched teeth on the reply.