📄 main.c
字号:
/*
********************************************************************************************************************
* Demonstration for 1.8" 65k CSTN LCD module
* The display driver is HYVIX HDC1600 (www.displaychips.co.kr) 65k color STN driver IC. The matrix size is 128*160 dots.
* This example program displays pure red, blue, and green color with system font and a small hard-coded picture
* in sequence.
* Hardware : PIC18-LF4550-STK1, PIC18LF4550 at Vdd=3.3V
* File: ..\HDC1600_drv\main.c
* Functions: Simple RGB demonstration display on CM50012ACT6 65k color LCD module
* Date: 11 June 2007
* Version: 1.0a (first version)
* Programmer: John Leung at www.TechToys.com.hk
********************************************************************************************************************
*/
#include <p18cxxx.h>
#include "hdc1600.h"
/*
********************************************************************************************************************
* Icons defined here
********************************************************************************************************************
*/
#include "music.h"
#include "pictures.h"
#include "setup.h"
#include "video.h"
/*
********************************************************************************************************************
* Pragma Section
*
* Configuration bits under MPLAB v7.41 subject to changes on every little change on project settings.
* So #pragma config statments used for configuration bits instead of using Configuration bits tab in MPLAB
* Note: Refer to pdf document "mcc18\doc\MPLAB-C18-Addendum.pdf" under mcc18 installation directory for config
* variables available
********************************************************************************************************************
*/
#pragma config FOSC = HS // HS oscillator, PLL disabled (thus clock = 20Hz)
#pragma config PWRT = ON // PowerUp timer ON
#pragma config WDT = OFF // watchdog timer off
#pragma config LVP = OFF // low level voltage progamming OFF
#pragma config BOR = OFF // brown out detect off
#pragma config DEBUG = ON // Debug ON
#pragma config PBADEN = OFF // PORTB<4:0> as digital IO on reset
#pragma config STVREN = ON // Stack overflow reset ON
#pragma config VREGEN = OFF // Disable internal 3.3V regulator!
/*
********************************************************************************************************************
* MAIN
*
********************************************************************************************************************
*/
void main(void)
{
INT8U i,x,y;
ADCON1 = 0x0F; //All digital operation
cDispInit();
cDispBackLite(ENABLE);
cDispClr(RGB(31,0,0)); //clear screen in red color
cDispSetPixel(0, 0, RGB(31,63,31)); //Test four corners, white dot at upper left
cDispSetPixel(0, 159, RGB(31,63,31)); //White dot at lower left
cDispSetPixel(127, 0, RGB(31,63,31)); //white dot at upper right
cDispSetPixel(127, 159, RGB(31,63,31)); //white dot at lower right
for(x=0;x<128;x++)
{
for(y=0;y<160;y++) cDispSetPixel(x, y, RGB((x/10)+(y/10),(x/5)+(y/5),10)); //clear screen in gradual tone
}
cDisprStrAt(2, 15, "www.TechToys.com.hk", 1, RGB(31,63,31));
cDisprPatAt(8,48, &music[0]); //display an icon
cDisprPatAt(72,48, &pictures[0]); //display another icon
cDisprPatAt(8,104, &setup[0]);
cDisprPatAt(72,104, &video[0]);
for(;;)
{
;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -