Você está na página 1de 7

DISPLAY DE LCD 16x2

O chip que se encontra dentro do display um HITACHI HD44780 ou algum outro que se a compat!"el com o mesmo# $ossui %4 pinos& Nmero Smbolo Funo % 'ss 0" $o(er )upply *+,D -e"el. / 'dd $o(er )upply 0or -ogic Circuit 1 'o Is 0or ad usting the contrast o0 the display# 2sually3 (hen this pin is grounded the pi4els (ill 5e the dar6est 4 7) Data8Instruction select 9 78: Determines i0 (e read 0rom or (rite to the -CD ; < <na5les or disa5les the -CD module 7=%4 D>0=D>7 >i=directional data 5us OBS: ?uando o pino < est@ A5ai4oB3 o display se encontra desa5ilitado e os "alores que se encontram nos pinos 7)3 78: e no 5arramento de dados serCo ignorados#

e!"#$er Sele%$ & S':


7) D A0B quando se en"ia para o display uma instruECo *instruction register. 7) D A%B quando se en"ia para o display um caractere *data register. )egue a5ai4o um esquem@tico do display&

D"#(l)* D)$)

A+ &DD A+':

Display data 7AF pra onde "ocG manda os caracteres *A)CII code. que "ocG quer "er na tela do -CD# )ua capacidade de 80 caracteres *5ytes.# O endereEo da DD7AF a posiECo do cursor *e4& onde o dado que "ocG en"iou ser@ mostrado.# A5ai4o sCo mostrados os endereEos da DD7AF&

C,)r)%$er -ener)$or

A+ &C- A+':

,o C+7AF o usu@rio pode de0inir seus prHprios caracteres por programaECo# C+ 7AF de ;4 5ytes#

e!"#$er#:
O HDD44780 tem dois registradores de 8 5its3 um o instruction register *I7. e o outro o data register *D7.# O I7 gra"a cHdigos de instruEIes3 como limpar display e shi0t do cursor3 e in0ormaECo de endereEo para DD7AF e C+7AF# O D7 gra"a temporariamente dados para serem escritos na DD7AF ou C+7AF e dados para serem lidos da DD7AF ou C+7AF# O dado escrito no D7 automaticamente escrito na DD7AF ou C+7AF por uma operaECo interna# <sses dois registradores podem ser selecionados pelo register select *7).&

Register Selection RS R/W Operation 0 0 1 1 0 1 0 1 IR write as an internal operation (display clear, etc.) Read busy flag (DB7) and address counter (DB0 to DB6) DR write as an internal operation (DR to DDR ! or "#R !) DR read as an internal operation (DDR ! or "#R ! to DR)

Bu#* Fl)! &BF':


?uando o 5usy 0lag A%B3 o HD44780 est@ no modo de operaECo interno e a prH4ima instruECo nCo ser@ aceita# ?uando 7) D A0B e 78: D A%B3 o 5usy 0lag colocado na sa!da do D>7# A instruECo seguinte de"e ser escrita apHs ter=se assegurado de que o 5usy 0lag A0B#

A..re## Coun$er &AC':


O AC atri5ui endereEos para DD7AF e C+7AF# ?uando o endereEo de uma instruECo setada no DD7AF8C+7AF escrito dentro do I73 o endereEo da in0ormaECo mandado do I7 para o AC# A seleECo tanto do DD7AF como do C+7AF determinada tam5m simultaneamente pela instruECo# Depois de escre"er na *ou ler da. DD7AF ou C+7AF3 o AC automaticamente incrementado ou decrementado por %#

$ara mostrar um caractere3 a posiECo do dado escrita no I7 *endereEo na DD7AF.# O cHdigo do caractere entCo escrito no D7 e o -CD mostra o caractere correspondente na posiECo especi0icada# O -CD pode ainda incrementar ou decrementar a posiECo no display depois de cada caractere ter sido mostrado3 sH que para isso acontecer de"e=se ter uma string de caracteres# $ara que um caractere se a escrito no display3 o mesmo de"e ser inicialiJado antes#

LCD Comm)n.#:
+----+-----+-------------------------------------------+ | RS | P0 | Descrio | +----+-----+-------------------------------------------+ | 0 | 38H | 8 bits, 2 linhas, 5 x 8 font | | 0 | 0FH | display on, cursor on, blink on | | 0 | C0H | posiciona o cursor na na linha , coluna 0| | 0 | 80H | posiciona o cursor na na linha 0, coluna 0| | 0 | 8!H | posiciona o cursor na na linha 0, coluna !| | 0 | C8H | posiciona o cursor na na linha , coluna 8| | 0 | 0"H | inc# cursor position, scroll on | | 0 | 0 H | cl$ar display | | | xxH | $scr$%$ dado xx &'(C))* no display 8 bits | +----+-----+-------------------------------------------+ A in0ormaECo3 tanto de con0iguraECo quanto de dado3 sH ser@ escrita no display3 no e"ento de uma transiECo de % para 0 no 5it <, *$1#;.# A transiECo de"er@ le"ar3 no m!nimo3 490 ns para ocorrer *e4# colocar o sinal <, em K%K3 e4ecutar uma rotina de delay para esperar por 490 ns3 colocar o sinal <, de "olta em K0K para realiJar a escrita no display.# 2m delay em torno de 9 us su0iciente#

