最近在做一个工作,要把传感器采集的数据传输到液晶屏上显示出来,但是液晶屏的使用不是很清楚,找了一个相似的程序,其中一句程序:
WriteCmd(0x01);
然后找其源程序是:
void WriteCmd(u8 cmd){
NEN;
RSL;
RWW;
SEND(cmd);
EN;
delay_us(1000);
NEN;
}
宏定义如下:
#define RSL GPIOC->ODR&=~(1<<0)
#define RSH GPIOC->ODR|=1<<0
#define RWW GPIOC->ODR&=~(1<<1)
#define RWR GPIOC->ODR|=1<<1
#define NEN GPIOC->ODR&=~(1<<2)
#define EN GPIOC->ODR|=1<<2
#define SEND(x) {GPIOE->ODR&=0xFFFFFF00; GPIOE->ODR|=x;}
而我使用的液晶屏驱动程序中相似的程序是
/*******************************************************************************
* Write command to LCD controller *
* Parameter: c: command to be written *
* Return: *
*******************************************************************************/
__inline void wr_cmd (unsigned char c) {
Clr_Rs;
Set_nRd;
GPIOE->ODR = c;
Clr_nWr;
Set_nWr;
}
宏定义如下:
#define Set_Cs GPIOC->BSRR = 0x00000040;
#define Clr_Cs GPIOC->BRR = 0x00000040;
#define Set_Rs GPIOD->BSRR = 0x00002000;
#define Clr_Rs GPIOD->BRR = 0x00002000;
#define Set_nWr GPIOD->BSRR = 0x00004000;
#define Clr_nWr GPIOD->BRR = 0x00004000;
#define Set_nRd GPIOD->BSRR = 0x00008000;
#define Clr_nRd GPIOD->BRR = 0x00008000;
我不清楚我该怎么这条程序才正确,这条程序是做什么用的?请高手指教,不胜感激
|