[SOLVED] PIC 16F877 interface with LCD 2 x 16 Custom character not showing

Status
Not open for further replies.

WStevens_sa

Member level 2
Joined
Jan 5, 2011
Messages
47
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
South Africa
Activity points
1,695
Hi Guys

I have added a custom character to my program but it does not show. You will see I call it from "void CustomChar(char pos_row, char pos_char)" but it does not display on row2 column1.

 

Does anybody have an idea. I have googled almost the whole day and cannot find a solution. Every other standard character appears on the LCD with no Problem. I also noted that when I use the CustomChar() It does clear the position it just does not show the custom character. Suggestions or help will be appreciated.M
 
Last edited:


Hi WStevens_sa!
I am tried to develop custom character display program.
This is the program. It’s working.
Hi world!
Try to develop more…. Send to edaboard.



sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
const char characterD[]= {31,9,9,9,9,9,31,0};

void CustomCharD(char pos_row, char pos_char) {
char i;
Lcd_Cmd(64);
for (i = 0; i<=7; i++) Lcd_Chr_CP(characterD);
Lcd_Cmd(_LCD_RETURN_HOME);
//Lcd_Chr(pos_row, pos_char, 0);
Lcd_Chr(pos_row, pos_char, 0);
}
const char characterE[] = {31,16,16,31,16,16,31,0};

void CustomCharE(char pos_row, char pos_char) {
char i;
Lcd_Cmd(72);
for (i = 0; i<=7; i++) Lcd_Chr_CP(characterE);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 1);
}
const char characterN[] = {17,17,25,21,19,17,17,0};

void CustomCharN(char pos_row, char pos_char) {
char i;
Lcd_Cmd(80);
for (i = 0; i<=7; i++) Lcd_Chr_CP(characterN);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 2);
}
const char characterS[] = {31,16,16,31,1,1,31,0};

void CustomCharS(char pos_row, char pos_char) {
char i;
Lcd_Cmd( 88 );

for (i = 0; i<=7; i++) Lcd_Chr_CP(characterS);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 3);
}
const char characterH[] = {17,17,17,31,17,17,17,0};

void CustomCharH(char pos_row, char pos_char) {
char i;
Lcd_Cmd(96);
for (i = 0; i<=7; i++) Lcd_Chr_CP(characterH);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 4);
}
const char characterI[] = {4,4,4,4,4,4,4,0};

void CustomCharI(char pos_row, char pos_char) {
char i;
Lcd_Cmd(104);
for (i = 0; i<=7; i++) Lcd_Chr_CP(characterI);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 5);
}

const char characterL[] = {16,16,16,16,16,16,31,0};

void CustomCharL(char pos_row, char pos_char) {
char i;
Lcd_Cmd(112);
for (i = 0; i<=7; i++) Lcd_Chr_CP(characterL);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 6);
}
const char characterHart[] = {10,21,17,17,10,4,4,0};

void CustomCharHart(char pos_row, char pos_char) {
char i;
Lcd_Cmd(120);
for (i = 0; i<=7; i++) Lcd_Chr_CP(characterHart);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 7);
}
void main(){
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Cmd(_LCD_CLEAR);
CustomCharD(characterD,1);
CustomCharE(characterE,2);
CustomCharN(characterN,3);
CustomCharS(characterS,4);
CustomCharH(characterH,5);
CustomCharI(characterI,6);
CustomCharL(characterL,7);
CustomCharHart(characterHart,9);
CustomCharHart(characterHart,10);
CustomCharHart(characterHart,11);
CustomCharHart(characterHart,12);
CustomCharHart(characterHart,13);
CustomCharHart(characterHart,14);

}
 
Last edited:
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…