📄 main.c
字号:
/****************************************Copyright (c)***************************************************
** Guangzou ZHIYUAN electronics Co.,LTD.
**
** http://www.embedtools.com
**
**--------------File Info--------------------------------------------------------------------------------
** File name: main.c
** Last modified Date: 2008.04.25
** Last Version: V1.00
** Descriptions: lcd interrupt sample
**
**-------------------------------------------------------------------------------------------------------
** Created by: Houxiaolong
** Created date: 2008.04.25
** Version: V1.00
** Descriptions: lcd interrupt sample
**
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
*********************************************************************************************************/
#include "main.h"
/*********************************************************************************************************
** Function name : LCD_ISR
** Function Description : LCD's ISR fuction
** Input: none
** Output: none
*********************************************************************************************************/
void __irq LCD_ISR(void)
{
switch (LCD_INTSTAT) {
case 0x10: /* AHB master error interrupt */
LCD_INTMSK &= ~(1 << 4);
break;
case 0x08: /* Vertical compare interrupt */
lcd_DrawRect(100, 100, 130, 210, LCD_WHITE);
LCD_INTMSK &= ~(1 << 3);
break;
case 0x04: /* LCD next base address update
interrupt */
lcd_FillRect(140, 220, 230, 310, LCD_BLUE);
LCD_INTMSK &= ~(1 << 2);
break;
case 0x02: /* FIFO underflow interrupt */
LCD_INTMSK &= ~(1 << 1);
break;
default:
break;
}
LCD_INTCLR = 0x1e; /* clear all the interrupt mask*/
VICVectAddr = 0x00;
}
/*********************************************************************************************************
** Function name : LCD_IRQInit
** Function Description : enable LCD interrupt
** Input: none
** Output: none
*********************************************************************************************************/
void LCD_IRQInit(void)
{
LCD_INTMSK = 0x1e; /* enable all type of LCD
interrupt */
VICIntSelect &= ~(1 << 16); /* select IRQ interrupt */
VICVectAddr16 = (unsigned int)LCD_ISR; /* LCD ISR's address */
VICVectPri16 = 0; /* set the interrupt priority */
VICIntEnable = (1 << 16); /* enable LCD interrupt */
IRQEnable(); /* enable IRQ interrupt */
}
/*********************************************************************************************************
** 函数名称 :main()
** 函数功能 :演示LPC247X的LCD控制器
** 调试说明 :本程序不能在内部RAM中调试
*********************************************************************************************************/
int main (void)
{
lcd_Init(); /* 初始化液晶 */
LCD_IRQInit(); /* 初始化LCD中断设置 */
lcd_FillRect(0, 0, 90, 90, LCD_GREEN); /* 填充一个绿色矩形 */
lcd_DrawRect(80, 80, 150, 230, LCD_RED); /* 画一个红色的矩形 */
while(1);
return 0;
}
/*********************************************************************************************************
** End Of File
*********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -