Oasis Technologies Pvt.

Ltd

LCDInit

Wait for the LCD to get ON waitOnPowerOnForLCD () Configure the pins connected to LCD as general purpose I/O PINSEL0 = PINSEL0 & ~(0x00FF0000) (modify the PINSEL0 reg) PINSEL2 = 0x00 (update PINSEL2 reg). Set the direction of the selected pins as OUTPUT] IODIR0 = IODIR0 | 0x00001800; IODIR1 = IODIR1 | 0X00FF0000; Function Set command for LCD lcdcmd (0x38) Display On command for LCD lcdcmd (0x0e); Clear Display command for LCD lcdcmd(0x01); Entry mode set command for LCD lcdcmd (0x06); Set DDRAM address command for LCD lcdcmd (0x80);

return

cursratline1clm1

Set DDRAM address command for LCD lcdcmd (0x80);

return

inccursor

Entry mode set command for LCD lcdcmd (0x06); (increment the cursor)

return

www.oasistech.co.in

IOCLR0 = IOCLR0 | 0x00001000. cmddata = cmddata << 16 (to set the appropriate lines) Write the command data on the data lines. Set DDRAM address command for LCD lcdcmd (0x80 return lcdcmd Make the RS line =0 to write into the command reg of the LCD IOCLR0 = IOCLR0 | 0x00000800 Clear all the data lines selected for the LCD. IOCLR1 = IOCLR1 | 0x00ff0000. . IOSET1 = IOSET1 | cmddata. Set the Enable pin.oasistech. Align the data properly into the register. return www. IOCLR0 = IOCLR0 | 0x00001000.Ltd clrscreen Clear Display command for LCD lcdcmd(0x01). Clear the Enable Pin. IOSET0 = IOSET0 | 0x00001000 Delay for some time.Oasis Technologies Pvt.in .co. Clear the Enable Pin. Delay for some time.

oasistech. IOCLR0 = IOCLR0 | 0x00001000.in .co. inccursor(). Align the data properly into the register. Set the Enable pin. outdata = outdata << 16 (to set the appropriate lines) Write the LCD data on the data lines. . IOCLR0 = IOCLR0 | 0x00001000. Increment string pointer www. IOSET0 = IOSET0 | 0x00001000 Delay for some time. Delay for some time. IOCLR1 = IOCLR1 | 0x00ff0000. IOSET1 = IOSET1 | outdata.Oasis Technologies Pvt.Ltd lcddata Make the RS line =1 to write into the data reg of the LCD IOSET0 = IOSET0 | 0x00000800 Clear all the data lines selected for the LCD.. Clear the Enable Pin. Clear the Enable Pin. inccursor(). return DisplayLCD N length of string !=0 return Y Call lcddata with the value=character.

val = val / 10. return www.in . Val = user specified count. printstr[count++] = val % 10. count++.Ltd PrintData Count =0.oasistech.co. Val /10 ! = 0 N Y printstr[count] = val % 10.Oasis Technologies Pvt. asciidata(val). Count ! = 0. val = printstr[--count].

Align the data properly into the register. IOCLR0 = IOCLR0 | 0x00001000. IOSET0 = IOSET0 | 0x00001000 Delay for some time. IOCLR0 = IOCLR0 | 0x00001000. return www. . Clear the Enable Pin. IOSET1 = IOSET1 | outdata. Set the Enable pin. Clear the Enable Pin.Ltd asciidata Add 30 to the parameter received outdata += 0x30 Make the RS line =1 to write into the data reg of the LCD IOSET0 = IOSET0 | 0x00000800 Clear all the data lines selected for the LCD. outdata = outdata << 16 (to set the appropriate lines) Write the LCD data on the data lines.in .co. IOCLR1 = IOCLR1 | 0x00ff0000.Oasis Technologies Pvt.oasistech. Delay for some time.

Sign up to vote on this title
UsefulNot useful