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

About the problem of Keypad

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



Joined: 26 Sep 2005
Posts: 10

View user's profile Send private message

About the problem of Keypad
PostPosted: Wed Mar 01, 2006 11:23 am     Reply with quote

I am using PIC16f877 in my project i have attached a 4x3 keypad in my proj. to port B . I am scanning each row by keeping a coloumn high for 10msec. When i power on the circuit it starts taking the values on its own . Pin 33,34,35 are attached to coloumns and rest are attached to rows(pin 40 is not used ). I have used the SET_TRIS_B register and declared the Pin 33,34,35 as output pins and rest as input pins. Simulation is running fine absolutely no problem but it fails in the actual hardware.

What is to be done . Please can you suggest me something . Its really very important for me . Please Reply.
C Turner



Joined: 10 Nov 2003
Posts: 40
Location: Utah

View user's profile Send private message

About the problem of Keypad
PostPosted: Wed Mar 01, 2006 12:00 pm     Reply with quote

Without at least a snippet of example code, it's hard to tell exactly what is going on.

At first glance, I note that you don't mention pullup/down resistors anywhere.

Were I to do this, I might use the PIC's own Port-B pullup resistors on the row inputs and scanning the columns by pulling low (and going to input mode for the inactive column) - not forgetting to do the necessary debouncing as well.

You mention that you are keeping the column high for 10 msec - and that implies that you *must* have pulldown resistors on the rows: If not, then it's unlikely that anything will work! (This may just be one of those cases where simulations fail to track real-world situations at all...)

CT
bhaven



Joined: 26 Sep 2005
Posts: 10

View user's profile Send private message

Re: About the problem of Keypad
PostPosted: Wed Mar 01, 2006 11:59 pm     Reply with quote

C Turner wrote:
Without at least a snippet of example code, it's hard to tell exactly what is going on.

At first glance, I note that you don't mention pullup/down resistors anywhere.

Were I to do this, I might use the PIC's own Port-B pullup resistors on the row inputs and scanning the columns by pulling low (and going to input mode for the inactive column) - not forgetting to do the necessary debouncing as well.

You mention that you are keeping the column high for 10 msec - and that implies that you *must* have pulldown resistors on the rows: If not, then it's unlikely that anything will work! (This may just be one of those cases where simulations fail to track real-world situations at all...)

CT



i have used the pull resistors externally. The delay of 10 msec mentioned is for the debouncing effect. How can i enable/disable the internal resistors of the port B of PIC16F877. Please can you suggest something. Please Reply.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 02, 2006 12:50 am     Reply with quote

Do you have the CCS compiler ? If so, you should have the KBD.C
driver and the EX_LCDKB.C example file.

Look in these folders:
c:\Program Files\Picc\Drivers
c:\Program Files\Picc\Examples


If you don't have the CCS compiler, or have the demo, then look here:

This page has the schematic:
http://www.blitzlogic.com/lcd.htm

This page has the CCS source code:
http://www.blitzlogic.com/kbd_C.htm

If you look closely at the kbd driver file in the link above, you will
see this function:

kbd_init()

It contains the code to enable pull-ups on Port B.
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