The commands 0or HD44780 chip are sho(n in the ta5le 5elo(# INSTRUCTION Function set (8 !it inte"#ace$ % lines$ &'( )ixels* Function set (8 !it inte"#ace$ 1 line$ &'( )ixels* Function set (- !it inte"#ace$ % lines$ &'( )ixels* Function set (- !it inte"#ace$ 1 line$ &'( )ixels* .nt"/ mode set Sc"oll dis2la/ one c3a"acte" "i43t (all lines* Sc"oll dis2la/ one c3a"acte" le#t (all lines* Home (mo5e cu"so" to to2/le#t c3a"acte" 2osition* 6o5e cu"so" one c3a"acte" le#t 6o5e cu"so" one c3a"acte" "i43t Tu"n on 5isi!le unde"line cu"so" Decimal &+ -8 -0 ,% See 0elo1 %8 %% 1+ %0 1Hexadecimal ,8 ,0 %8 %0 See 0elo1 1. 18 % 10 10.

Tu"n on 5isi!le !lin7in4 !loc7 cu"so" 6a7e cu"so" in5isi!le 0lan7 t3e dis2la/ (1it3out clea"in4* Resto"e t3e dis2la/ (1it3 cu"so" 3idden* Clea" Sc"een Set cu"so" 2osition (DDR86 add"ess* Set 2ointe" in c3a"acte" 4ene"ato" R86 (C: R86 add"ess* Read DDR86/C:R86 ; C3ec7 0us/ Fla4 En$r* mo.e #e$ %omm)n.

1& 1% 8 1% 1 1%8 9 add" +- 9 add" See 0elo1

0F 0C 08 0C 01 809 add" -09 add" See 0elo1

This command sets cursor mo"e direction and display shi0t O,8OLL# There are 4 possi5le 0unction set commandsM043 093 0;3 and 07# This command changes the direction the cursor mo"es 5y setting the address counter to increment or decrement# :hen the address counter is set to D<C7<F<,T3 strings sent to the -CD (ill 5e printed in re"erse order# The same thing applies to the C+ 7AF3 as (ell# http&88(((#geocities#com8dinceraydin8lcd8commands#htm C,e%/"n! $,e Bu#* Fl)! To chec6 the state o0 the 5usy 0lag and read the address counter& %# /# 1# 4# )et 78: $in o0 the -CD HI+H*read 0rom the -CD. )elect the instruction register 5y setting 7) pin -O: <na5le the -CD 5y )etting the ena5le pin HI+H The most signi0icant 5it o0 the -CD data 5us is the state o0 the 5usy 0lag*%D>usy30Dready to accept instructions8data.#The other 5its hold the current "alue o0 the address counter#

Com(le$e %omm)n. re0eren%e:

De0"n"n! Cu#$om C,)r)%$er#:


C,)r)%$er1-ener)$or O+ )n. A+:

