PDA

View Full Version : PIC Interrupt and PORTA input



Jerade
- 19th November 2009, 18:18
Can I use interrupt function to control magnet sensor other than PORTB0?
And how to set PORTA to input function?I've tried but it seem cannot be done...
hope someone help me, Thanks =)

mackrackit
- 19th November 2009, 20:17
Not that I know of and this should explain "A".
What PIC are you using?

Jerade
- 20th November 2009, 12:23
Not that I know of and this should explain "A".
What PIC are you using?

I am using PIC 16F877A,
i am doing project to control RGB led on the fan to display image,
i use 12 unit of shift register to save the port of the PIC, i use PCB to do it and now just realize that my RB0/int PORT ald in use,
other than RB0 can i use other port to run interrupt function or something similar like interrupt function?

PORTA suppose is a Analog to digital function, i've turn it to digital but seems like cannot control as input function, i curious what is the problem, hope someone help me, Thanks =)

mackrackit
- 20th November 2009, 18:40
My first post was supposed to have this link
http://www.picbasic.co.uk/forum/showthread.php?t=561
I must be getting old....

Can you post your code? It will help us to solve the problem.

Jerade
- 29th November 2009, 14:55
My first post was supposed to have this link
http://www.picbasic.co.uk/forum/showthread.php?t=561
I must be getting old....

Can you post your code? It will help us to solve the problem.

Hi, Thanks for help, i ald solve the problem...
but got some problem with my project, later i will post my problem here hope somebody can help me, here is all professional and i am just a newbie..
hope u guys can lend me a hand....i will be appreciate very much, Thanks =)

Acetronics2
- 29th November 2009, 17:24
Hi, Jerade

You can get an interrupt from PORTA ...

see your Databook, Comparator section, ...




12.6 Comparator Interrupts
The comparator interrupt flag is set whenever there is
a change in the output value of either comparator.
Software will need to maintain information about the
status of the output bits, as read from CMCON<7:6>, to
determine the actual change that occurred. The CMIF
bit (PIR registers) is the Comparator Interrupt Flag. The
CMIF bit must be reset by clearing it (‘0’). Since it is
also possible to write a ‘1’ to this register, a simulated
interrupt may be initiated.
The CMIE bit (PIE registers) and the PEIE bit (INTCON
register) must be set to enable the interrupt. In addition,
the GIE bit must also be set. If any of these bits are
clear, the interrupt is not enabled, though the CMIF bit
will still be set if an interrupt condition occurs.



...

isn't it not marvellous ???

Alain