此帖出自嵌入式系统论坛
最新回复
我用的HS1286410A;
[code]
struct PIN
{
unsigned char bit0 :1;
unsigned char bit1 :1;
unsigned char bit2 :1;
unsigned char bit3 :1;
unsigned char other:4;
};
#define STA0 ((struct PIN *)&SIR_io.p2.in.byte[2])->bit0 //input indicate bit
#define STA1 ((struct PIN *)&SIR_io.p2.in.byte[2])->bit1
#define OUTDATA SIR_io.p2.out.byte[2] //output data
#define INDATA SIR_io.p2.in.byte[2] //input data
#define DIR SIR_io.p2.dir.byte[2] //direction
#define WR ((struct PIN *)&SIR_io.p2.out.byte[3])->bit3 //write
#define CS ((struct PIN *)&SIR_io.p2.out.byte[3])->bit2 //cs
#define CD ((struct PIN *)&SIR_io.p2.out.byte[3])->bit1 //command
#define RD ((struct PIN *)&SIR_io.p2.out.byte[3])->bit0 //read
#define BL ((struct PIN *)&SIR_io.p1.out.byte[0])->bit0 //black light
#define RC ((struct PIN *)&SIR_io.p1.out.byte[0])->bit1 //receive message
#define LCD_T_BASE 0X0000 // 文本区内存首地址
#define LCD_A_BASE 0X1000 // 属性区内存首地址
#define WD 0x16 // 定义屏幕文本宽度为21字节
void Pr0()
{
DIR = 0x00;
RD = 1;
WR = 1;
CD = 1;
OUTDATA = OUTDATA|0xFF;
RD = 0;
asm("nop");
DIR = 0xFF;
RD = 1;
asm("nop");
}
void OutCommand(uint8 accept)
{
DIR = 0x00;
WR = 0;
asm("nop");
OUTDATA = accept;
WR = 1;
asm("nop");
DIR = 0xFF;
CD = 1;
asm("nop");
}
void CheckSTA1()
{
Ptemp01:
Pr0();
if (STA0 == 0) {
goto Ptemp01;
}
if (STA1 == 0) {
goto Ptemp01;
}
}
详情
回复
发表于 2009-5-19 14:30
| ||
|
||
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
EEWorld Datasheet 技术支持