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.

[SOLVED] Interrupt on change PORTB; RB4,RB5,RB6,RB7 using mikroC PRO

Status
Not open for further replies.

bobx

Junior Member level 3
Junior Member level 3
Joined
Jan 11, 2010
Messages
29
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,283
Location
TEHRAN
Activity points
1,531
Hi! everybody.I want to write a program with mikroC PRO V2.5 so that I can use
the interrupt on change PORTB; RB4,RB5,RB6,RB7 features.I use 4 push buttons
on pins; RB4(K4),RB5(K5),RB6(K6),RB7(K7) and 4 LEDs' on pins;(respectively) RC4(LED1),RC5(LED2),RC6(LED3),RC7(LED4);I want if each key pressed(K4 to k7)
the corresponding pins(LED) on POTRC is ON.
Everybody can write that program,please?

Thanks,
 

You forget to mention the micro you are using

MicroCon
 

Re: Interrupt on change PORTB; RB4,RB5,RB6,RB7 using mikroC

Hi!I apologize.I use PIC18F452.

Thanks,Bob
 

Re: Interrupt on change PORTB; RB4,RB5,RB6,RB7 using mikroC

hi bob

why don't you try to do that?
if someone write the code, how u will learn?
try it and come to us if there's any problem
we are happy to help

regards

ml
 
  • Like
Reactions: bobx

    bobx

    Points: 2
    Helpful Answer Positive Rating
Re: Interrupt on change PORTB; RB4,RB5,RB6,RB7 using mikroC

Hello.Refering to my previous e-mail,finally I convert the assembly language example firmware,
that is;(EXAMPLE 4/ page 4 of AN566 application note;[Using the PORTB Interrupt on Change as an External Interrupt] ) into C language and I attached it and AN566 pdf
with this mail.But would you please anybody answer to the following questions my helping to correct
program if required?

1.To XOR the last portB value with the new portB value and detect mismatch and which pin
caused interrupt ,I read the last portB value in the main ;before interrupt occurs,with this
instruction;

[ kpi=PORTB;//reading the initial or previous(old)state or value of PORTB.]

and read the current portB value in the interrupt after it occurs as so;

[ kpc=PORTB;//reading the current PORTB state or value]

are above instructions are valid?

2.At AN566 application note,says should force microcontroller to interrupt at rising edge,
but I do not find a special register to set the PORTB INTERRUPT ON CHANGE[RB4,RB5,RB6,RB7] for rising edge.Would you please tell how I do that?



3.I attached my short and simple program,would you please tell me if it is correct or not?
(Iused mikroC PRO V2.50 COMPILER for PIC18F452 ).

Thanks,
 
Re: Interrupt on change PORTB; RB4,RB5,RB6,RB7 using mikroC

Hi,mustafas84.No I still have the problem.I would be thank if you solve it.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top