Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void delay(uint32_t volatile t){
- while(t--){};
- };
- char* const m[2] = {"asdfasdfasdfasdf\n", " s f s f s f s f\n" };
- while(1){
- lcd.GoToFirstLine();
- lcd.WriteString(m[0]);
- delay(0x30000);
- lcd.GoToFirstLine();
- lcd.WriteString(m[1]);
- delay(0x51000);
- };
- void LCD::WriteString(char* str)
- {
- for(uint8_t i=0; i<20; i++){
- if(str[i] == '\n')break;
- WriteCGR((uint8_t)(str[i]));
- };
- };
- void LCD::WriteCGR(uint8_t data)
- {
- RS_H;
- uint8_t lsb3bit = (data & 0x07) << 5;
- PORTD &=~(0xE0);
- PORTD |= lsb3bit;
- uint8_t msb5bit = (data & 0xF8) >> 3;
- PORTB &=~(0x1F);
- PORTB = msb5bit;
- EN_H;
- Delay(0xff);
- EN_L;
- RS_L;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement