سلام من یه ال سی دی گرافیکی ts12864a رو بستم تو پورتئوس هم جواب داد اما متاسفانه ال سی دی در عمل فقط روشن میشه و هیچ چیزی نمایش نمیده پایه 3 و 18 رو هم وصل کردم به پایه های یه پتانسیومتر 0-50k پایه وسط پتانسیومترم دادم به گراند پتانسیومترم که میچرخونم فقط روشنایی کم و زیاد میشه و تو 50k هم کامل سیاه میشه
کد:
#include <mega32.h>
#include <delay.h>
#define LCD_PORT PORTC
#define LCD_RST PORTA.0
#define LCD_E PORTA.1
#define LCD_RW PORTA.2
#define LCD_RS PORTA.3
#define LCD_CS2 PORTA.4
#define LCD_CS1 PORTA.5
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,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,0x50,0x50,0x50,0xE0,0x00,0xFE,0x00,0xF2,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,0x80,0x80,0x40,0x40,0x40,0x40,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x14,0x18,0x10,0x30,0x48,0x88,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x40,0x40,0x80,0x80,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,0x01,0x02,0x02,0x02,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x10,0x08,0x04,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x20,0x20,0x20,0x20,0x41,0x42,0x44,0x48,0x50,0xA0,0xC0,0xA0,0x80,0x00,0x03,0x0C,0x30,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x04,0x08,0x10,0x60,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,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x10,0x08,0x04,0x02,0x01,0x00,0x00,0x00,0x81,0x83,0x85,0x89,0x92,0xA3,0xC6,0x98,0xE0,0xC0,0x40,0x60,0x50,0x48,0x44,0x42,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x90,0x90,0x40,0x20,0x10,0x0C,0x03,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,0x40,0x40,0x40,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x40,0x80,0x18,0x25,0x25,0x27,0x3E,0x02,0x3F,0x0C,0x3F,0x0C,0x0C,0x0C,0x0C,0x0C,0x14,0x14,0x14,0x14,0x12,0x12,0x12,0x1E,0x12,0x23,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x60,0x20,0x10,0x18,0x14,0x12,0x11,0x11,0x12,0x17,0x1C,0x18,0x68,0x88,0x08,0x04,0x04,0x04,0x04,0x02,0x02,0x02,0x01,0x01,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,0x1C,0x22,0x41,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,0x80,0x41,0x22,0x1C,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,0x01,0x02,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,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x02,0x02,0x02,0x02,0x01,0x01,0x01,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
void write_lcd(char columns,char page,char data);
void LatchLCD();
//void shiftup();
//void shiftdown();
void Glcd_int();
void main()
{
unsigned int i,x,y;
DDRA=0xFF;
DDRC=0xFF;
DDRB=0xFF;
Glcd_int();
x=0;
y=0;
for(i=0;i<1024;i++)
{if(x>127){
x=0;
y++;
}
write_lcd(x,y,picture[i]);
x++;}
// shiftup()
// shiftdown()
while (1);
}
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();
PORTB.0=1;
}
void Glcd_int()
{
unsigned char i;
LCD_RST=0;
delay_ms(10);
LCD_RST=1;
delay_ms(100);
LCD_RS=0;
LCD_CS1=0;
LCD_CS2=1;
for(i=0;i<2;i++)
{
LCD_PORT=0x3E;
LatchLCD();
LCD_PORT=0x40;
LatchLCD();
LCD_PORT=0xB8;
LatchLCD();
LCD_PORT=0xC0;
LatchLCD();
LCD_PORT=0x3F;
LatchLCD();
LCD_CS1=~LCD_CS1;
LCD_CS2=~LCD_CS2;
}
}
void LatchLCD()
{
delay_us(7);
LCD_E=1;
delay_us(7);
LCD_E=0;
}