// Display byte in hex procedure printhex( i : byte ); var high, low : byte; begin high := i and 0xF0; // High nibble high := high shr 4; high := high + '0'; if ( high > '9' ) then high := high + 7; low := (i and 0x0F) + '0'; // Low nibble if ( low > '9' ) then low := low + 7; UART1_Write(high); UART1_Write(low); end; procedure DumpBuffer(var Buffer: array[0..511] of byte; size: word); // size must be > 16 !!! var Position: word; I, J: byte; Ascii: string[16]; Header: string[19]; CRLF: string[2]; begin CRLF := #13 + #10; Header := '0123456789ABCDEF'; Uart1_Write_Text(' '); for J := 0 to 15 do begin if J mod 4 = 0 then Uart1_Write(' '); Uart1_Write(Header[J]); Uart1_Write(' '); end; Uart1_Write_Text(CRLF); for I := 0 to word(Size / 16) - 1 do begin Ascii := ''; Position := (I * 16); PrintHex(Hi(Position)); PrintHex(Lo(Position)); uart1_write(':'); //uart1_write(' '); for J := 0 to 15 do begin if J mod 4 = 0 then Uart1_Write(' '); Position := (I * 16) + J; printhex(Buffer[Position]); if (Buffer[Position] >= ' ') and (Buffer[Position] <= '~') then StrAppendSuf(Ascii, Buffer[Position]) else StrAppendSuf(Ascii, '.'); end; uart1_write(' '); Uart1_Write_Text(Ascii); Uart1_write_Text(CRLF); end; Uart1_write_Text(CRLF); end;