CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Keypad 4x3 and 16F877

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest02
Guest







Keypad 4x3 and 16F877
PostPosted: Mon Mar 30, 2009 12:27 pm     Reply with quote

I made one 4x3 keypad with standard switches like on PICDEM 2 board.
Hardware is made something like this

http://www.elektrotekno.com/userpix/6181_1_2.jpg

and i put 4x 10K resistors to row0,1,2,3.

If i use this code, when i press number 7,8,9 different LED on picdem lights up but there is no message on LCD. I don't know what's wrong.
The LED - B3 wont light up regardless what i click.
Because i don't get visual reply from picdem i don't know what is with other switches. Are they working or not?

Code:
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
 
#include "trans_LCD.c"
#include "trans_KEY.c"

void main() {
   char k;

   lcd_init();
   kbd_init();

   lcd_putc("\fReady...\n");

   while (TRUE) {
      k=kbd_getc();
      if(k!=0)
        if(k=='*')
          lcd_putc('\f');
        else
          lcd_putc(k);
   }
}
Guest02
Guest







PostPosted: Mon Mar 30, 2009 12:28 pm     Reply with quote

I use whole B port for this ... except B7
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 30, 2009 12:44 pm     Reply with quote

Quote:
#include "trans_LCD.c"
#include "trans_KEY.c"

Post where you got these drivers from.

Quote:
and i put 4x 10K resistors to row0,1,2,3.

The pull-up connections should look like this:
Code:

                +5 volts
                  |
                  |
                 | |  10K
                 | |  resistor
                 |_|
                  |
 To PIC pin ------o------ To Keypad row pin


Post a list of the connections between the PIC pins and the keypad
and the LCD.
Guest02
Guest







PostPosted: Wed Apr 01, 2009 11:48 pm     Reply with quote

Hello,
drivers are from this forum.
Slightly modified LCDD.c & KBD.c

This is the schematics:
http://tinypic.com/view.php?pic=14voboh&s=5
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 02, 2009 12:22 am     Reply with quote

Your schematic shows the resistors are connected to ground.
That's wrong. Those are "pull-down" resistors. I told you to
use Pull-Up resistors. My schematic shows a connection
to +5 volts. Change your circuit to connect the resistors to +5v.
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Thu Apr 02, 2009 6:48 am     Reply with quote

If you're using Port B, why fool around with resistors at all? Use the internal pullups, that's what Microchip put them there for.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group