Keypad Program For Pic16f84a

admin
  1. Sample Program For Pic 16f84a
  2. Keypad Program For 8051
Active8 months ago

I am currently writing an assembly code that will count down aBCD counter (through the 7-segment display). When a key is pressed, the counter will be overridden by the key pad value then the count down continues. For example if the current counter value is ‘8’ then overridden by pressing key 5, the counter sets to ‘5’ then counts down. The counter counts down perpetually and will be overridden anytime a key is pressed on the keypad.

  • Sep 21, 2009  I am not sure if it is the LCD problem or Keypad. The program works okay IF I use: Print AT 1,1,'6' or something like that along the lines, anyway the point is, without 'at 1,1.' It would show rubbish for the first box then only ur result. PIC16F84A with LCD JHD162A and Keypad 4X3(sort of) Okay thanks for the guidelines but before that.
  • Interface keypad with PIC16F84a / PIC16F88 Reply to Thread. Discussion in 'Embedded Systems and Microcontrollers' started by Pinnacle187, Jun 1, 2016. PIC16F84A with Matrix Keypad. Posted by JoeSmith23 in forum: Embedded Systems and Microcontrollers. Replies: 1 Views: 258.

Here is my circuit

And here is the code i've currently written:

The secret code is currently stored within the program source code, as the 16F628 and 16F876 have internal EEPROM the code could be stored there and be changeable from the keypad. Tutorial 9.3. Tutorial 9.3 reads the keypad and sends the ASCII code via RS232 at 9600 baud, you can use HyperTerminal on a PC to display the data. If we had pushed the 0 key on the keypad, then we would have copied ’00’ into the what_button variable. This number ’00’ is then added to the program counter (which in effect does not change the program counter) so the program just goes to the very next line, which is a retlw statement containing the byte of data the represents a.

So naturally the bcd counts down, and when a button is pressed the interrupt occurs, reads the input in RB4 - RB7 finds the data in the address given in KEY_VAL and loads it to PORTA

Additional Info: • Released Date: April 11, 1983 • Tracklist: 01. Irene Cara – Flashdance What A Feeling – 03:54 02. Flashdance songs from the movie.

However, my problem is, When i press a button in the keypad and the interrupt is started. When i read, pin RB4-RB7 to get the address given by the IC. All i get is all high so i always get 15 (address for D).

If i dont press a button, pin A B C D of MM74c922 is naturally high and when a button is pressed in the keypad, pin 12 of the ic turns high and the address is sent to rb4-7. The problem is i think the pic controller cannot read the shift in rb4-7 and so it always reads the data before the interrupt which is always high so i cant get the address i want.

I tried setting the interrupt to toggle during falling edge but the same thing occurs im out of ideas and i need help

Keypad

if it helps this is the address for the buttons

Mike
2,5704 gold badges11 silver badges25 bronze badges
JezTJezT

3 Answers

Your Interruptroutine looks a little bit crazy. Try someting like:

Please have a look for more details in the datasheet, there are some examples

MikeMike
2,5704 gold badges11 silver badges25 bronze badges

Returning from a interrupt with GOTO isnt wise man. When u get in the interrupt it send the location where it was to stack and when u return with goto PC doesnt use that lvl of stack and direcly jump to GOTO marked Label.

Can u try

RETFIE

instead of

let me know if there is any change

uğur özdemiruğur özdemir

So apparently I found the answer and it was very simple, I edited option reg in bank 0 making the interrupt start at the falling edge useless.

The fix was

Sample Program For Pic 16f84a

now the code works, thank you all for helping me

Keypad Program For 8051

JezTJezT

Not the answer you're looking for? Browse other questions tagged assemblyinterruptpickeypad or ask your own question.