Hello,
I’m trying to initialize an lcd display. The lcd is doing something strange when I run the code then turn the power on an off on the lcd the code will perform the last instruction only. For example I if I try to display “Hello”, the “o” will repeat randomly sometimes on the second like a couple of “o’s” sometimes on the top. Again this is running the code and then clicking the power on an off the lcd. I’ve also tried different delays. Any help at all would be highly appreciated; it seems that I have tried everything and nothing it fixing this issue.
Hardware: EM430F6137RF900, lcd: http://www.lumex.com/specs/LCR-U01602DSF+D-WH.pdf
Software: Code Composer Studio v4
Code:
#include <stdio.h> // standard library
#include "cc430f6137.h" //cc430f6137 library
void latch ();
void main()
{
P4DIR = 0xFF; //ALL PORT 4 OUT
P3DIR = 0x07; //3.0, 3.1, 3.2 PORT 3 OUT
P3OUT = 0x00; //SET ENABLE OFF, SET RS and RW OFF
//POWER ON
__delay_cycles(1);
P4OUT = 0x30; //STEP1 - Wake up
latch();
__delay_cycles(1);
P4OUT = 0x30; //STEP2 - Wake up
latch();
__delay_cycles(1);
P4OUT = 0x30; //STEP3 - Wake up
latch();
__delay_cycles(1); //STEP4 - Function set
P4OUT = 0x38;
latch();
__delay_cycles(1); //STEP5 - Display off
P4OUT = 0x10;
latch();
P4OUT = 0x0C; //STEP6 - Display clear
latch();
P4OUT = 0x06; //STEP7 - Entry mode set
latch();
P4OUT = 0x0F; //Set cursor to blink
latch();
}
void latch ()
{
P3OUT ^= 0x04; //on
__delay_cycles(1);
P3OUT ^= 0x04; //off
}