Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint8_t yPosition = LCD_LINE1;
- uint8_t xPosition = 0;
- void LCD_Locate(uint8_t x, uint8_t y)
- {
- switch (y)
- {
- case 0:
- y = LCD_LINE1;
- break;
- case 1:
- y = LCD_LINE2;
- break;
- }
- xPosition = x;
- yPosition = y;
- LCD_WriteCmd((LCDC_SET_DDRAM | (y + x)));
- }
- void LCD_Char(char c)
- {
- xPosition++;
- LCD_WriteData(((c >= 0x80) && (c <= 0x87)) ? (c & 0x07) : c);
- }
- void LCD_String(char *str)
- {
- char c;
- while ((c = *(str++)))
- {
- LCD_Position();
- LCD_Char(c);
- }
- }
- void LCD_Position(){
- if (xPosition > 15 && yPosition == LCD_LINE1)
- {
- yPosition = LCD_LINE2;
- LCD_Locate(0, 1);
- }
- else if (xPosition > 15 && yPosition == LCD_LINE2)
- {
- yPosition = LCD_LINE1;
- LCD_Locate(0, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement