I installed a NHD-0216HZ-FSW-FBW-33V3C with an MSP430g2553. I tried to initialize it for 4-bit mode in assembly language but black boxes still shown and initialization is not completed I think.
My connections are: DB4-DB7 --> P1.4-P1.7 respectively, RS --> P2.0, R/W --> P2.1, Enable --> P2.2
Here is my code:
Init: bic.b #0xFF,P1OUT ;Clear P1, P1 = 0
bis.b #0x01,&P2OUT ;High RS = 1
bic.b #0x01,&P2OUT ;Clear RS = 0
call #Delay100ms
mov.b #0x30,&P1OUT
call #Nibble ;Wake up 1
call #Delay10ms
call #Nibble ;Wake up 2
call #Delay10ms
mov.b #0x20,P1OUT
call #Nibble ;Wake up 3
call #Command28
call #Command10
call #Command0F
call #Command06
ret
Nibble bis.b #0x04,&P2OUT ;Enable High
call #Delay1ms
bic.b #0x04,&P2OUT ;Clock Enable - Falling Edge
ret
Command28 mov.b #0x28,&P1OUT //Data in port
bic.b #1,&P2OUT //RS = 0 : Send Instruction
bic.b #0x02,&P2OUT //R/W = 0 : Write
call #Nibble //Send Lower 4 Bits
mov.b #0x28,R4
push R4
mov.b #4,R5 ;Rotate Left Counter
C28 rla.b R4
dec R5
jnz C28
mov.b R4,&P1OUT //put data in output port
call #Nibble //Send upper 4 bits
pop R4
and.b #0xF0,R4
mov.b R4,&P1OUT
ret
This code is following the code in the NHD-0216HZ-FSW-FBW-33V3C datasheet from LCD Display Datasheet. If someone can help me.