:hen you send the A)CII code 0or a character li6e $A% to an -CD module3 the module&s controller loo6s up the appropriate 948=pi4el pattern in 7OF *read=only memory. and displays that pattern on the -CD# That character= generator 7OF contains %N/ 5it maps corresponding to the alpha5et3 num5ers3 punctuation3 Oapanese Pan i characters3 and +ree6 sym5ols# The 7OF is part o0 the main -CD controller *e#g#3 HD447803 P)00;;3 etc#.3 is mas6=programmed3 and cannot 5e changed 5y the user# The manu0acturers

do o00er alternati"e sym5ols sets in 7OF 0or <uropean and Asian languages3 5ut most 2#)# distri5utors stoc6 only the standard character set sho(n in the -CD )erial >ac6pac6 manual# Alphanumeric -CD controllers do not allo( you to turn indi"idual pi4els on or o00 'they ust let you pic6 a particular pattern *corresponding to an A)CII code. and display it on the screen# I0 you can&t change the 7OF and you can&t control pi4els3 ho( do you create graphics on these -CDsQ <asy# There &s a ;4=5yte hun6 o0 7AF *random=access memory. that the -CD controller uses in the same (ay as character=generator *C+. 7OF# :hen the controller recei"es an A)CII code in the range that&s mapped to the C+ 7AF3 it uses the 5it patterns stored there to display a pattern on the -CD# The main di00erence is that you can (rite to C+ 7AF3 there5y de0ining your o(n graphic sym5ols# <ach 5yte o0 C+ 7AF is mapped to a 0i"e=5it horiJontal ro( o0 pi4els3 and -CD characters are typically eight ro(s high3 so ;4 5ytes o0 C+ 7AF is enough to de0ine eight custom characters# These characters correspond to A)CII codes 0 through 73 (hich normally ser"e as control codes 0or mar6ing the 5eginning o0 a serial transmission or ringing the 5ell on a terminal# )ince these ha"e no meaning to an -CD module3 the designers appropriated them 0or C+ 7AF# :hen an -CD is 0irst po(ered up3 C+ 7AF contains random 5its gar5age# I0 necessary3you may clear C+ 7AF 5y (riting 00 into each C+ 7AF cell# 2r"$"n! $o CA+:

:riting to C+ 7AF is a lot li6e mo"ing the cursor to a particular position on the display and displaying characters at that ne( location# The steps are&

7eset 7) and 78: pins o0 the -CD to prepare the -CD to accept instructions )et the C+ 7AF address 5y sending an instruction 5yte 0rom ;4 to %/7 *locations 0(;1 in C+ 7AF.# )(itch to DATA FOD< 5y changing setting the 7) pin )end 5ytes (ith the 5it patterns 0or your sym5ol*s.# The -CD controller automatically increments C+ 7AF addresses3 ust as it does cursor positions on the display# To lea"e C+ 7AF3s(itch to COFFA,D FOD< to set address counter to a "alid display address *e#g# %/83 %st character o0 %st line.M the clear=screen instruction *5yte %.M or the home instruction *5yte /.# ,o( 5ytes are once again 5eing (ritten to the "isi5le portion o0 the display# To see the custom character*s. you ha"e de0ined3 print A)CII codes 0 through 7#

B"$m)( l)*ou$ ex)m(le:

S"m(le An"m)$"on: Rou can create a sort o0 animation 5y rapidly printing a series o0 custom characters at the same screen position#

L"n/#:
%. http&88(((#geocities#com8dinceraydin8lcd8inde4#html /. http&88(((#in0#pucrs#5r8Seduardo58disciplinas8topicosTsdaciiTpos8809%8<4e mplosTC8display#c

Você também pode gostar