Hallo,
how can I convert a HEX into a Char without special Freepascal Unit? (I use Mikroe Pascal für Atmel AVR)
I have 53 and need S on LCD
program Uart_Test;
{ Declarations section }
// Lcd module connections
var LCD_RS : sbit at PORTC2_bit;
var LCD_EN : sbit at PORTC3_bit;
var LCD_D4 : sbit at PORTC4_bit;
var LCD_D5 : sbit at PORTC5_bit;
var LCD_D6 : sbit at PORTC6_bit;
var LCD_D7 : sbit at PORTC7_bit;
var LCD_RS_Direction : sbit at DDC2_bit;
var LCD_EN_Direction : sbit at DDC3_bit;
var LCD_D4_Direction : sbit at DDC4_bit;
var LCD_D5_Direction : sbit at DDC5_bit;
var LCD_D6_Direction : sbit at DDC6_bit;
var LCD_D7_Direction : sbit at DDC7_bit;
// End Lcd module connections
var beeper : sbit at PortC1_bit; //Piepser
VAR str_length, empfang : WORD;
laenge : WORD;
//Output_str : String[255];
Output_str : array [0..255] of char;
lt, n, read_byte : BYTE;
delim: array [0..3] of char;
output_byte : array[0..255] of char;
//output_byte : BYTE;
//output_hex : array[0..42] of CHAR;
procedure Read(); iv IVT_ADDR_USART0__RX; ics ICS_AUTO;
Begin
output_byte[lt] := Uart1_Read();
inc(lt);
end;
begin
{ Main program }
DDRC.1:=1;
Lcd_Init();
LCD_CMD(_LCD_CURSOR_OFF);
UART1_Init(9600);
SREG_I_bit := 1; // Interrupt enable
RXCIE0_bit := 1;
// delim[0] := 0x0A; //delimiter set to LF = 10 = 0x0A
//delim[1] := 0x00; //delimiter must end with NULL character
Beeper:=1;
LCD_CMD(_LCD_CLEAR);
LCD_Out(1, 1, 'Start');
delay_ms(1000);
lt:=0;
// for n:=0 to 10 DO UART1_Read();
// RXCIE0_bit := 1;
While TRUE DO
Begin
//IF lt >= 10 THEN BEGIN
ByteToHex(output_byte[34], output_str) ;
//bytetostr(output_byte[34],output_str);
LCD_Out(2,1, Output_str);
delay_ms(100);
lt:=0;
LCD_CMD(_LCD_CLEAR);
RXCIE0_bit := 1;
//end;
end;
end.