lcdchar.c

来自「AVR单片机的C语言源程序,包括按键扫描EEPROM通讯LCD显示数码管显示等等」· C语言 代码 · 共 62 行

C
62
字号
/* 
  LCD user defined characters demo
  
  CodeVisionAVR C Compiler
  (C) 2000-2002 HP InfoTech S.R.L.
  www.hpinfotech.ro
  
  Chip: AT90S8515
  Memory Model: SMALL
  Data Stack Size: 128 bytes

  Use an 2x16 alphanumeric LCD connected
  to the STK200/300 LCD header.
  The connections between the LCD and the
  board must be as short as possible.
*/

// include the LCD driver routines for the STK200/300
#include <lcdstk.h>

typedef unsigned char byte;

// table for the user defined character
// arrow that points to the top right corner
flash byte char0[8]={
0b0000000,
0b0001111,
0b0000011,
0b0000101,
0b0001001,
0b0010000,
0b0100000,
0b1000000};

// function used to define user characters
void define_char(byte flash *pc,byte char_code)
{
byte i,a;
a=(char_code<<3)|0x40;
for (i=0; i<8; i++) lcd_write_byte(a++,*pc++);
}

void main(void)
{
// initialize the LCD for
// 2 lines & 16 columns
lcd_init(16);

// define user character 0
define_char(char0,0);

// switch to writing in Display RAM
lcd_gotoxy(0,0);
// display the user defined characters
lcd_putsf("User defined\nchar 0:");
// display the user defined char 0
lcd_putchar(0);

// stop here
while (1);
}

⌨️ 快捷键说明

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