hello dear all, I have a problem in showing hex packet on LCD.I send a hex file by UART and i want to show it on LCD. but LCD show different number. like : i send 02 but it show 202. I taught maybe it's because of baud rate but it isn't work still. could you tell me what's the problem? i use keil and my ARM is LPC1768
#include <LPC17xx.H> definitions #include "LCD.h" #include "string.h" #include "sys.h" #include "lcd.h" #include "touch.h" #include "exti.h" #include <stdio.h> #include "uart.h" unsigned char lcd_buf[50]; unsigned char s[10]; void Delay (uint32_t Time) { uint32_t i; i = 0; while (Time--) { for (i = 0; i < 5000; i++); } } /* ********************************************************************************************************* * Description: The function is setting font colors¡¢brush colors and the area of clear * Arguments : None * Returns : None ********************************************************************************************************* */ void Load_Drow_Dialog(void) { LCD_Clear(WHITE); POINT_COLOR=Red; //Setting font colors LCD_ShowString(216,0,"txt"); //Displaying screen clear area POINT_COLOR=BLUE; //Setting brush color } /* ********************************************************************************************************* * Description: Main function * Arguments : None * Returns : None ********************************************************************************************************* */ int main (void) { int i=0; int j=0; SystemInit(); LCD_Init(); Load_Drow_Dialog(); UART2_Init(); while(1){ for(i=0;i<7;i++){ s[i]=UART2_GetChar()-190; } sprintf(lcd_buf,"%d-%d-%d-%d",s[3],s[4],s[5],s[6]); LCD_ShowString(40,60,lcd_buf ); Delay(4000); } }