Home > other >  Ask: Hitachi SP14N02L6ALCZ screen simulation is normal, structures, physical no display
Ask: Hitachi SP14N02L6ALCZ screen simulation is normal, structures, physical no display

Time:05-09

single chip microcomputer ATMEGA16 (internal RC - 8 m frequency)
Screen screen: Hitachi SP14N02L6ALCZ
Copy is true: protues
Translation: the ICC AVR7.2

great god, please advice, thank you!

 # include "CONFIG. H" 
# include "raio. H"
# define x 240
# define y 128
# define the xy * y (x/8)

Unsigned int I;

Void lcd_clear (void)
{
int i;
X24 lcd_registers (0, 0 x00 to 0 x00);
for(i=0; i<8192; I++)
Xc0 lcd_wdata (0, 0 x00);
}

Void lcd_initial (void)
{
Lcd_cmdwrite (0 xf0);
X21 lcd_registers (0, 0 x00 to 0 x00);
X22 lcd_registers (0, 0 x00 to 0 x00);
X24 lcd_registers (0, 0 x00 to 0 x00);
Lcd_controlword (0 x40, 0 x00 to 0 x00);
X1e lcd_controlword (0 x41, 0, 0 x00);
X42 lcd_controlword (0, 0 x00 to 0 x0f);
X1e x43 lcd_controlword (0, 0, 0 x00);
Lcd_cmdwrite (0 x80);
X9c lcd_cmdwrite (0);
Xa6 lcd_cmdwrite (0);
}

Void lcd_cmdwrite (unsigned char CMDX)
{
Lcd_chkstatus ();
//lcd_CMD=CMDX;
LCD_PORT=CMDX;
//lcd_A0=1;
LCD_CD_H;
Lcd_nop (1);
//lcd_WR=0;
LCD_RW_L;
//lcd_CS=0;
LCD_CE_L;
//lcd_WR=1;
LCD_RW_H;
//lcd_CS=1;
LCD_CE_H;
}

Void lcd_datawrite (unsigned char datax)
{
Lcd_chkstatus ();
//lcd_DATA=https://bbs.csdn.net/topics/datax;
LCD_PORT=datax;
//lcd_A0=0;
LCD_CD_L;
Lcd_nop (2);
//lcd_CS=0;
LCD_CE_L;
//lcd_WR=0;
LCD_RW_L;
//lcd_WR=1;
LCD_RW_H;
//lcd_CS=1;
LCD_CE_H;
}

Unsigned char lcd_cmdread (void)
{
Unsigned char address_cmd;
//lcd_DATA=https://bbs.csdn.net/topics/0xff;
LCD_DDR=0 x00;//input
LCD_PORT=0 XFF;
//lcd_A0=1;
LCD_CD_H;
//lcd_CS=0;
LCD_CE_L;
//lcd_RD=0;
LCD_RD_L;
//address_cmd=lcd_DATA;
Address_cmd=LCD_DATA;
//lcd_RD=1;
LCD_RD_H;
//lcd_CS=1;
LCD_CE_H;
Return (address_cmd);
LCD_DDR=0 XFF;//the output
}

Unsigned char lcd_dataread (void)
{
Unsigned char address_data;

LCD_DDR=0 x00;//input
LCD_PORT=0 XFF;
//lcd_DATA=https://bbs.csdn.net/topics/0xff;
//lcd_A0=0;
LCD_CD_L;
//lcd_CS=0;
LCD_CE_L;
//lcd_RD=0;
LCD_RD_L;
//address_data=https://bbs.csdn.net/topics/lcd_DATA;
Address_data=https://bbs.csdn.net/topics/LCD_DATA;
//lcd_RD=1;
LCD_RD_H;
//lcd_CS=1;
LCD_CE_H;

Return (address_data);
LCD_DDR=0 XFF;//the output
}

Void lcd_chkstatus (void)
{
Unsigned char busy;

Do
{
Busy=! (lcd_cmdread () & amp; 0 x03);
}
While (busy);

}

Void delay1ms (unsigned int count)
{
Uint I;
While (count) {
I=1000;
While (I);
}
}


Void lcd_nop (unsigned char cc)
{
unsigned char i;
for(i=0; i}

Void lcd_reset (void)
{

//lcd_RES=1;
LCD_RES_H;
Delay1ms (2);
//lcd_RES=0;
LCD_RES_L;
Delay1ms (50);
//lcd_RES=1;
LCD_RES_H;
Delay1ms (50);
}

Void lcd_registers (unsigned char a, b unsigned char, unsigned char c)
{

Lcd_datawrite (b);
Lcd_datawrite (c);
Lcd_cmdwrite (a);
}

Void lcd_controlword (unsigned char a, b unsigned char, unsigned char c)
{

Lcd_datawrite (b);
Lcd_datawrite (c);
Lcd_cmdwrite (a);
}

Void lcd_wdata (unsigned char a, unsigned char b)
{
Lcd_datawrite (b);
Lcd_cmdwrite (a);
}

//=================================================================================
//text
//=================================================================================
Void lcd_text_1 (void)
{
X24 lcd_registers (0, 0 x00 to 0 x00);
//RAIO TECHNOLOGY INC.
Xc0 lcd_wdata (0, 0 x32);
Xc0 lcd_wdata (0, 0 x21);
Xc0 lcd_wdata (0, 0 x29);
Xc0 lcd_wdata (0, 0 x2f);
Xc0 lcd_wdata (0, 0 x00);
Xc0 lcd_wdata (0, 0 x34);
Xc0 lcd_wdata (0, 0 x25);
Xc0 lcd_wdata (0, 0 x23);
Xc0 lcd_wdata (0, 0 x28);
Xc0 lcd_wdata (0, 0 x2e);
Xc0 lcd_wdata (0, 0 x2f);
Xc0 lcd_wdata (0, 0 x2c);
Xc0 lcd_wdata (0, 0 x2f);
Xc0 lcd_wdata (0, 0 x27);
Xc0 lcd_wdata (0, 0 x39);
Xc0 lcd_wdata (0, 0 x00);
Xc0 lcd_wdata (0, 0 x29);
Xc0 lcd_wdata (0, 0 x2e);
Xc0 lcd_wdata (0, 0 x23);
Xc0 lcd_wdata (0, 0 x0e);
X24 lcd_registers (0, 0 x96, 0 x00);
//ASCII:
Xc0 lcd_wdata (0, 0 x21);
Xc0 lcd_wdata (0, 0 x33);
Xc0 lcd_wdata (0, 0 x23);
Xc0 lcd_wdata (0, 0 x29);
Xc0 lcd_wdata (0, 0 x29);
Xc0 lcd_wdata (0, 0 x1a);

Xd1 x24 lcd_registers (0, 0, 0 x00);
for(i=0; i<256; I++)
Lcd_wdata (0 xc0, I);
}

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull