Hi,today we aredisplayCustom characters on 16x2 L.hr we are using tow good softwarekeilandproteussame as older postl interfasing.
Most of the alpha numeric L like 16x2 char or 16x4 char has ability toerate few custom characters. In this example i will show you how to make and display these custom characters on a 16x2 char led.
thebasic technology of l based on 3 type of memory
CG ROM: this the memory which holds the permanent fonts you call to be displayed . thisholdsthe pattern foreverysingle character of predefined l font. and you call the content of this memory by the placingcorresponding ascii value on the l port . like for retrieval of 'A' you have to send the ascii value of 'A' which is 0x41 to the l. CGROM can also be seen as computer hard drive from where you load your required program into ram to start working. but it is not modify able because it's rom.
DD RAM :DDRAM is the memory which holds only those characters which are currently on the screen . mns if there is a message is currently being displayed on thescreen then it has to beon the DDRAM for example if you want to display "hello" on the screen thenyou have load pattern of h from the CG ROM TO DD RAM then do the same for 'e' ,'l' ,'l' and 'o'.
the address of cg ram is totally depends on the size of the l like for
20 x 1 L Row1 0x80 0x81 0x82 0x83 through 0x93
20 x 4 L Row1 0x80 0x81 0x82 0x83 through 0x93
40 x 2 L Row1 0x80 0x81 0x82 0x83 through 0xA7
CG RAM :this memory works same as CG ROM but as this is ram we can modify it's content any time . so this is the place where whe have to first store our custom character pattern. then that pattern can be sent to display. the HD44780 has total 8 CG RAM memory loion . so we canerateonly up to 8 custom characters . but you can always change the content of CG RAM on the fly toeratenew characters. the addresses of 8 CG RAM loion goes from 0x00 to 0x07.WHEN Ever we want something of these fonts to be displayed on the screen we write them to the DD RAM.
HOW TO DECIDE AND WRITE CUSTOM FONT TO CG RAM ?
A standard 5x8 dots font is being shown in the as you can see there are total 8 bytes of data on the whole to decide pattern of the font. As you can see all you need to do is decide the first row pattern like in the example in first row the first pixel is off so lsb bit 0 is 0 and pixel 1 is on so bit1 is 1 and pixel 2 is on so bit 2 is 1 this method apply on ch row of the font ( 8 rows ). which gives us total 8 bytes of data first msb 3 bits are always 0. you can also use BASCOM AVR to decide this pattern and .
L.h
#ifndef _leddatas_H
#include <reg51.h>
sbit l_en = P3^3;
void l_delay(unsigned char ms)
void l_enable()
void l_command(unsigned char command)
void linit()
void l_datac(unsigned char ascii)
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
L.c
#include <reg51.h>
unsigned char data1[]={28,2,2,28,8,4,3,32};
void main( )
U can also download all sourcodaand alsoemulationfile fromhere.
so keep exploring 8051.....
see of emulation
No comments:
Post a Comment