/***************************************************** This program was produced by the CodeWizardAVR V2.03.4 Standard Automatic Program Generator © Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project : Version : Date : 2010-01-07 Author : Company : Comments: Chip type : ATmega32 Program type : Application Clock frequency : 4.000000 MHz Memory model : Small External RAM size : 0 Data Stack size : 512 *****************************************************/ #include #include #define LCD_PORT PORTA #define LCD_RST PORTB.0 #define LCD_E PORTB.1 #define LCD_RW PORTB.2 #define LCD_RS PORTB.3 #define LCD_CS2 PORTB.4 #define LCD_CS1 PORTB.5 // Declare your global variables here flash char picture[]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x80,0x00,0x62,0x44,0x08,0x10,0x00,0x80,0x48,0x84,0x00,0x00,0x60,0x20,0x00,0xC0,0x40,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x10,0x84,0x79,0x04,0x03,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x17,0x10,0x00,0x00,0x00,0x20,0x20,0x40,0x80,0x80,0x01,0x22,0x9C,0x70,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0xC0,0x00,0x60,0x40,0x10,0x40,0x60,0x20,0x80,0x40,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x04,0x04,0x06,0x08,0x10,0x70,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x08,0x01,0x07,0x06,0x04,0x06,0x04,0x07,0x04,0x04,0x00,0x08,0x08,0x10,0x70,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x7A,0x7A,0x00,0x40,0x00,0x02,0x00,0x04,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x40,0x80,0x00,0x60,0x80,0x30,0x60,0x18,0x18,0x20,0x0C,0x14,0x12,0x06,0x0C,0x03,0x07,0x04,0x03,0x03,0x1A,0x01,0x1F,0x7D,0x3C,0x3C,0x3C,0x7D,0x19,0x06,0x02,0x03,0x05,0x04,0x02,0x09,0x0C,0x06,0x12,0x0A,0x24,0x30,0x40,0x60,0x30,0xC0,0xC0,0x20,0xA0,0xC0,0x40,0x10,0x90,0x00,0x08,0x08,0x04,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x10,0x10,0x08,0x0C,0x06,0x03,0x80,0x80,0x80,0x00,0x00,0xC0,0xC0,0x80,0xFF,0x00,0x00,0x07,0x45,0x08,0xC0,0x87,0x00,0x00,0x80,0xFF,0x08,0xE0,0xF0,0xF0,0xE0,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x01,0x01,0x81,0x01,0x3F,0x21,0x21,0x21,0x21,0x7B,0x3F,0x25,0x25,0x25,0x3F,0xBB,0x21,0x21,0x21,0x39,0x25,0x23,0xA3,0x27,0x2F,0x3D,0x39,0x31,0x21,0x23,0x3F,0x27,0x25,0x2D,0x39,0x39,0x3F,0x3F,0x21,0x21,0x3B,0x7F,0x3F,0x25,0x25,0x25,0x2F,0x3B,0x39,0x31,0xE1,0x21,0x21,0x21,0x21,0x3F,0x21,0x01,0xC0,0x00,0xE0,0x20,0x20,0x00,0x00,0x00,0x30,0x30,0x20,0x00,0x88,0x98,0x98,0x10,0x80,0x8C,0x4C,0x48,0x40,0x00,0xC6,0xE6,0x24,0x20,0x00,0x03,0xE3,0xF2,0x10,0x10,0x01,0x01,0x09,0xF8,0xF8,0x00,0x00,0x04,0xFF,0x00,0x00,0x8D,0x88,0x98,0x90,0x3D,0x01,0x00,0xDA,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xFC,0xF8, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0xFF,0x56,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0x10,0xAC,0xF4,0x3E,0x25,0x27,0x23,0x22,0x22,0xE2,0x22,0x22,0x22,0x23,0x25,0x26,0x3A,0xE4,0xF8,0x00,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0x7F,0x41,0x41,0x00,0x3F,0x3F,0x00,0x00,0x20,0x20,0x3F,0x3F,0x00,0x80,0x80,0x80,0x9F,0x9F,0x90,0x90,0x80,0x80,0x8F,0x8F,0x88,0x08,0x48,0x48,0x40,0xC7,0x47,0xC0,0xC0,0x04,0x0F,0x00,0x10,0x05,0x21,0x22,0x26,0x20,0x30,0x00,0x0F,0x06,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x7F,0x40,0x40,0x40,0x40,0x7F,0x6B,0x40,0x40,0x40,0x40,0x7F,0x40,0x40,0x40,0x40,0x7F,0x7F,0x40,0x54,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x7F,0x40,0x7F,0x7F,0x40,0x40,0x40,0x7F,0x7F,0x40,0x40,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xF0,0xFF,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x40,0xFF,0xFF,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xFF,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x3F,0xFF,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x3F,0x2B,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x2F,0x20,0x3F,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x2F,0x2F,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x3F,0x20,0x20,0x20,0x2F,0x3F,0x2F,0x2F,0x3F,0x3F,0x3F,0x3F,0x3F }; void write_lcd(char columns,char page,char data); void LatchLCD(); void shiftup(); void shiftdown(); unsigned int i,x,y; void main(void) { LCD_E=0; LCD_RW=0; LCD_RST=1; for(i=0;i<1024;i++){ if(x>=128){ x=0; y++; } write_lcd(x,y,picture[i]); x++; } shiftup(); shiftdown(); //----------------------- // Declare your local variables here // Input/Output Ports initialization // Port A initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTA=0x00; DDRA=0xFF; // Port B initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTB=0x00; DDRB=0xFF; // Port C initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTC=0x00; DDRC=0x00; // Port D initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTD=0x00; DDRD=0x00; // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: Timer 0 Stopped // Mode: Normal top=FFh // OC0 output: Disconnected TCCR0=0x00; TCNT0=0x00; OCR0=0x00; // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: Timer 1 Stopped // Mode: Normal top=FFFFh // OC1A output: Discon. // OC1B output: Discon. // Noise Canceler: Off // Input Capture on Falling Edge // Timer 1 Overflow Interrupt: Off // Input Capture Interrupt: Off // Compare A Match Interrupt: Off // Compare B Match Interrupt: Off TCCR1A=0x00; TCCR1B=0x00; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00; ICR1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: Timer 2 Stopped // Mode: Normal top=FFh // OC2 output: Disconnected ASSR=0x00; TCCR2=0x00; TCNT2=0x00; OCR2=0x00; // External Interrupt(s) initialization // INT0: Off // INT1: Off // INT2: Off MCUCR=0x00; MCUCSR=0x00; // Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x00; // Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off ACSR=0x80; SFIOR=0x00; while (1) { // Place your code here }; } void LatchLCD() { delay_us(7); LCD_E=1; delay_us(7); LCD_E=0; } //----------------------- void shiftup() { char i,j; for(i=0;i<64;i++){ for(j=0;j<2;j++){ LCD_CS1=~LCD_CS1; LCD_CS2=~LCD_CS1; LCD_RS=0; LCD_RW=0; LCD_PORT=0xC0 | i; LatchLCD(); } delay_ms(50); } } //----------------------- void shiftdown() { char i,j; for(i=64;i>0;i--){ for(j=0;j<2;j++){ LCD_CS1=~LCD_CS1; LCD_CS2=~LCD_CS1; LCD_RS=0; LCD_RW=0; LCD_PORT=0xC0 | i; LatchLCD(); } delay_ms(50); } } //--------------------------- void write_lcd(char columns,char page,char data) { if(columns >= 64){ LCD_CS1=0; LCD_CS2=1; }else{ LCD_CS1=1; LCD_CS2=0; } LCD_RS=0; LCD_RW=0; LCD_PORT=0xB8 | page; LatchLCD(); LCD_RS=0; LCD_RW=0; LCD_PORT=0x40 | columns; LatchLCD(); LCD_RS=1; LCD_RW=0; LCD_PORT=data; LatchLCD(); }