#include #include #include // Declare your global variables here // Alphanumeric LCD initialization // RS - PORTD Bit 0 // RD - PORTD Bit 1 // EN - PORTD Bit 2 // D4 - PORTD Bit 4 // D5 - PORTD Bit 5 // D6 - PORTD Bit 6 // D7 - PORTD Bit 7 #asm .equ __lcd_port=0x0B ;PORTD #endasm #include void main(void) { char lcd_buffer[11]; int b=0; // Crystal Oscillator division factor: 1 #pragma optsize- CLKPR=0x80; CLKPR=0x00; #ifdef _OPTIMIZE_SIZE_ #pragma optsize+ #endif PORTB=0xFF; DDRB=0x00; PORTC=0x00; DDRC=0xFF; PORTD=0x00; DDRD=0xFF; lcd_init(8); while (1) { if (PINB.0==0) { b=b+1; delay_ms(150); sprintf(lcd_buffer,"%u",b); lcd_gotoxy(0,0); lcd_puts(lcd_buffer); delay_ms(150); } } }