It was for 16F72 at 4Mhz written in cc5x. LCD is connected to PORTB.RS at RB7,RW at RB1,EN at RB6. DB7 at RB2,DB6 at RB3, DB5 at RB4, and DB4 at RB5. A function delay_ms() is used , which is not shown here.
code will work for 2x16 character LCD modules.
void lcdw(unsigned char m)
{
PORTB.2=m.7;
PORTB.3=m.6;
PORTB.4=m.5;
PORTB.5=m.4;
en=1;
nop();
nop();
en=0;
}
void nbw(unsigned char m)
{
PORTB.2=m.7;
PORTB.3=m.6;
PORTB.4=m.5;
PORTB.5=m.4;
en=1;
nop();
nop();
en=0;
PORTB.2=m.3;
PORTB.3=m.2;
PORTB.4=m.1;
PORTB.5=m.0;
en=1;
nop();
nop();
en=0;
}
void goadr(unsigned char a)
{
rs=0;
nbw(0x80 + a);
delay_ms(5); // delay of 5msec
}
void main()
{
................
TRISB=0;
PORTB=0;
rw=0;
rs=0;
lcdw(0x28); // lcdw function is only used once to initialise the LCD to 4 bit mode.
delay_ms(5);
nbw(0x28);
delay_ms(5);
nbw(0x0c);
delay_ms(5);
nbw(0x06);
delay_ms(5);
nbw(0x01);
delay_ms(5);
goadr(0x02);
rs=1;
nbw('a'); //displays the character "a" at location 0x02
nbw('b'); //displays the character "b" at location 0x03
.........................
}
News and Materials Headline Animator
Sunday, June 6, 2010
Subscribe to:
Post Comments (Atom)
Popular Posts
-
APPARATUS:- Microprocessor trainer kit, ADC kit, power supply, data cable etc THEORY:- Stepper motor is a device used to obtain an accurate...
-
Line follower is an autonomous robot which follows a particular line of particular width. Its direction is determined by the direct...
-
Program to interface DAC using 8255 and generate square waveform The following is the assembly language using DAC to interface with 8255 a...
-
Gate Paper1 Q.1 - Q.20 Carry One Mark Each 1. If E denotes expectation, the variance of a random variable X is given by 2. The fol...
-
RF Antenna Basics Electromagnetic waves and antenna basics Radio signals are a form of electromagnetic wave, a...
-
We don’t want to imply that Rajnikanth’s jokes are more famous than his movies. But let’s face it how many Rajni movies have you actually se...
-
It's Technical Event at Aditya Engineering College,East Godavari District,Andhra Pradesh ,India SEP 14th 2010 to SEP 18th 2010 ...
-
Apple’s iPhone 4 was labeled as the smartest phone ever. But it might not be for everyone. If you are not going the Apple way, then there a...
-
Two class seven students allegedly mixed poison into a water tanker in their school to get their holidays extended on Monday at Bhirtana ...
No comments:
Post a Comment