While trying to write simple MODBUS Master and Slave applications, I ran into a problem. I tried to send an unsigned char array over RS232 using WriteFile. In the other application, I tried to read the same unsigned char array using ReadFile. I know I have to use pointers, and it works up to a point. I've boiled it down to what looks like a data type range problem, but it shouldn't be.
I began using a single usigned char, defined as:
unsigned char test = 0x01;
and sending the char as &test in the WriteFile. That works fine. When I increase the value to 0x80(128) the value of test on the ReadFile side is 0. Anybody have any clue what's going on here/ how to make this work? I need to be able to have a value of 0xff, and I thought an unsigned char would take care of that.
Happy to post any more code if needed. Thanks.