Date: Sat, 20 Mar 1999 11:35:10 -0500
From: Thomas McGahee <tom_mcgahee@SIGMAIS.COM>
Subject: Should I Post KEYPAD Program?
To: PICLIST@MITVMA.MIT.EDU

Dear PICsters,

I have just finished a little PIC project, and I want to know whether
or not it would be appropriate to send the full listing which is about
40K to the PIC List.

I do not currently have a web site that I can post the information on,
otherwise I would simply do so and post the URL.

The code is heavily commented, so it might be useful for beginners and
others to look at to see an example of a complete project. The
assembly code comments include info on the actual hardware (very
simple) and PIC pinouts used.

I also have the printed circuit board layout and schematics and parts
placement diagrams all in one AutoCad DWG file, for those who have
access to AutoCad. I could convert this to DXF format if that would
allow more people to use it.

Here is a description of the circuit and software:

The hardware consists of a PIC 16C84 or PIC 16F84, a 16 key xy matrix
keypad, a 4.00 Mhz resonator with built-in caps, a red and a green
LED, 2 330 ohm resistors, 1 4.7K resistor, 1 10K resistor, a printed
circuit board, 10 pin header, one general purpose NPN transistor such
as MPSA05, and one 5 V PCB DPDT Relay.

The PCB design also has a general purpose 5 volt regulator circuit on
it to allow operation from a 12VAC wall-wart type transformer. This
part of the circuit uses 4 1N4001 (or greater) diodes, a 220 ufd cap,
a 10 ufd cap, and a 5 volt regulator such as a 7805.

The keypad used is made by Grayhill and has an 8 pin connector on the
back. I believe that Jameco has the same keypad that I am using, but
with a 9 pin connector (unless their catalog is in error and it is
really an 8 pin connector). The keypad has 0-9 and also LOAD CLR ENT
RUN and UP and DOWN arrows.

The user gets the unit's attention and synchronizes the program by
hitting the CLR key. The CLR (CLeaR) key is handled special, and ANY
time the CLR key is hit, it will cause the program to synchronize and
begin regular entry. To indicate that a key is being pressed, the
normally-on RED LED will go off for the duration of any keypress. When
the CLR key is released the GREEN LED will flash once to indicate that
the program is synchronized and ready for regular input.

The user can now enter any one of eight valid entry code sets. Each
entry code may consist of from 1 to 8 digits, though the factory
Mastercode will always be an 8 digit code. The user may use the digits
0-9 and the LOAD, UP and DOWN keys as part of the entry code. The CLR
ENT and RUN keys may *not* be used as part of the entry code, as they
have a special meaning.

After entering the user-code, the user will normally press the ENT
(ENTer) key. If the code entered was a valid code, then the red and
green LEDs will flash back and forth for ten seconds. During this time
the relay will be energized, and it's contacts may be used to activate
a doorlock mechanism, for example. During the 10 seconds, the user may
press and hold any key to extend the on-time of the relay. As soon as
any key is *released*, the on-time of the relay will be immediately
terminated. Thus the on-time can be made longer or shorter as desired.

There are two special codes known as the Factory Mastercode and the
User Mastercode. The Factory Mastercode is hard-coded into the chip
and cannot be changed. The User Mastercode can be changed by the user.

Whenever the user enters either of the Mastercodes, he/she may then
hit the ENT key to activate the relay, OR they can hit the RUN key to
enter the special MASTERCODE MODE. In Mastercode Mode the user can
change or delete any one of 6 user-codes, and change or delete the
User Mastercode.

After entering either Mastercode and the RUN key, then the user should
enter a single digit from 0-6, followed by LOAD and then the 1 to 8
digit code desired, and finally the ENT key to terminate this mode.

If LOAD is followed immediately by ENT, then the desired code set will
be deleted instead of entered.

The load sets are 0-6. 1-6 represent regular user code sets. You might
assign a different code set to each member of your family. (People
like Andy Kunz will have to re-write the code to allow packed nibbles
instead of the byte method I used. That would allow 14 user-codes and
two mastercodes).

Load set 0 is special. This will actually load in the User Mastercode.
I strongly recommend using an 8 digit code for the Mastercode, but I
wrote the program so that it allows any code from 1-8 digits in
length.

*****
No attempt was made to make the code super-efficient. It occupies just
a little less than 1/2 K of ROM space. So there is lots of room for
others to add additional bells and whistles. There are two i/o ports
left unused in the original design.

There you have it, a short description of the KEYPAD PROJECT.

So, should I post the 40K MPASM file to the PIC List, or would that be
upsetting to many? If I post it, should the code be in the main body
of an e-mail, or should I make it an attachment?

I will wait until there are enough responses to arrive at some
consensus.

Hope this helps.

Fr. Tom McGahee

-----------------------------------------------------------------------------

Date: Sun, 21 Mar 1999 11:46:19 -0500
From: Thomas McGahee <tom_mcgahee@SIGMAIS.COM>
Subject: URL for Keypad Project Files
To: PICLIST@MITVMA.MIT.EDU

Dear PICsters,

Andy Stephenson has graciously offered to place the files for the
Keypad Project on his web site:

http://www.asamicros.com/Pub/ProjectSource/kpaddxf.zip
http://www.asamicros.com/Pub/ProjectSource/kpaddwg.zip
http://www.asamicros.com/Pub/ProjectSource/kpadasm.zip

Anyone else who is interested in these files is welcome to copy them
from this site either for their own personal use, or to place them on
their own website. I think that it is always useful to have an
assortment of working projects available for others to look at for
ideas.

Fr. Tom McGahee

