Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 2 months ago.
putc and strange situetion
Hi to all i have this strange situation, i want write on serial communication the Hexadecimal number for use the Modbus RTU communication i write this easy code:
#include "mbed.h" Serial pc(SERIAL_TX, SERIAL_RX); DigitalOut myled(LED2); int main() { while(1) { myled = !myled; pc.putc(0xAA); // work well wait_ms(1000); } }
if i run this code all work well, if i use putty for hiperterminal and i see the the two exadecimal AA but if i use
pc.putc(0x03); //or pc.putc(0x03);
i don't see nothing. i don't know where is the problem can you help me? A.
1 Answer
10 years, 2 months ago.
Can you try a different terminal program? 0xAA isn't a standard ascii character so putty displays the hex value. 0x03 is a non-printable but valid ascii character. The correct thing for putty to do is not display it.
Can you try something like Hercules? http://www.hw-group.com/products/hercules/index_en.html
Select the serial tab at the top and then right-click and select Special characters->Hexadecimal. All non-printable characters will now be displayed as hex values in {}'s and hopefully you'll see {03} show up in the output.