E equ P3.5 | | | RW equ P3.6 | | | RS equ P3.7 | | | | | | | org 00h | | | | | ;------------------------------------------------ LCD init --------------------------------------------------- | | | | t30ms: | mov TMOD,#00000001b | ;start delay 30ms | | mov TH0,#94h | | | mov TL0,#01h | | | clr TF0 | | | setb TR0 | | wait1: | jnb TF0,wait1 | | | | | func: | clr RS | ;set bits to send intructions | | clr RW | | | clr E | | | mov P1,#00111000b | ;2 lines, 5x7 caracter | | lcall send | | | | | onoff: | mov P1,#00001100b | ;display ON, cursor and blink OFF | | lcall send | | | | | clean: | mov P1,#00000001b | ;clear LCD | | lcall send | | | | | datain: | mov P1,#00000110b | ;increment mode,total shift OFF | | lcall send | | | | | ;------------------------------------------------ LCD init end --------------------------------------------- | | | | line1: | setb RS | ;set bit to send data (line1) | | mov P1,#20h | ;' ' | | lcall send | | | mov P1,#20h | ;' ' | | lcall send | | | mov P1,#4Dh | ;'M' | | lcall send | | | mov P1,#41h | ;'A' | | lcall send | | | mov P1,#58h | ;'X' | | lcall send | | | mov P1,#49h | ;'I' | | lcall send | | | mov P1,#4Dh | ;'M' | | lcall send | | | mov P1,#2Dh | ;'-' | | lcall send | | | mov P1,#44h | ;'D' | | lcall envia | | | mov P1,#41h | ;'A' | | lcall send | | | mov P1,#4Ch | ;'L' | | lcall send | | | mov P1,#4Ch | ;'L' | | lcall send | | | mov P1,#41h | ;'A' | | lcall send | | | mov P1,#53h | ;'S' | | lcall send | | | | | line: | clr RS | ;set bit to send intruction | | mov P1,#11000000b | ;go to line2 | | lcall send | | | | | line2: | setb RS | ;set bit to send data (line2) | | mov P1,#77h | ;'w' | | lcall send | | | mov P1,#77h | ;'w' | | lcall send | | | mov P1,#77h | ;'w' | | lcall send | | | mov P1,#2Eh | ;'.' | | lcall send | | | mov P1,#6Dh | ;'m' | | lcall send | | | mov P1,#61h | ;'a' | | lcall send | | | mov P1,#78h | ;'x' | | lcall send | | | mov P1,#69h | ;'i' | | lcall send | | | mov P1,#6Dh | ;'m' | | lcall send | | | mov P1,#2Dh | ;'-' | | lcall send | | | mov P1,#69h | ;'i' | | lcall send | | | mov P1,#63h | ;'c' | | lcall send | | | mov P1,#2Eh | ;'.' | | lcall send | | | mov P1,#63h | ;'c' | | lcall send | | | mov P1,#6Fh | ;'o' | | lcall send | | | mov P1,#6Dh | ;'m' | | lcall send | | | | | | ljmp $ | | | | | t01ms: | mov TH0,#0FCh | ;time delay to pulse Enable bit | | mov TL0,#67h | | | clr TF0 | | | setb TR0 | | wait2: | jnb TF0,wait2 | | | ret | | | | | send: | setb E | ;pulse Enable bit | | lcall t01ms | | | clr E | | | lcall t01ms | | | ret | | Assembly code in txt format - LCD 20x4 | |