例如初始化程序:
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
#define A0 P3_0
#define RW P3_7
#define E P3_4
#define CS P3_1
#define RESET P3_6
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
void data_out(unsigned char i) //Data Output 16‐bit Bus Interface
{
A0 = 0;
P1 = i;
CS = 0;
RW = 0;
E = 1;
delay(1);
E = 0;
RW = 1;
CS = 1;
}
void comm_out(unsigned char j) //Command Output 8‐bit Bus Interface
{
A0 = 1;
P1 = j;
CS = 0;
RW = 0;
E = 1;
delay(1);
E = 0;
RW = 1;
CS = 1;
}
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
// Initialization For RA8835
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
无效resetLCD ( )
{
RESET = 0;
delay(5);
RESET = 1;
delay(10);
}
无效init_LCD ( )
{
comm_out(0x40);