Hi have a CFAG12832A-YGH-N LCD and want to use it in parallel 4-bits mode but unfortunately is not working, I just want to write some simple characters to validate our design because we are sending data thru SPI(MOSI and SCK) to a 8-bits shift register and then to the LCD,
I am following the init steps in the ST7920V40_E.pdf document (see attached image 4-bitsinit.jpg), -by the way your documentation is based on an older version where 4-bits init is not correct-, but i am not able to see what i am trying to write
This is the code I am using to init lcd in 4-bits mode, I am making sure that needed values are in the lcd pins so SPI and shift register is working fine.
An important question is How much time should I wait between the transfer of the higher 4 bits and the lower 4 bits ?
After initialization, what should I do to write a "Hello world" on the LCD, Can you provide a sample code or a pseudocode to do that please (4 bits mode) ??
I am following the init steps in the ST7920V40_E.pdf document (see attached image 4-bitsinit.jpg), -by the way your documentation is based on an older version where 4-bits init is not correct-, but i am not able to see what i am trying to write
This is the code I am using to init lcd in 4-bits mode, I am making sure that needed values are in the lcd pins so SPI and shift register is working fine.
An important question is How much time should I wait between the transfer of the higher 4 bits and the lower 4 bits ?
After initialization, what should I do to write a "Hello world" on the LCD, Can you provide a sample code or a pseudocode to do that please (4 bits mode) ??
Code:
LCDWaitLong(300); //wait >40ms
/* write LCD init seq to SPI 0x 20 Function Set*/
LCD_4bit_Init =0x02;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
LCDWaitShort(1);
SPIClearRecieveDataReg(&u8TempValue);/* Clear receive data register. */
LCD_4bit_Init =0x00;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
/* write LCD init seq to SPI 0x 20 Function Set*/
LCD_4bit_Init =0x02;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
LCDWaitShort(1);
SPIClearRecieveDataReg(&u8TempValue);/* Clear receive data register. */
LCD_4bit_Init =0x00;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
/* write LCD init seq to SPI 0x 20 Function Set*/
LCD_4bit_Init =0x02;
LCDWaitShort(5); //wait 100 us
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
LCDWaitShort(1);
SPIClearRecieveDataReg(&u8TempValue);/* Clear receive data register. */
LCD_4bit_Init =0x00;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
/* write LCD init seq to SPI 0x 0F Display On/Off Control*/
LCDWaitShort(5);//wait 100 ms
LCD_4bit_Init = 0x00;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
LCDWaitShort(1);
SPIClearRecieveDataReg(&u8TempValue); /* Clear receive data register.*/
LCD_4bit_Init =0x0F;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
/* write LCD init seq to SPI 0x 01 Display Clear*/
LCDWaitShort(5);//wait 100 ms
LCD_4bit_Init = 0x00;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
LCDWaitShort(1);
SPIClearRecieveDataReg(&u8TempValue); /* Clear receive data register. */
LCD_4bit_Init =0x01;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
/* write LCD init seq to SPI 0x 06 Entry Mode Set*/
LCDWaitLong(60);//wait 10 ms
LCD_4bit_Init = 0x00;
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
LCDWaitShort(1);
SPIClearRecieveDataReg(&u8TempValue);/* Clear receive data register. */
LCD_4bit_Init =0x06; //
SPIWaitTXDone();
SPISendChar(LCD_4bit_Init);
LCDWaitTooShort(1);
LCDToggleEN();
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
Attachments
-
96.3 KB Views: 504