PIC16F877A interface 4x4keypad 2x16LCD

Thread Starter

BlissEva

Joined Jun 28, 2015
20
Hello BlissEva
.
Looking at the code that you enclose in your post #1 reads as follows:
#define R1 RC0 // Row1 Port C BIT 0
#define R2 RC1 // Row2 Port C BIT 1
#define R3 RC2 // Row3 Port C BIT 2
#define R4 RC3 // Row4 Port C BIT 3
#define C1 RC4 // Column1 Port C BIT 4
#define C2 RC5 // Column2 Port C BIT 5
#define C3 RC6 // Column3 Port C BIT 6
#define C4 RC7 // Column4 Port C BIT 7
.
In Function Main says:
TRISC = 0xF0; // KeyPad. So, BITs 0, 1, 2 And 3 Are Outputs. BITs 4, 5, 6 And 7 Are Inputs.
.
Subsequently, through the rows, you shift a low level(0) and verify which column is low (0) to make a decision.
Now analyze the circuit is in the PDF document attached to you.
Your design should be working . . . Or not ??

thankyou very very much. this helped me a lot. my circuit is functioning now.
btw you know how to make them display in 2digit?
 

MrCarlos

Joined Jan 2, 2010
400
Hello BlissEva
.
What do you mean: you know how to make them display in 2digit?
Maybe that pressing the second key on the keypad displayed on the LCD 2 numbers.
But. . . then what to do ??
.
What is the whole idea ??
.
 

ErnieM

Joined Apr 24, 2011
8,377
Thankyou so much! my circuit finally is now working.
btw do you all have any idea for displaying two digit number??
Congratulations on getting the hardware to work, that is an important stating point.

Now the next steps will take you into some deeper programming concepts. Let me get a nights sleep (I really am tired after puttering 'round the house today) and I'll try to point you in the right direction.

There are probably more (correct) ways to do this than there are programmers who have done it.
 

Thread Starter

BlissEva

Joined Jun 28, 2015
20
hahaha! thanks a lot lot everyone.
i meet one more problem now. my new pcb is done with the pull up resistors. but now, my lcd cant light up. can you guys help me to see whats wrong with my circuit?
 

Attachments

Thread Starter

BlissEva

Joined Jun 28, 2015
20
Hello BlissEva
.
What do you mean: you know how to make them display in 2digit?
Maybe that pressing the second key on the keypad displayed on the LCD 2 numbers.
But. . . then what to do ??
.
What is the whole idea ??
.
now my lcd can only show one digit number when i press it. how to make it to two digit like using some kind of array? or buffer?
 

Art

Joined Sep 10, 2007
806
now my lcd can only show one digit number when i press it. how to make it to two digit like using some kind of array? or buffer?
depends what you're doing with the input.
Typically, you might read a character into an array,
Then either rotate that array,
Or increment an index for the current array element,
And display the result on the LCD.
Somewhere in there,
You'l have to muliply by (array index * 10) for each digit to provide the significance of each digit.
 

ErnieM

Joined Apr 24, 2011
8,377
Here is one idea to get two digits:

You first need a place to store these two strings (called a "buffer "). This defines the string and loads it with two spaces:
Code:
            char Buffer[] = "  ";  // two blank spaces
Now instead of your simple one character routine:
Code:
            key_get = keypad_wait();
            WriteChar(key_get);
You instead get a character and put it into your buffer, but first shift the old character aside. Then point back at the beginning of the print area, and print the new two character string:
Code:
            key_get = keypad_wait();  // get a new character
            Buffer[0] = Buffer[1]     // shift the old character
            Buffer[1] = key_get       // inser the new character
            SetCursor(2,0);           // point to starting place on screen
            WriteString(Buffer);      // print our two character string
 
Top