lcddemo.c

来自「AVRmega16L LCD2004四数据线驱动程序CAVR编译」· C语言 代码 · 共 62 行

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

  Use an 2x40 alphanumeric LCD connected
  to the STK500 PORTC header as follows:

  [LCD]   [STK500 PORTC HEADER]
   1 GND- 9  GND
   2 +5V- 10 VCC  
   3 VLC- LCD contrast control voltage 0..1V
   4 RS - 1  PC0
   5 RD - 2  PC1
   6 EN - 3  PC2
  11 D4 - 5  PC4
  12 D5 - 6  PC5
  13 D6 - 7  PC6
  14 D7 - 8  PC7
*/

// the LCD is connected to PORTC outputs
// see the file lcd.h in the ..\inc directory
#asm
.equ __lcd_port=0x15 ;PORTC     //注意熔丝位JTAGEN中的“V” 去掉,取消默认的JTAG功能
#endasm

// include the LCD driver routines
#include <lcd.h>

void main(void)
{
// initialize the LCD for
// 2 lines & 40 columns         液晶型号HD44780 4X20
lcd_init(40);

// go on the second LCD line
lcd_gotoxy(0,0);

// display the message          //第一行第一个字坐标为(0,0)
lcd_putsf("Gasses Senser Test");

lcd_gotoxy(9,1);                //第二行第一个字坐标为(0,1)
lcd_putsf("TCS-2 v1.2");

lcd_gotoxy(21,0);               //第三行第一个字坐标为(20,0)
lcd_putsf("ShanXiHydz.Co");

lcd_gotoxy(23,1);               //第四行第一个字坐标为(20,1)
lcd_putsf("Tel: 0351-7342006");

// stop here
while (1);
}

⌨️ 快捷键说明

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