hi all, i was wondering if anybody could help me with some psudocode or just some logic.
I've just bought a pic16f876 and programming board. I haven't had any experiance with PIC programming, only c++ but before i start learning the pbasic i was hoping somone could tell me the best way to go about my problem....

i'll will be using 5 switches as inputs into the pic and 12 outputs acting as a virtual matrix.

With the 5 switches there's 32 different possible combinations of inputs, but i would only like the state of the switches to be read, or the value of the switches taken when one of the switches is realeased (the auto repeat will be turned off)

For instance, say i wanted to send rbo1 and rb2 high when ra1, ra2 and ra3 was high and 0 & 4 low. does anybody know how i might go about it?

this is one method i have found, there may be a way to scan in the value on each clock cycle, compaire it to the previous scan and if it is lower, somehow take the value of which switches had previously been pressed

any sugestions? i'd prefer to know how im going to go about doing this before reading my pic book.

"TIP #5 Scanning Many Keys With One Input (image below)

The time required to charge a capacitor depends
on resistance between VDD and capacitor. When a
button is pressed, VDD is supplied to a different
point in the resistor ladder. The resistance
between VDD and the capacitor is reduced, which
reduces the charge time of the capacitor. A timer
is used with a comparator or changing digital input
to measure the capacitor charge time. The charge
time is used to determine which button is pressed.
Software sequence:

1. Configure GP2 to output a low voltage to
discharge capacitor through I/O resistor.
2. Configure GP2 as one comparator input and
CVREF as the other.
3. Use a timer to measure when the comparator
trips. If the time measured is greater than the
maximum allowed time, then repeat; otherwise
determine which button is pressed."