⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 基于8515的lcd显示控制程序
💻 C
字号:
//
//	File Name:		main.c
//
//	Title:			Application entry point / driver
//
//	Description:	Main driver for LCD demo.
//
//	Creation Date:	2/2/00 11:49:37 PM
//
//	By:				A.C. Verbeck
//
//	This file is subject to the terms and conditions of the GNU General Public
//	License.  See the file COPYING in the main directory of this archive
//	for more details.
//

#include <io8515v.h>
#include <stdio.h>
#include <macros.h>

#include "BaseType.h"
#include "lcd.h"
#include "t0.h"

static void Timer_Test(void);
static void LCD_Test1(void);
static void LCD_Test2(void);

static Char pbuff[32];

void main(void)
{   
	SEI();							//	Turn on the interrupts
	MCUCR = 0xc0;					//	Enable External RAM

	LCD_Test1();					//	Do LCD test #2
}

static void Timer_Test(void)
{
	UInt8	pb_val;

	DDRB = 0xff;
	PORTB = 0x00;
	T0_init();
	pb_val = 0;
	TASK_LOOP {
		T0_sleep(10);
		++pb_val;
		PORTB=~pb_val;
	}
}

static void LCD_Test1(void)
{
	UInt16	i;

	T0_init();

	LCD_reset();
	LCD_init();
	LCD_command(LCD_HOME);
	sprintf(pbuff, "Test display");
	LCD_puts(pbuff);	
	LCD_command(LCD_NEW_LINE);

	i=0;
	TASK_LOOP {
		T0_sleep(100);
		++i;
		sprintf(pbuff, "Value = %d",i);
		LCD_puts(pbuff);
		LCD_command(LCD_NEW_LINE);
	}
}
		
	
static void LCD_Test2(void)
{
	UInt16	i;

	T0_init();

	LCD_reset();
	LCD_init();
	LCD_command(LCD_HOME);

	TASK_LOOP {
		for (i=0x20; i<0x80; i++) {
			LCD_putc(i);
			T0_sleep(500);
			if ((i%16) == 0) {
				if ((i%32) == 0)
					LCD_command(LCD_HOME);
				else
					LCD_command(LCD_NEW_LINE);
			}
		} 
	}
} 

//
//	End of main.c
//

⌨️ 快捷键说明

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