Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

WStevens_sa

Member level 2
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.

// LCD module connections
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;
// End LCD module connections


char txt1[] = "MON 14:21 +55°c";
char txt2[] = "";
char txt3[] = "Lcd4bit"; //displayed first
char txt4[] = "example"; //displayef second

char i; // Loop variable

void Move_Delay() { // Function used for text moving
Delay_ms(500); // You can change the moving speed here
}

const char character[] = {14,17,14,14,14,17,14,0};
void CustomChar(char pos_row, char pos_char) {
char i;
Lcd_Cmd(74);
for (i = 0; i<=7; i++) Lcd_Chr_CP(character);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 1);
}

void main(){

ADCON1=6;

Lcd_Init(); // Initialize LCD

Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

//Lcd_Out(1,6,txt3); // Write text in first row
//Lcd_Out(2,6,txt4); // Write text in second row
//Delay_ms(2000);

Lcd_Cmd(_LCD_CLEAR); // Clear display



Lcd_Out(1,1,txt1); // Write text in first row Para1=Row1 Par2=column
//Lcd_Out(2,1,txt2); // Write text in second row
CustomChar(2,1);

Delay_ms(2000);







// Moving text
for(i=0; i<4; i++) { // Move text to the right 4 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}

while(1) { // Endless loop
for(i=0; i<8; i++) { // Move text to the left 7 times
Lcd_Cmd(_LCD_SHIFT_LEFT);
Move_Delay();
}

for(i=0; i<8; i++) { // Move text to the right 7 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}
}
}
 

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:

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

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top