I want to convert characters recieved from MatLab into unsigned or signed integers in Keil... how do I do that?
"My fellow group members will not send me characters but they will send me integer values" The 8051 serial interface (and a PC's COM: port) handles data a byte at a time. Therefore, you need to know: 1. How many bytes make up an "integer?! 2. If your "integers" are more than 1 byte, in what order are those bytes sent?
scanf() converts ASCII to binary. If the producer program is sending you binary integers, you do not need scanf(). Instead, you would just receive the data directly into your destination integer. You might use a C union, with a byte array overlaying an integer. Or just use pointer arithmetic.
U16 myInt; U8* nextByte; len = 0; nextByte = &myInt; while (len < sizeof(myInt)) { *nextByte++ = WaitForSerialChar(); ++len; }