EmbDev.net

Forum: µC & Digital Electronics Need help with UG-5664 and SSD1322


von Lockdog (Guest)


Attached files:

Rate this post
useful
not useful
Hello!
 I have some problem with display UG-5664 w/controller SSD1322.
 It doesn't want to work. :(

 There is initialization code below:

#include "ioavr.h"
 #include "intrinsics.h"

 #define SetBit(x,y) (x|=(1<<y))
 #define ClrBit(x,y) (x&=~(1<<y))

 #define XTAL_MHz 7.3728
 #define delay_us(us) __delay_cycles((unsigned long int)us*XTAL_MHz)
 #define delay_ns(ns) delay_us(ns/1000)
 #define delay_ms(ms) delay_us(ms*1000)

 #define DATA_PORT PORTC
 #define DATA_DDR DDRC
 #define CONFIG_PORT PORTA
 #define CONFIG_DDR DDRA
 #define CS 5
 #define RES 3
 #define WR 1
 #define RS 2
 #define RD 0
 #define BS0 6
 #define BS1 7

 void LCD_WriteCommand(unsigned char data)
 {
 ClrBit(CONFIG_PORT, RS);
 ClrBit(CONFIG_PORT, CS);
 ClrBit(CONFIG_PORT, WR);
 DATA_PORT = data;
 SetBit(CONFIG_PORT, WR);
 SetBit(CONFIG_PORT, CS);
 SetBit(CONFIG_PORT, RS);
 }

 void LCD_WriteData(unsigned char data)
 {
  SetBit(CONFIG_PORT, RS);
 ClrBit(CONFIG_PORT, CS);
 ClrBit(CONFIG_PORT, WR);
 DATA_PORT = data;
 SetBit(CONFIG_PORT, WR);
 SetBit(CONFIG_PORT, CS);
 SetBit(CONFIG_PORT, RS);
 }



 void Set_Gray_Scale_Table()
 {
 LCD_WriteCommand(0xB8);                        // Set Gray Scale Table
 LCD_WriteData(0x0C);                   //   Gray Scale Level 1
 LCD_WriteData(0x18);                   //   Gray Scale Level 2
 LCD_WriteData(0x24);                   //   Gray Scale Level 3
 LCD_WriteData(0x30);                   //   Gray Scale Level 4
 LCD_WriteData(0x3C);                   //   Gray Scale Level 5
 LCD_WriteData(0x48);                   //   Gray Scale Level 6
 LCD_WriteData(0x54);                   //   Gray Scale Level 7
 LCD_WriteData(0x60);                   //   Gray Scale Level 8
 LCD_WriteData(0x6C);                   //   Gray Scale Level 9
 LCD_WriteData(0x78);                   //   Gray Scale Level 10
 LCD_WriteData(0x84);                   //   Gray Scale Level 11
 LCD_WriteData(0x90);                   //   Gray Scale Level 12
 LCD_WriteData(0x9C);                   //   Gray Scale Level 13
 LCD_WriteData(0xA8);                   //   Gray Scale Level 14
 LCD_WriteData(0xB4);                   //   Gray Scale Level 15

 LCD_WriteCommand(0x00);                        // Enable Gray Scale 
Table
 }

 void LCD_Init(void)
 {
 ClrBit(CONFIG_PORT, RES);
 delay_ms(40);
 SetBit(CONFIG_PORT, RES);

 LCD_WriteCommand(0xFD);
 LCD_WriteData(0x12);

 LCD_WriteCommand(0xAE);

 LCD_WriteCommand(0xB3);
 LCD_WriteData(0x91);

 LCD_WriteCommand(0xCA);
 LCD_WriteData(0x3F);

 LCD_WriteCommand(0xA2);
 LCD_WriteData(0x00);

 LCD_WriteCommand(0xA1);
 LCD_WriteData(0x00);

 LCD_WriteCommand(0xA0);
 LCD_WriteData(0x14);
 LCD_WriteData(0x11);

 LCD_WriteCommand(0xB5);
 LCD_WriteData(0x00);

 LCD_WriteCommand(0xAB);
 LCD_WriteData(0x00);

 LCD_WriteCommand(0xB4);
 LCD_WriteData(0xA0);
 LCD_WriteData(0xFD);

 LCD_WriteCommand(0xC1);
 LCD_WriteData(0x9F);

 LCD_WriteCommand(0xC7);
 LCD_WriteData(0x0F);

 LCD_WriteCommand(0xB9);

 LCD_WriteCommand(0xB1);
 LCD_WriteData(0xE2);

 LCD_WriteCommand(0xD1);
 LCD_WriteData(0x82);
 LCD_WriteData(0x20);

 LCD_WriteCommand(0xBB);
 LCD_WriteData(0x1F);

 LCD_WriteCommand(0xB6);
 LCD_WriteData(0x08);

 LCD_WriteCommand(0xBE);
 LCD_WriteData(0x07);

 LCD_WriteCommand(0xA5);

 LCD_WriteCommand(0xAF);

 }

 int main( void )
 {
 DATA_DDR = 0xFF;
 DATA_PORT = 0x00;
 CONFIG_DDR = 0xFF;
 CONFIG_PORT = 0x00;
 SetBit(CONFIG_PORT, RD);

 //ClrBit(CONFIG_PORT, BS0);
 //SetBit(CONFIG_PORT, BS1);
 LCD_Init();
 while(1)
 {};
 }

Connection scheme include.

 Please, help. What i do incorrect?

 P.S. Sorry, my English not so well.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.