Hi all,
I’m having a nightmare of a time trying to talk to an XBee in API mode over serial interface using .NET.
I’ve got two XBees, a coordinator on COM5 and an end point device with the address 5001 on COM6. If I use the X-CTU packet builder and send this down COM5 in HEX:
7e 00 14 01 01 50 01 00 08 00 04 42 6f 62 20 54 68 65 20 58 42 65 65 c8
then I get a response on COM5 and this back over COM6:
7e 00 1a 80 00 13 a2 00 40 8d 53 c9 3c 00 08 00 04 42 6f 62 20 54 68 65 20 58 42 65 65 c1
which is great.
When I use this code in .NET:
SerialPort port = new SerialPort("COM5", 9600, Parity.None, 8, StopBits.One);
port.Open();
byte[] buffer = { 0x7e, 0x00, 0x14, 0x01, 0x01, 0x50, 0x01, 0x00, 0x08, 0x00, 0x04, 0x42, 0x6f, 0x62, 0x20, 0x54, 0x68, 0x65, 0x20, 0x58, 0x42, 0x65, 0x65, 0xc8 };
port.Write(buffer, 0, buffer.Length);
port.Close();
I don’t get anything back at all. I’ve run both through a serial port monitor and both seem to be sending byte-for-byte identical data. I think I’m going mad here, has anybody got any ideas?
Thanks,
Ben.