We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am working with the C8051F580 MCU.
using my own hardware.
The board is connected to teraterm via UART0
8bits, 115200
I am trying to print a hex number, see very simple code below.
for some reason I always get two extra "zeros" added at the end.
#include <stdio.h>#include <ctype.h>#include <string.h>#include <stdarg.h>#include <float.h>#include <stdlib.h>//#include <math.h> #include <c8051f58x.h>#include "C8051F580_defs.h"#include "compiler_defs.h"#include "PUTCHAR.c"
unsigned char i;
i = 0x12; printf("i = 0x%02Xh", i);
terminal shows:
i = 0x1200h <== two extra zeros, it does not matter if I add the (char) casting before "i" in the print expression.
Any suggestion will be appreciated
Thank you
Fausto Bartra