📄 main.c
字号:
/*
***********************************************************************************************
* Exercise on C18 compiler version 2.40; IDE is MPLAB 7.60
* Hardware : PIC18-LF4550-STK1, PIC18LF4550 at Vdd=3.3V
* File: ..\FG020214\main.c
* Functions: Simple RGB demonstration display on FG020214 262k color Graphical LCD Display
* Pure color display in R,G,B for dead-point inspection
* Date: 10 May 2007
* Version: 1.0b
* Programmer: John Leung at TechToys Co.(www.TechToys.com.hk)
***********************************************************************************************
*/
/*
***********************************************************************************************
* Date : 13th JUNE 2007
* Modification : Example updated with 16 bit color mode with string print and pattern
* print functions
* Project compiled with C18 version 2.40 & MPLAB version upgraded to V7.60
* Version : v1.0c
***********************************************************************************************
*/
#include <p18cxxx.h>
#include "delay.h"
#include "SSD1289.h"
#include "women.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 PLLDIV = 5 // This value has to be 5 for 20Mhz xtal as PLL accepts fixed input of 4MHz only
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2, therefore USB clock is 48MHz in full speed
#pragma config FOSC = HSPLL_HS // HS oscillator, PLL enabled
#pragma config CPUDIV = OSC1_PLL2 // 96MHz PLL Src/2 => a CPU clock of 48MHz running off the spec for Vdd=3.3V!!!
#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!
#pragma config MCLRE = ON // MCLRE enable for RE3 pin, reset function enabled
/*
********************************************************************************************************************
* MAIN
*
********************************************************************************************************************
*/
void main(void)
{
INT8U x;
INT16U y;
ADCON1 = 0x0F; //All digital operation
cDispInit(); //Initialize LCD in white color
for(x=0;x<240;x++) cDispSetPixel(x, 32, RGB16(0,0,31));
for(x=0;x<240;x++) cDispSetPixel(x, 33, RGB16(0,0,31));
for(x=0;x<240;x++) cDispSetPixel(x, 34, RGB16(0,0,31));
for(x=0;x<240;x++) cDispSetPixel(x, 35, RGB16(0,0,31));
cDisprStrAt(10, 155, "Hello World!", 2, RGB16(3,10,3));
//display a picture of iPod women!!!
cDisprPatAt(60,64, &women[0]);
for(;;)
{
for(x=0;x<240;x++)
{
for(y=180;y<320;y++)
cDispSetPixel(x,y,RGB16(x%32,y%64,(x+y)%32));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -