VFD debugging

This commit is contained in:
Gregor Riepl 2021-04-22 00:36:54 +02:00
parent 8b4eb9e938
commit c71fc39f48

View file

@ -98,6 +98,10 @@ static void init() {
// initialize VFD
display_init();
// clear
display_write(0x01, 0, 0);
// display on, no cursor
display_write(0x0c, 0, 0);
// Initialize CAN interface
can_init(BITRATE_125_KBPS);
@ -171,12 +175,52 @@ static void loop() {
}
static void test() {
// clear
display_write(0x01, 0, 0);
// display on, no cursor
display_write(0x0c, 0, 0);
static uint8_t test_char = 0;
display_write(0x80, (const uint8_t *) "Hello, world", 12);
_delay_ms(1000);
display_write(0xc0, (const uint8_t *) &test_char, 1);
test_char++;
_delay_ms(100);
}
static void test2() {
// PC5, PC6, PC7: output (VFD RS, RW, E), RS=0, RW=1, E=1
// PD0, PD1, PB0, PB1, PB7, PD5, PD6, PD7: output (VFD DB) - can be switched to input (pullup not needed)
PORTC &= ~(_BV(PC5) | _BV(PC6) | _BV(PC7));
PORTB &= ~(_BV(PB0) | _BV(PB1) | _BV(PB7));
PORTD &= ~(_BV(PD0) | _BV(PD1) | _BV(PD5) | _BV(PD6) | _BV(PD7));
PORTC |= _BV(PC5);
_delay_us(10);
PORTC &= ~_BV(PC5);
PORTC |= _BV(PC6);
_delay_us(10);
PORTC &= ~_BV(PC6);
PORTC |= _BV(PC7);
_delay_us(10);
PORTC &= ~_BV(PC7);
PORTD |= _BV(PD0);
_delay_us(10);
PORTD &= ~_BV(PD0);
PORTD |= _BV(PD1);
_delay_us(10);
PORTD &= ~_BV(PD1);
PORTB |= _BV(PB0);
_delay_us(10);
PORTB &= ~_BV(PB0);
PORTB |= _BV(PB1);
_delay_us(10);
PORTB &= ~_BV(PB1);
PORTB |= _BV(PB7);
_delay_us(10);
PORTB &= ~_BV(PB7);
PORTD |= _BV(PD5);
_delay_us(10);
PORTD &= ~_BV(PD5);
PORTD |= _BV(PD6);
_delay_us(10);
PORTD &= ~_BV(PD6);
PORTD |= _BV(PD7);
_delay_us(10);
PORTD &= ~_BV(PD7);
}
int main() {