here is my code:


===============================================
Define LOADER_USED 1

' Define LCD connections
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1


' Define program variables
col Var Byte ' Keypad column
row Var Byte ' Keypad row
key Var Byte ' Key value
fre Var byte ' half pulse time
LED0 var PORTD.0 ' Alias PORTD.0 to LED

OPTION_REG = $7f ' Enable PORTB pullups
'OPTION_REG.7 = 0 ' Enable PORTB pullups

ADCON1 = 7 ' Make PORTA and PORTE digital
Low PORTE.2 ' LCD R/W low (write)

Pause 100 ' Wait for LCD to start

Lcdout $fe, 1, "Choose Your Frequency" ' Display sign on message

'On Interrupt Goto myint ' Define interrupt handler
'INTCON = %10010000 ' Enable INTE interrupt

loop1: Gosub getkey ' Get a key from the keypad

'On Interrupt Goto myint ' Define interrupt handler
'INTCON = 144 ' Enable INTE interrupt

loop3: if key = 1 then
Lcdout $fe, 1, "1 Hz"
fre = 500
gosub loop2
endif

loop4: if key = 2 then
Lcdout $fe, 1, "10 Hz"
fre = 50
gosub loop2
endif

loop5: if key = 3 then
Lcdout $fe, 1, "50 Hz"
fre = 80
gosub loop2
endif

loop6: if key = 4 then
Lcdout $fe, 1, "100 Hz"
fre = 40
gosub loop2
endif

'disable interrupt

loop2: High LED0 ' Turn on LED connected to PORTD.0
Pause fre ' Delay for "fre" seconds

lOW LED0
Pause fre ' Delay for "fre" seconds

'gosub getkey
'goto loop1


'if key = 1 then
'goto loop3
'endif

'if key = 2 then
'goto loop4
'endif

'if key = 3 then
'goto loop5
'endif

'if key = 4 then
'goto loop6
'endif

;Disable interrupt ' No interrupts past this point
'myint: 'gosub getkey
'goto loop1
'INTCON.1 = 0 ' Clear interrupt flag
'Resume ' Return to main program
'Enable interrupt

goto loop2

'goto loop1

'enable interrupt

Return ' Go back to loop and blink LED forever


' Subroutine to get a key from keypad
getkey:
Pause 500 ' Debounce

getkeyu:
' Wait for all keys up
PORTB = 0 ' All output pins low
TRISB = $f0 ' Bottom 4 pins out, top 4 pins in
If ((PORTB >> 4) != $f) Then getkeyu ' If any keys down, loop

Pause 50 ' Debounce

getkeyp:
' Wait for keypress
For col = 0 To 3 ' 4 columns in keypad
PORTB = 0 ' All output pins low
TRISB = (dcd col) ^ $ff ' Set one column pin to output
row = PORTB >> 4 ' Read row
If row != $f Then gotkey ' If any keydown, exit
Next col

Goto getkeyp ' No keys down, go look again

gotkey: ' Change row and column to key number 1 - 16

key = (col * 4) + (ncd (row ^ $f))
Return ' Subroutine over

End
=================================================


1) the problem is that by using this code, generated pulses cud not change using the interrupt code.. which i cudnt fix!!!! this is where i need help...
{at the begining, i need the code to check for the pressed keypad and loop as the corresponding frequency... then the code should check for any interruption from the user if he/she pressed any key.. if he pressed any other key, the frequency should change accordingly,,, if not it should cont looping to generate the previous frequency}


2) another thing is that i need ur help in understanding the concept of working of the keypad connection diagram (when we press the keypad, does it give 1 or 0)