test_lcd.c

来自「1602lcd液晶器显示的例子程序」· C语言 代码 · 共 50 行

C
50
字号
// **************************************************************
// *** 					   LCD Demo V1.0  				  	  ***
// ***          Written By P. Fletcher-Jones 9/5/01           ***
// ***                   Last MOD 9/5/01			  		  ***
// ***    Compiled with ImageCraft C compiler Version 6.21E   ***
// **************************************************************


#include <iom103.h>


#include "LCD.h"
static void test(const char *s);



void main (void)
{
int i;
test("Hello World");
for (i = 0; i < 1000; i++)
	;  // delay
/* Override the ports (using the default values!) */
LCD_EN_PORT = &PORTC;
LCD_DIR_PORT = &DDRA;
LCD_IP_PORT = &PINA;
LCD_OP_PORT = &PORTA;
LCD_RS_PORT = &PORTC;
LCD_RW_PORT = &PORTC;
test("I am Alive");
}

static void test(const char *s)
{	
Init_LCD();							// Setup the LCD
LCD_Cursor_On();					// Turn Cursor ON

// *** These use store the text in RAM *** //
//LCD_DisplayString(1,5,"Imagecraft"); 	// Display text on line 1 Character 2
//LCD_DisplayString(2,6,"LCD Demo"); 		// Display text on line 2 Character 2


// *** These use store the text in FLASH *** //
// *** !! Must have strings in flash option set in Project options *** //

LCD_DisplayString_F(1,5,"Imagecraft"); 	// Display text on line 1 Character 2
LCD_DisplayString_F(2,6,"LCD Demo"); 	// Display text on line 2 Character 2
LCD_DisplayString_F(3,6, s);
}

⌨️ 快捷键说明

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