/***************************************************** This program was produced by the CodeWizardAVR V1.24.8d Professional Automatic Program Generator © Copyright 1998-2006 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project : Version : Date : 02.08.2007 Author : F4CG Company : F4CG Comments: Chip type : ATmega8535 Program type : Application Clock frequency : 8,000000 MHz Memory model : Small External SRAM size : 0 Data Stack size : 128 *****************************************************/ #define xtal 8000000L #asm .equ __lcd_port=0x15 //Port #endasm #include #include #include typedef unsigned char byte; /* table for the user defined character arrow that points to the top right corner */ flash byte char0[8]={ 0b0000000, 0b0001111, 0b0000011, 0b0000101, 0b0001001, 0b0010000, 0b0100000, 0b1000000}; /* function used to define user characters */ void define_char(byte flash *pc,byte char_code) { byte i,a; a=(char_code<<3) | 0x40; for (i=0; i<8; i++) lcd_write_byte(a++,*pc++); } char n1[16]; int zaehler1 = 0; volatile int zaehler; interrupt [TIM0_OVF] void timer0(void) { zaehler++; } void main(void) { PORTA=0x00; DDRA=0x00; PORTB=0x00; DDRB=0xFF; PORTC=0x00; DDRC=0xFF; PORTD=0x00; DDRD=0xFF; TIMSK = 0b00000001; TCCR0 = 0b00000100; #asm("sei") lcd_init (16); define_char(char0,0); while (1) { if (zaehler == 122) { itoa(zaehler1, n1); lcd_gotoxy (0,0); lcd_puts(n1); zaehler = 0; zaehler1++; } } }