Hi,
This article explains interfacing ofLwith8051using 4-bit mode. In this mode only four pins are used for sending data and command instructions. This mode has the advantage over the 8-bit mode as it uses less of pins. The remaining pins of the controller are available for normal use.
The Data or command is sent in nibble form (1 nibble= 4 bit) in the 4-bit mode. The higher nibble is sent first followed by the lower nibble. The function of RS, RW and EN pins remains similar to 8-bit mode.
Circuit description:
Initialization:
Instruction
According totable,the value of Function Set for 4 –bit mode will be 0010 0000(0x20) because DL=0. The value “Function Set” for the L configuration 2 line (N=1), 5X7 dots (F=0) and 4-bit (DL=0) mode will be 0010 1000(0x28).
When the power supply is given to L, it remains in 8-bit mode. Now, if 0x20 is sent, lower nibble will not be received by L because four data lines (D4-D7) are connected, so 0x02 is sent instd of 0x20.
nowsimple program for L :
L.C
#include <reg51.h>
void main()
linit();
}
L.H
/*
Hi I am Ramoliya Biren.
ldatas(row no,"DATA which u need to desplay"); for desplay string on l
ldata("data(only single char) which u need to desplay on l")
lblink(no of time u wont to blink data,"data which u wont to blink"); hr data desplay on row 1 only
lrotade (row no,'direction of rotaed l or r',"data which u wont to rotaed");
visit : http://ramoliyabiren.blogspot.com/
*/
#ifndef _leddatas_H
#include <reg51.h>
sfr ldata = 0xA0;
void ldelay (unsigned int itime)
void lcmd(unsigned char value)
void ldata (unsigned char value)
void linit()
void lrow(unsigned char no)
void ldatas (unsigned char row,unsigned char *lstring)
void lblink(unsigned char no,unsigned char *lstring)
void lrotade(unsigned char no,unsigned char dir,unsigned char *lstring)
#endif
U can also download all sourcodaand alsoemulationfile fromhere.
so keep exploring 8051.....
see of emulation
No comments:
Post a Comment