unsigned char wdata(unsigned char d,unsigned char disp_invert) //数据输出 { unsigned char i; #if OS_CRITICAL_METHOD == 3 OS_CPU_SR cpu_sr = 0; #endif OS_ENTER_CRITICAL(); LCD_CS_ENABLE(); for(i=0;i<8;i++) { LCD_MC_LOW(); if(disp_invert) { if(d&0x80) LCD_OUT_RESET(); else LCD_OUT_SET(); } else { if(d&0x80) LCD_OUT_SET(); else LCD_OUT_RESET(); } d<<=1; LCD_MC_HIGH(); } LCD_CS_DISABLE(); OS_EXIT_CRITICAL(); return d; }
void LCD_SendDAT(u8 Data) { LCD_RS_DISABLE(); //data LCD_CS_ENABLE(); LCD_SPISendByte(Data); LCD_CS_DISABLE(); }
void LCD_SendDAT16(u16 Data) { LCD_RS_DISABLE(); //data LCD_CS_ENABLE(); LCD_SPISendByte(Data >> 8); LCD_SPISendByte(Data); LCD_CS_DISABLE(); }
void LCD_SendCMD(u8 Data) { LCD_RS_ENABLE(); //cmd LCD_CS_ENABLE(); LCD_SPISendByte(Data); LCD_SPISendByte(0x00); LCD_CS_DISABLE(); }
unsigned char wcom(unsigned char d) //数据输出 { unsigned char i; #if OS_CRITICAL_METHOD == 3 OS_CPU_SR cpu_sr = 0; #endif OS_ENTER_CRITICAL(); LCD_START_CMD(); LCD_CS_ENABLE(); for(i=0;i<8;i++) { LCD_MC_LOW(); if(d&0x80) LCD_OUT_SET(); else LCD_OUT_RESET(); d<<=1; LCD_MC_HIGH(); } LCD_CS_DISABLE(); LCD_START_DATA(); OS_EXIT_CRITICAL(); return d; }