I nt er f aci ngLCDt oar dui no I nt er f aci ng LCDt oAr dui nouno. L CDmo du l e sf o r m av e r yi mp or t a ntp ar ti nma ma n yar d ui n ob as e demb ed de ds y s t e md es i g ns .So t h ek no wl e dg eo ni n t er f a ci n gL CDt oa r d ui n oi sv er yes s en t i a li nd es i gn i ng embe dd eds y s t ems . Th i sa r t i c l ei sab outi n t e r f a ci n ga16 ×2LCD t oAr d ui n o.J HD16 2Ai st heL CDmo du l eus edher e . JHD162Ai sa16×2LCDmodul ebasedont heHD44780dr i verf r om Hi t achi .TheJHD162Ahas 1 6p i n san dc a nb eo pe r a t e di n4b i tmo deor8 b i tmo de .He r ewear eus i n gt h eL CDmo du l ei n 4bi tmode.Fi r s t ,Iwi l l s ho wy ouho wt odi s pl a ypl ai nt e xtmes s agesont heLCDmodul eus i ng ar dui noandt hen f ewus ef ul pr oj ec t sus i ngLCDandar dui no.Bef or egoi ngi nt ot hede t ai l soft he pr o j e ct ,l e t ’ sha v eal o oka tt heJ HD16 2AL CDmod ul e .
JHD162ALCDmodul e16×2. Th eJ HD1 62 Ah as1 6p i n san dc a nbeop er a t e di n4b i tmo deor8 b i tmo de .He r ewear eus i n g t heL CDmodul ei n4bi tmode.Bef or egoi ngi nt ot hedet ai l soft hepr oj ec t ,l et ’ sha veal ookatt he JHD162ALCDmodul e. Theschemat i cofaJHD162ALCDmodul ei sgi venbel ow.
Th ena mean me df u nc t i o nso fe ac hp i no ft h eJ HD1 62 AL CDmo du l ei sg i v e nbe l o w. Pi n1( Vss) : Gr o un dp i noft h eL CDmo du l e .
Pi n2( Vcc) : +5Vs uppl yi sgi v ent ot hi spi n
Pi n3( VEE) : Con t r a s ta dj u s t me ntp i n .Th i si sdo neb yc on ne ct i n gt h een dso fa1 0Kp ot e nt i me t e r t o+5 Va ndg r o un da ndt h enco nn ec t i ngt h es l i de rp i nt ot h eVEEp i n .Th ev o l t a gea tt h eVEEpi n defi nest hecont r as t .Theno r ma ls et t i ngi sbe t ween0. 4an d0. 9V.
Pi n4( RS) : Re gi s t e rs el e ctpi n . Th eJ HD1 62 Ah ast wor eg i s t e r sn amel yc omma ndr eg i s t e ran dda t a r egi s t er .Logi cHI GHatRSpi nsel ec t sdat ar egi s t erandl ogi cL OW atRSpi nwi l l s el ec tc ommand r e gi s t e r .I fwema k et h eRS p i nHI GH a ndp utad at ao nt h ed at al i n es( DB0t oDB7 )i twi l lb e r e co gn i z eda sad at a .I fwema k et h eRSp i nL OW a ndp utad at aont h ed at al i ne s,t he ni twi l l b e t ak enasac ommand. Pi n5( R/ W) :Re ad / Wr i t emo de s .Th i sp i ni su s edf o rs e l e c t i n gb et we enr e ada ndwr i t emo de s . Logi cHI GHatt hi spi nac t i v at esr eadmodeandl ogi cL OW att hi spi nac t i v at eswr i t emode. Pi n6 ( E) :Th i sp i ni sme an tf o re n ab l i n gt h eL CD mo du l e .AHI GH t oL OW s i g na la tt h i spi nwi l l e na bl et h emo du l e . Pi n7( DB0)t oPi n14( DB7) :Th es ear eda t api n s .Th ec o mma nd san dd at aar epu to nt h es epi n s .
Pi n15( LED+) :An od eo ft h eb ac kl i g htL ED.Wh eno pe r a t e do n5 V,a5 60o hm r e s i s t o rs h ou l db e c onnec t edi ns er i est ot hi spi n.I nar dui nobas edpr oj ec t st hebac kl i ghtLEDc anbepo wer edf r om t h e3 . 3 Vs ou r c eo nt hear d ui n ob oa r d .
:Ca t ho deo ft h eb ac kl i g htL ED. Pi n16( LED) Fo rk n owi n gmo r ea bo utL CD mo du l eJ HD1 62 Aa ndi ti n t e r f a c i n g,r e adt h i sa r t i c l e :I nt er f ac i ng 16×2 LCD and 8051 mi cr ocont r ol l er .Th ec i r c ui td i ag r a m o fi n t e r f a ci n gL CD t oa r d ui n of o r di s pl a y i n gat e x tme ss ag ei ss ho wnbe l o w.
Ci r c ui tdi agr am.
RSp i no ft h eL CDmo dul ei sc on ne ct e dt od i gi t a lp i n12oft h ea r du i no .R/ Wp i no ft heL CDi s gr ounded .Enabl epi noft heL CDmodul ei sconn ec t edt odi gi t a lp i n11oft hear dui no.I nt hi s pr oj e ct ,t heL CDmod ul eandar dui noar ei nt er f ac edi nt he4bi tmode.Thatmea nsonl yf ourof t hedi gi t al i nputl i nes (DB4t oDB7oft heLCDar eus ed) .Thi smet hodi sv er ys i mpl e,r equi r es l es sc onnec t i onsandy ouc anal mos tut i l i z et hef ul l pot ent i al oft heL CDmodul e.Di gi t al l i nes DB4 ,DB5 ,DB6a ndDB7a r ei n t e r f a ce dt od i gi t al p i n s5 ,4 ,3and2oft heAr d ui n o.Th e1 0K pot ent i omet eri sus edf oradj us t i ngt hec ont r as toft hedi s pl ay .560ohm r es i s t orR1l i mi t st he c ur r e ntt h r o ught h eb ac kl i g htL ED.Thea r d ui n oc anbep owe r e dt h r ou ght h ee x t e r n al p owe rj a ck pr o vi dedont heboa r d.+5Vr equi r edi nsomeo t herpar t soft hec i r c ui tc anbet appedf r om t he5V s o ur c eont h ea r d ui n ob oa r d .Th ea r d ui n oc a nb ea l s opo we r e df r o mt h ePCt h r o ug ht h eUSB por t .Thef ul l pr ogr am f ori nt er f ac i ngLCDt oar dui noi ss hownbel ow.
Pr ogr am. #include
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // sets the interacin! "ins
$id setu"() % lcd.&e!in(1', 2); // initialies the 1'2 LC* +
$id l$$"() % lcd.setCurs$r(,);
//sets the curs$r at r$- c$lun
lcd."rint(1'2 LC* 0*L); // "rints 1'2 LC* 0*L lcd.setCurs$r(2,1);
//sets the curs$r at r$- 1 c$lun 2
lcd."rint(LL 6L*);
// "rints LL 6L*
+
Aboutt hepr ogr am. Li br ar yf unc t i on“ Li qui dCr y st al . h”i sus edf ordi s pl ay i ngt hedes i r edc har ac t er sont heL CD modul e.I ti sr eadi l yav ai l abl ewi t ht heAr dui nous eri nt er f ac eandi tc anbeac c es sedt hr ought he “ I mpor tl i br ar y ”i nt he“ s k et c h”t abi nt hemai nmenubar .TheLi qui dCr y st al . hpr o vi desf unc t i ons f oral mos tal l appl i c at i onsl i k epr i nt i ngas t r i ng,s et t i ngt hec ur s or ,i ni t i al i z i ngt heL CD,s c r ol l i ngt he di s pl a yet c .
Pr ogr am f ors cr ol l i ngt hedi s pl ay . As i mpl epr ogr am f ors c r ol l i ngat e xtont heL CDus i ngar dui noi ss ho wnher e.Thi si sdoneus i ng t he“ s c r ol l ( ) ”f unc t i on.Forex ampl et hef unc t i on“ l c d. s c r ol l Di s pl ay Ri ght ( ) ”wi l l s c r ol l t hedi s pl ayt o
r i ghtandt hef unc t i on” l c d. s c r ol l Di s pl a y Lef t ( ) ”wi l l s c r ol l t hedi s pl ayt ol ef t .A“ f or ”l oopi sus edf or s el ec t i ngt henumberofpos i t i onst os cr ol l atat i me.I nt hepr ogr am s hownbel ow,i ti schos ent o be2bec aus et het e xtt obed i s pl a y edi sc ompar at i v el yl ong.Fors hor t ert e xt smor enumberof pos i t i onsmus tbes cr ol l edatat i met oge tas moo t hdi s pl a y .
#include int i7;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
$id setu"() % lcd.&e!in(1', 2);
//initialies 1'2 LC*
lcd."rint(1'2 LC* 0*L 8*1'29 : 96*=); //tet t$ dis"lay +
$id l$$"() % $r(i7;i<2;i) %lcd.scr$ll*is"layLet();+ delay(?); +
//scr$lls dis"lay let &y t-$ "$siti$ns
//sets the s"eed at -hich dis"lay $es