DEM-16217
hardwaredisplayansteuerung

I am using the 8 bit mode of an Atmel ATtiny2313 to drive the display, because the 8 bit mode seemed to be the simpelst.

Displaysteuerung

I am not exactly proud of the following code, but it used to work and it is very close to the instructions from the data sheet:

#include <avr/io.h> #include <util/delay_basic.h>  typedef enum {  FUNCTION_SET = 0b00111000,  DISPLAY_CONTROL = 0b00001111,  DISPLAY_CLEAR = 0b00000001,  DISPLAY_HOME = 0b00000010,  ENTRY_MODE_SET = 0b00000110 } INSTRUCTIONS;  void execute() {  PORTD |= 0b01000000;  _delay_loop_2(1024);  PORTD &= 0b10111111; }  int main() {  DDRB = 0xFF;  DDRD = 0xFF;   PORTB = FUNCTION_SET;  execute();  PORTB = DISPLAY_CONTROL;  execute();  PORTB = DISPLAY_CLEAR;  execute();  PORTB = ENTRY_MODE_SET;  execute();   char* c = "Max ";  while(1)  {  int i;  for(i=0; c[i]!='\0'; i++)  {  PORTB = c[i];  execute();  }  _delay_loop_2(32768);  }  return 0; } 
top