Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Does not know why Timer0 get trigger when PortB interrupt?

Status
Not open for further replies.

helloleong

New Member
Now im doin a reader to output capasitance button press and detect card wiegand by using PIC16F727.

Basically the code is detect the wiegand card by using PORTB interrupt(D0 & D1),
and also using the same line to output the data (D0 & D1).
And the D0 and D1 also send out button press data.
I set DO & D1 as input to check PORTB interrupt, when need to send data set D0 and D1 to output, after send set back to input.

But when I swap the card, it is not stable, some times will trigger the Timer 0 and detect a button press.
After that, then the MCU cannot output any button press. But the MCU still will run the main loop.

And I don’t know what cause the timer0 interrupt when I swap the card (Even i did not press the button).

It had no problem when I no need output the data.
Means I no need to set D0 and D1 output and input every time when I need to send data.

THANK YOU VERY MUCH
 

Attachments

  • test.c
    12.9 KB · Views: 176
It's probably reseting due to the WDT timing out as you only clear it in your interrupt.

Mike.
 
Thanks Mike,

But i already disable WDT in config
__CONFIG(INTIO & WDTDIS & PWRTDIS & MCLREN & BORDIS & UNPROTECT & PLLEN);
__CONFIG(VCAPRA0);

Will it still be set and reset after i disable WDT? So how can i fix it?
 
Status
Not open for further replies.

Latest threads

Back
Top