You are on page 1of 4

QuesunLCD?

ElLCD(LiquidCrystalDysplay)opantalladecristallquidoesundispositivoempleadoparalavisualizacindecontenidos,
mediantecarcteres,smbolosopequeosdibujosdependiendodelmodelo.
EnestecasovamosaemplearunLCDde16x2,estoquieredecirquedisponede2filasde16caracterescadauna.Lospxelesde
cadasmboloocarcter,varanenfuncindecadamodelo.

Cmoseconecta?
EnlasiguienteimagendeProteussepuedeobservarlaestructuradesuspines.
LopodemosdividirenlosPinesdealimentacin,pinesdecontrolylospinesdelbusdedatosbidireccional.Porlogeneral
podemosencontrarademasensuestructuralospinesdenodoyctododeled.

Pinesdealimentacin:
Vss:Gnd
Vdd:+5voltios
Vee:correspondealpindecontraste,loregularemosconunpotencimetrode10K

Pinesdecontrol:

RS:Correspondealpindeseleccinderegistrodecontroldedatos(0)oregistrodedatos(1).EsdecirelpinRSfunciona
paralelamentealospinesdelbusdedatos.CuandoRSes0eldatopresenteenelbusperteneceaunregistrode
control/instruccin.ycuandoRSes1eldatopresenteenelbusdedatosperteneceaunregistrodedatosouncarcter.
RW:CorrespondealpindeEscritura(0)odeLectura(1).Nospermiteescribirundatoenlapantallaoleerundatodesdela
pantalla.
E:CorrespondealpinEnableodehabilitacin.SiE(0)estoquieredecirqueelLCDnoestaactivadopararecibirdatos,perosi
E(1)seencuentraactivoypodemosescribiroleerdesdeelLCD.

PinesdeBusdedatos:

ElBusdedatosbidireccionalcomprendedesdelospinesD0aD7.PararealizarlacomunicacinconelLCDpodemoshacerlo
utilizandolos8bitsdelbusdedatos(D0aD7)oempleandolos4bitsmassignificativosdelbusdedatos(D4aD7)

LalibreradelLCD:

ParapodervisualizarloscaracteresosmbolosenelLCDesnecesarioqueenelprogramadecdigofuenteaemplear,
incluyamoslalibrera.
Enestecasoempleamoslalibrera"lcd.c".
Lalibreravieneconfiguradadeestamanera

#defineLCD_ENABLE_PINPIN_E0
#defineLCD_RS_PINPIN_E1
#defineLCD_RW_PINPIN_E2
#defineLCD_DATA4PIN_D4
#defineLCD_DATA5PIN_D5
#defineLCD_DATA6PIN_D6
#defineLCD_DATA7PIN_D7

VamosaconfigurarparapoderusarelPINquenosotrosdeseamos,enestecasoparausarelpuertoDdelPIC.
#defineLCD_ENABLE_PINPIN_D0
#defineLCD_RS_PINPIN_D1
#defineLCD_RW_PINPIN_D2
#defineLCD_DATA4PIN_D4
#defineLCD_DATA5PIN_D5
#defineLCD_DATA6PIN_D6
#defineLCD_DATA7PIN_D7

otambindeestamanera

#defineLCD_DATA_PORTgetenv("SFR:PORTD")
#defineLCD_ENABLE_PINPIN_D0
#defineLCD_RS_PINPIN_D1
#defineLCD_RW_PINPIN_D2

Funcionesausar:

lcd_init():Inicializaellcd

lcd_gotoxy(x,y):Establecelaposicindeescrituraenellcd.

lcd_putc(chars):nosmuestraundatoenlasiguienteposicindellcd.

\fselimpiaellcd
\nelcursorseposicionaaliniciodelasegundalnea
\belcursorretrocedeunaposicin

lcd_getc(x,y):leeelcarcterdelaposicin(x,y)

printf(lcd_putc,cadena,variable)
Ejemplo: printf(lcd_putc,"\n %2.2f la temperatura es: ",temp);
donde temp: variable

You might also like