Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interrupt Help needed in MikroC 8051

Status
Not open for further replies.

rpy_srijon2008

Newbie level 6
Joined
Jul 3, 2009
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
delhi
Activity points
1,358
Interrupt Help.

I have made a simple Program with 7 segment LCD and 3x4 keypad with a
Interrupt function in MikroC 8051 Pro as below: -

//=========================================
unsigned short kp;


// Keypad module connections
sfr char keypadPort at P2;
// End Keypad module connections
void Interrupt0ex0(void) org 0x0003 ilevel 0 {
kp=248;
P0=kp;
}



void main() {

Keypad_Init(); // Initialize Keypad
EA=1; //Enable Universal Interrupt
EX0=1; //Enable External Interrupt0
IE0=1;


do {
kp = 0; // Reset key code variable

// Wait for key to be pressed and released
do
kp = Keypad_Key_Click(); // Store key code in kp variable
while (!kp);

// Prepare value for output, transform key to it's ASCII value
switch (kp) {

case 1: kp = 249; break; // 1 // Uncomment this block for keypad4x4
case 2: kp = 164; break; // 2
case 3: kp = 176; break; // 3
case 4: kp = 136; break; // A
case 5: kp = 153; break; // 4
case 6: kp = 146; break; // 5
case 7: kp = 130; break; // 6
case 8: kp = 131; break; // B
case 9: kp = 248; break; // 7
case 10: kp = 128; break; // 8
case 11: kp = 144; break; // 9
case 12: kp = 198; break; // C
case 14: kp = 192; break; // 0


}

P0=kp;


} while (1);
}

I have tried it in Labcenter Proteus and found the following Result.
Whenever I start Debugging[Playing] it the Display is 7 [As for Interrupt].
But My question is why this happens? I haven't made any Interrupt Signal yet.
What is the way to Stop this?

Thanks.
 

Re: Interrupt Help.

hi
have u interfaced keypad throughh 74c922 controller and can u give me the code u prepared for this "keypad interfacing and interrrupts "
actually my concepts are weak in interrupts so sorry i may not be able to help u...
and m trying to interface a 3x5 keypad with 89s52 in ma new project and facing a lot of problem in it..
if u can send me ur code may be i get some help from it...
thanks in advance...
 

Re: Interrupt Help.

digitalkim said:
hi
have u interfaced keypad throughh 74c922 controller and can u give me the code u prepared for this "keypad interfacing and interrrupts "
actually my concepts are weak in interrupts so sorry i may not be able to help u...
and m trying to interface a 3x5 keypad with 89s52 in ma new project and facing a lot of problem in it..
if u can send me ur code may be i get some help from it...
thanks in advance...


I am using MikroC Pro 8051 which provides vast library facilities for Interfacing many Devices. It can be Available from the following link: -

https://www.mikroe.com/en/compilers/mikroc/8051/

You can check that. There is no need to use 74C922 as per the manual and help file given.[/url]
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top