Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <util/delay.h>
- #define LCDDR_RS DDRA
- #define LCDDR_E DDRD
- #define LCDDR_D DDRC
- #define LCDPORT_RS PORTA
- #define LCDPORT_E PORTD
- #define LCDPORT_D PORTC
- #define LCD_E PD6
- #define LCD_RS PA2
- void enable()
- {
- LCDPORT_E |= (1<<LCD_E);
- _delay_us(1);
- LCDPORT_E &= ~(1<<LCD_E);
- _delay_us(4000);
- }
- void init()
- {
- _delay_ms(15);
- LCDDR_RS |= (1<<LCD_RS);
- LCDDR_E |= (1<<LCD_E);
- LCDDR_D = 0b11110000;
- LCDPORT_D = 0x30;
- enable();
- enable();
- enable();
- LCDPORT_D =0x20;
- enable();
- LCDPORT_D = 0x20;
- enable();
- LCDPORT_D = 0x80;
- enable();
- LCDPORT_D = 0x00;
- enable();
- LCDPORT_D = 0x10;
- enable();
- LCDPORT_D = 0x00;
- enable();
- LCDPORT_D = 0xc0;
- enable();
- }
- int main()
- {
- init();
- //Zeichen A ausgeben 0x41
- LCDPORT_D = 0x40;
- LCDPORT_RS |= (1<<LCD_RS);
- enable();
- LCDPORT_D = 0x10;
- LCDPORT_RS |= (1<<LCD_RS);
- enable();
- PORTA =0;
- PORTB =0;
- PORTC =0;
- PORTD =0;
- while(1)
- {
- };
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement