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 support@ccsinfo.com

4X3 Keypad

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



Joined: 02 Jun 2004
Posts: 16

View user's profile Send private message Send e-mail MSN Messenger

4X3 Keypad
PostPosted: Fri Jun 25, 2004 3:09 pm     Reply with quote

I need to connect a 4X3 keypad to a picdem2+ dev board. Hopefully ican do this without changing the ccs keypad driver does any one have a diagram of the circuitry required (if any) and to what pins i need to conect to. I have tried to figure it out from the CCS driver but i don't want to break anything. i believe that the keypad can share the same port as the LCD.

Any help is greatly appreciated as i am a beginer that has been making good progress up until now.

Thanks

Rolling Eyes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 28, 2004 4:00 pm     Reply with quote

Quote:
I need to connect a 4X3 keypad to a picdem2+ dev board.

The PicDem 2 Plus manual has a schematic in Appendix A.
http://ww1.microchip.com/downloads/en/DeviceDoc/51275b.pdf
It shows that pins B1-B7 are free. The CCS keypad driver can
be configured to use those pins.

To configure the CCS driver to use Port B, you need to define
a constant before you include the driver file. Do it as shown below.
Also, you must enable the pull-ups for Port B. Put the line to do
that at the start of main() as shown below.

#define use_portb_kbd TRUE // This line tells kbd.c to use Port B
#include <kbd.c>

main()
{
port_b_pullups(TRUE);

// Put other code here. (Code from EX_LCDKB.C)
}

Keep in mind that because the CCS keypad driver uses pins B6 and B7,
I don't think you'll be able to use the ICD2 to debug the program.
(Because the ICD2 uses those pins). But you can use ICD2 as
a programmer. Just program the PIC, and disconnect the ICD2
cable, and press reset (or cycle the power switch) to run the program.
zogbog



Joined: 02 Jun 2004
Posts: 16

View user's profile Send private message Send e-mail MSN Messenger

4X3 Keypad
PostPosted: Wed Jun 30, 2004 3:21 am     Reply with quote

Thanks for the help.

I take it that when i am using the keypad on port b i can not use the LED outputs at the same time????

thanks again

zogbog
omarsito12



Joined: 02 Oct 2009
Posts: 6

View user's profile Send private message

If I want to change to port F
PostPosted: Fri Oct 02, 2009 10:47 am     Reply with quote

PCM programmer wrote:
Quote:
I need to connect a 4X3 keypad to a picdem2+ dev board.

The PicDem 2 Plus manual has a schematic in Appendix A.
http://ww1.microchip.com/downloads/en/DeviceDoc/51275b.pdf
It shows that pins B1-B7 are free. The CCS keypad driver can
be configured to use those pins.

To configure the CCS driver to use Port B, you need to define
a constant before you include the driver file. Do it as shown below.
Also, you must enable the pull-ups for Port B. Put the line to do
that at the start of main() as shown below.

#define use_portb_kbd TRUE // This line tells kbd.c to use Port B
#include <kbd.c>

main()
{
port_b_pullups(TRUE);

// Put other code here. (Code from EX_LCDKB.C)
}

Keep in mind that because the CCS keypad driver uses pins B6 and B7,
I don't think you'll be able to use the ICD2 to debug the program.
(Because the ICD2 uses those pins). But you can use ICD2 as
a programmer. Just program the PIC, and disconnect the ICD2
cable, and press reset (or cycle the power switch) to run the program.


//////////////////////////////////////////////////////////////////////////////////

Hi...very good your answer...it helps me a lot with my project....even thanks to you a could try my keypad 4x3 and simulate it in isis proteus...but I need a last thing for you...I need to change the driver to use this keypad on the F port of my micro!!!so please help what a need to do to make this real...'cuz I tried a lot changing the driver and proof it in proteus and nothing happens!!!Thanks for your answer again!!!

omarsito12@gmail.com
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 02, 2009 1:00 pm     Reply with quote

To modify the CCS keypad driver, kbd.c, so it will work with Port F
(presumably on an 18F8722), do the following:

1. Make a copy of the kbd.c file, and name it kbd_portf.c, and edit the
new file as listed in steps 2, 3, and 4.

2. Edit the port address for Port D in kbd.c, so it's now the address for Port F (0xF85), as shown below:
Quote:

#if defined use_portb_kbd
#byte kbd = 0xF81
#else
#byte kbd = 0xF85 // Register address for Port F
#endif



3. Change the 'set_tris_d' statement to 'set_tris_f' in the kbd_portf.c file,
as shown below:
Quote:
#if defined use_portb_kbd
#define set_tris_kbd(x) set_tris_b(x)
#else
#define set_tris_kbd(x) set_tris_f(x)
#endif


4. Make sure that the line to enable use of port B is commented out.
It should look like this:
Quote:
// #define use_portb_kbd TRUE


5. Edit the #include statement in your program to use the new driver:
Code:
#include <kbd_portf.c>
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