2X16 LCD LMB 126 Programming on 8051 Microcontroller

Most LCD programmed in 8 bit configuration. Moreover LCD put on equipment that show the value of measurement, i.e. temperature, voltage, current, etc. There are a lot of tutorial show steps how to configure out in order to LCD on. But each LCD has  own characteristic. The best way to decide the function of each pin is just check out the serial number of LCD. Get its pdf files, then it has to compatible with the hardware.

I ever made a mistake when I did not check the function each pin. It caused a lot of tutorial of LCD programming in 8051 microcontroller use the HD44780 series, meanwhile I bought the LMB 162 A. It has most different from the function of B+, ground and data, Huh I break it down. I just wasted my 6 USD, I though…

Okay, actually these will show to programmed the LMB 126 A using 8 bit microcontroller. I used ATMEL 89S52 as my microcontroller, but it also compatible with 8051 language programming. In the figure bellow, I used 8 bit data (pin 7 till 16) connect to port 2 microcontroller. Pin number 4 is port 1.3 then pin number 5 is port 1.4.

 micro-LCD interfacing

Base from the LCD Characteristic, the software has to follow the rule bellow in order to the LCD can be adjusted and showed the characters we want. Time delay rutine can be found easily. Just googling, find it, how simple it is.

 

flowchart LCD

After we know about the sequence software (above), let start to write the code, compile it then upload it to chip. I my self have my code, here bellow:

rs equ 94h;p1.4

en equ 93h;p1.3;Send_DataLCD EQU 280H

lcall init_lcd;

mov dptr,#message1;

lcall sendmessage_lcd;

lcall write_in_lower;

mov dptr,#message2;

lcall sendmessage_lcd;

lcall delay_1_s;

lcall delay_1_s;

lcall delay_1_s; 

lcall delay_1_s;

call clr_lcd ;

mov dptr,#message3;

lcall sendmessage_lcd;

lcall write_in_lower;

mov dptr,#message4;

lcall sendmessage_lcd;

lcall delay_1_s;

lcall delay_1_s; ;

lcall delay_1_s;

lcall delay_1_s;

;;;;LCD NEED RUTINE OF ;;;;;;;;;

;===========================|

Init_LCD:; 

Mov A,#00111000b ; Send 38H

Lcall Send_Perintah; 

call delay_200_us; 

Mov A,#00001110b;send 0eh

Lcall Send_Perintah ; 

call delay_200_us; 

Mov A,#01H;send 01H

Lcall Send_Perintah ; 

call Delay_50_ms;  

Mov A,#00000110b;Mode Incr. Address

Lcall Send_Perintah; 

call delay_200_us; 

Ret ; 

;======================================|

clr_lcd: ; 

Mov A,#00000001b;Mode Increament Address 

Lcall Send_Perintah;

call delay_50_ms;

Ret

write_in_lower:

Mov A,#0c0h;

Lcall Send_Perintah;

call delay_200_us;

ret

;=====================================|

sendMessage_LCD:

LoopSendMessage_LCD:

Mov A,#00H;

Movc A,@A+Dptr;

Cjne A,#0FH,Send_LCD;

Ret

Send_LCD:

Lcall Send_Character

Inc Dptr;

Ajmp LoopSendMessage_LCD

;============ =========================|

Send_perintah:

clr rs

Lcall Send_DataLCD

call delay_200_us

Ret

Send_Character:

setb rs

Lcall Send_DataLCD

call delay_200_us

Ret

Send_DataLCD:

Mov p2,A

Nop

Acall Pulse_Clock

Ret

Pulse_Clock:

setb en

nop

clr en

ret

Send_Character:

                                setb rs

                                Lcall Send_DataLCD

                                call delay_200_us

                                Ret

Send_DataLCD:                

                                Mov p2,A

                                Nop

                                Acall Pulse_Clock

                                Ret

Pulse_Clock:

                                setb en

                                nop

                                clr en    

                                ret

……………………….

;MESSAGE TO LCD

message1:

db ‘DATA MONITORING ‘,0fh

message2:

db ‘ACCESSED BY SMS ‘,0fh

message3:

db ‘    amansubanjar’,0fh

message4:

db ‘      @gmail.com’,0fh

 

;RUTINE OF DELAY

;==============

delay_50_ms:

mov tmod,#21h

mov th0,#02ch

mov tl0,#012h

setb tcon.4 ; tcon.4 = tr0

count_50_ms:

jbc tf0,finish_50_ms

jbc tcon.5,finish_50_ms ; tcon.5 = tf0

sjmp count_50_ms

finish_50_ms:

ret

delay_200_us:

mov tmod,#21h

mov th0,#0ffh

mov tl0,#027h

setb tcon.4 ; tcon.4 = tr0

count_200_us:

jbc tf0,finish_200_us

jbc tcon.5,finish_200_us ; tcon.5 = tf0

sjmp count_200_us

finish_200_us:

ret

delay_1_s:

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

call delay_50_ms

ret

;===========================| 

 

end

One Response to “2X16 LCD LMB 126 Programming on 8051 Microcontroller”

  1. Thank you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: