bobx
Junior Member level 3
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,
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,