console.c

来自「MP3 Player Source Code」· C语言 代码 · 共 60 行

C
60
字号
#include "board.h"#include "console.h"/**\file console.c * Console function implementations. */ /** hexadecimal character set */extern code const unsigned char lcd_hexchars[17];/** Write a Code Constant string to console */void ConsoleWrite(char code *str){  while (*str)    {      ConsolePutChar (*str++);    }}/** Print a 16-bit hex value on Console */void ConsolePutHex16 (unsigned int value){  ConsolePutChar(lcd_hexchars[value>>12]);  ConsolePutChar(lcd_hexchars[(value>>8)&0xf]);  ConsolePutChar(lcd_hexchars[(value>>4)&0xf]);  ConsolePutChar(lcd_hexchars[(value)&0xf]);}/** Print an 8-bit hex value on Console */void ConsolePutHex8 (unsigned char value){  ConsolePutChar(lcd_hexchars[(value>>4)&0xf]);  ConsolePutChar(lcd_hexchars[(value)&0xf]);}/** Print a 16-bit unsigned integer value on Console */void ConsolePutUInt(unsigned long value){  xdata unsigned char valueString[10];  char c;  for (c=0; c<10; c++){    valueString[c]=value % 10;    value = value / 10;  }  c=9;  while ((valueString[c]==0) && (c!=0))    c--;  for (;c!=0;c--)    ConsolePutChar('0'+valueString[c]);  ConsolePutChar('0'+valueString[0]);  ConsolePutChar(' ');}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?