Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Keypad for pic16f84

Status
Not open for further replies.

elnaz

New Member
Hello

I am searching for a keypad code witch gets a password and if it is correct switches pic16f84's pin to lcd (I have used all of my RB0 - RB7 pins for lcd and my main circuit) and does my remaining program.

maybe some kind of multiplexing be useful, I don't know how???

could you please guide me?

I just have RA3 and RB6b left in my circuit.

Thanks
 
elnaz said:
Hello

I am searching for a keypad code witch gets a password and if it is correct switches pic16f84's pin to lcd (I have used all of my RB0 - RB7 pins for lcd and my main circuit) and does my remaining program.

maybe some kind of multiplexing be useful, I don't know how???

could you please guide me?

I just have RA3 and RB6b left in my circuit.

I would suggest moving to a more modern PIC, rather than the obselete 84, the 16F628 is the modern replacement for it, and gives 16 I/O pins.

One of my tutorials shows how to make a keypad password system with an LCD, although it doesn't leave many pins free. In any case, having a look at it will probably be useful for you.

You could always use a second PIC as a keypad controller, and link to the first PIC via a single pin serial link - that would allow you to keep your existing hardware.
 
Ok, thanks.

Can I use the second pic16f84 as keypad controller with 4*3 keypad being able to input 3or more digits password?

If not I am going to use pic16f876 and my question will be that: how can I switch between 876 and 84 (my main circuit)?
 
elnaz said:
Ok, thanks.

Can I use the second pic16f84 as keypad controller with 4*3 keypad being able to input 3or more digits password?

Yes, of course you can. Because you want to display the key pressed on the LCD, you will need to send each keypress to the display PIC.

If not I am going to use pic16f876 and my question will be that: how can I switch between 876 and 84 (my main circuit)?

Using a single 876 would make it even easier, and give you plenty of I/O without any messing about. They both use the same 14 bit core, so run the same code - you only need to make a few very minor changes, due to the differing hardware.
 
elnaz said:
If not I am going to use pic16f876 and my question will be that: how can I switch between 876 and 84 (my main circuit)?
You do know that the 876 is a28-pin device while the 84 is only an 18-pin device right? Other than that, just do a one-to-one mapping of the pinouts from the 84 to the 876, for the following pins.
OSC1/OSC2
Vdd/Vss
Vpp/PGC/PGD (If you use ICSP).
The pinouts are all shown on their respective datasheets.
 
I think I have failed to pose my question properly so I am going to explain it again:
I have a circuit (ultra sonic distance meter, as you know) :oops:

witch has left me just RA3 ,RB6 remaining pins.and I want to connect a keypad that asks a password and if it is true it goes to execute the same measuring program.
So I should some how share the same pins witch I have already connected to LCD with keypad or to use another pic16f84 or 876 as keypad controller (as you guided me).
and my question is it possible to use second pic16f84 as 4*3 keypad controller witch checks the 3 or 4 digit password and if it's true sets on pin high that goes to first pic's RA3?

If yes I should add a check line on the begining of my main program to check if Ra3 is high then do the remaining, and I am going to need 4*3 keypad checking password code for pic16f84.
 
If you have enough code-space you could use the same PIC.

You will only need to use 1 74LS244 and four resistors.

I asume you are driving the LCD in 8-bit mode with all of the data lines connected to the same port and you probably have your LCD control lines on another port.

Using the circuit below, IC2 is a 74LS244

Edit: Schematic Removed by the Author. Responding in this thread is not worth the effort

Pins 17, 15, 13 and 11 of IC2, connect to RB0, RB1, RB2 and RB3
Pins 18, 16, 14 and 12 of IC2, connect to RB4, RB5, RB6 and RB7
Pins 1 and 19 of IC2, connect to the pin you are driving the LCD Enable line with

When you are not driving the LCD, you can scan the keypad.
 
The attached source file will drive the keypad for you.
Edit: Removed by Author - Responding to this thread is not worth the effort.

This source code was written using the Parallax // Tech-Tools compiler.
You will need to slap it into shape to work with MPASM.
The framework is right as the code was cut from a working project.

I forgot one thing. In the source, you will need to ensure that the LCD Enable line is high so that the 244 is active.
 
I've just had a quick look at your other thread.
Sorry, I didn't notice it earlier.

What I suggest you do is.

1 ) Drop the Send and Mask keys.
- You can use two keys on the keypad for their function.
This then frees up RA2 and RA4

2 ) Move the two lines from RB4 and RB5 to RA2 and RA3

3 ) Move the line from RB7 to RA4

This has freed up the entire RB port.

You can now drive the LCD in 8-bit mode which will be quicker and use less code space. Plus you get a 4x4 keypad for free :)

The code changes would be minimal. I think you will find that after implementing the keyscan routines and removing the redundant code from the current source, you will have more code-space free.
 
Thank you so much for your attention

But I've already built my range meter circuit (without key pad), so I prefer to just add a second pic16f84 as keypad controller with a checking password code then I'll can still have my built circuit with a small part added to it.
If I have not built it the reasonable soloution was your answer.
Anyway, I am still needing a checking password code for pic16f84 and mpasm assembler.
 
Fair enough although I don't think you have thought this through properly.

Your LCD is being used by the distance measuring PIC, so ...

1 ) How are you going to prompt the user to enter a Password ?
2 ) How are you going to echo something in the LCD for each keypress ?
3 ) How are you going to get the data between the two PICs you propose to use ?

If you are building this by hand, the changes I suggested would take only a little while to implement and could be done with a few simple cuts and jumpers.

I have just given you the schematic and source code for a keypad which you could use in the second PIC.
Yet, you are still asking for the source code to a password checker :roll:

I may be wrong here, but I am starting to think that what you really want is for someone else to design and code this for you so that you can just build it.
I wouldn't be expecting to get to many more replies in this thread.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top