static void LCD5110_LCD_write_byte(uint8_t dat, uint8_t command) { uint8_t i; LCD5110_CS(0); //SPI_CS = 0; delay_us(20); if (command == 0) LCD5110_DC(0); //LCD_DC = 0; else LCD5110_DC(1); //LCD_DC = 1; - write data to RAM delay_us(20); for (i = 0; i < 8; i++) { LCD5110_MO(dat & 0x80); //SPI_MO = dat & 0x80; dat = dat << 1; LCD5110_SCK(0); //SPI_SCK = 0; delay_us(1); LCD5110_SCK(1); //SPI_SCK = 1; delay_us(1); } LCD5110_CS(1); //SPI_CS = 1; }
void LCD5110_LCD_write_byte(unsigned char dat,unsigned char mode) { unsigned char i; LCD5110_CS(0);//SPI_CS = 0; if (0 == mode) LCD5110_DC(0);//LCD_DC = 0; else LCD5110_DC(1);//LCD_DC = 1; for(i=0;i<8;i++) { LCD5110_MO(dat & 0x80);//SPI_MO = dat & 0x80; dat = dat<<1; LCD5110_SCK(0);//SPI_SCK = 0; LCD5110_SCK(1);//SPI_SCK = 1; } LCD5110_CS(1);//SPI_CS = 1; }
void LCD5110_init() { LCD5110_GPIO_Config(); LCD5110_DC(1);//LCD_DC = 1; LCD5110_MO(1);//SPI_MO = 1; LCD5110_SCK(1);//SPI_SCK = 1; LCD5110_CS(1);//SPI_CS = 1; LCD5110_LCD_delay_ms(70); LCD5110_LCD_write_byte(0x21,0); //21 LCD5110_LCD_write_byte(0xC2,0); //C2 LCD5110_LCD_write_byte(0x06,0); //06 LCD5110_LCD_write_byte(0x13,0); //13 LCD5110_LCD_write_byte(0x20,0); //20 LCD5110_clear(); LCD5110_LCD_write_byte(0x0C,0); // 0X0D positive }