Untitled

 avatar
unknown
plain_text
a year ago
1.7 kB
4
Indexable
int main(void) {

    // ... (Ustawienia rejestrów kierunku i inicjalizacja wyświetlacza LCD - bez zmian)

    // Zdefiniowanie kolejnych symboli
    unsigned char symbol2[8] = {
        0b01110,
        0b10001,
        0b11111,
        0b10101,
        0b10001,
        0b11111,
        0b10001,
        0b01110
    };
    unsigned char symbol3[8] = {
        0b11000,
        0b11100,
        0b01100,
        0b00110,
        0b01100,
        0b11100,
        0b11000
    };
    unsigned char symbol4[8] = {
        0b00110,
        0b01010,
        0b01110,
        0b11110,
        0b01110,
        0b01010,
        0b00110
    };
    unsigned char symbol5[8] = {
        0b10001,
        0b01001,
        0b10101,
        0b11111,
        0b10101,
        0b01001,
        0b10001
    };

    // Zapisanie symboli do pamięci CGRAM
    LCD_saveCustChar(2, symbol2);
    LCD_saveCustChar(3, symbol3);
    LCD_saveCustChar(4, symbol4);
    LCD_saveCustChar(5, symbol5);

    char text[] = "Jak to jest być skrybą?"; // Tekst do wyświetlania
    int textLength = sizeof(text) - 1; // Długość tekstu (bez znaku null)
    int position = 0; // Pozycja wyświetlania tekstu

    while (1) {
        // Wyczyszczenie ekranu
        LCD_sendCommand(LCD_CLEAR);

        // Wyświetlanie tekstu z przesunięciem
        for (int i = 0; i < 16; i++) {
            LCD_setCursor(1, i);
            LCD_print(&text[position + i]);
        }

        // Przesunięcie pozycji wyświetlania
        position++;
        if (position + 16 > textLength) {
            position = 0;
        }

        __delay_ms(500); // Opóźnienie
    }

    return 0;
}
Editor is loading...
Leave a Comment