Electronics > Microcontrollers

microcontroller Pin Interrupt circuit

(1/4) > >>

yalect:
Hi,
I would like to ask you that I want to write code in C language using the microcontroller PIC16F84, when I applicate a voltage on RA4/T0CKI of PORTA an interrupt hapens making the program switchs or jumps to second sub function or loop void interrupt() doing some instructions and back after it has finished or done to the main program void main() that means switching or moving between two functions by interrupt.
is it possible?.

    thank you.

Doctorandus_P:
Usually there are a lot of ways in which ISR's can be triggered by software, but they tend to have various side effects. With your method, you loos an I/O pin, and when it's shorted it does not work at all. Another method is to pre-load a timer and let it overflow after command.

DavidAlfa:
In that PIC only RB7:RB4 pins have interrupt on change.
Which compiler? XC8?

yalect:
thank you for your replies.
you mean we can't use interrupts on PORTA with PIC16F84? to switch or move to sub function or routine for example interrupt () by interrupt, maybe with TMR0 timer and How?.

woofy:
First, unless yo have a good reason to use this ancient device, you should choose something newer with more features for less money.

If you do have to use it then yes, you can use the timer to generate the interrupt from a  change on RA4. You should set T0CS to 1 to select external clk, PSA to 0 to bypass the prescaler and TMR0 to 0xFF. Now a clk input will cause the timer to rollover to 0x00 and set T0IF. Remember to set TMR0 back to 0xFF in your interrupt routine.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod