Page 1 of 1

ioc

Posted: Fri Dec 17, 2021 7:46 pm
by WingNut
Hi all again. I want to use an interrupt on change on pin rc2 on my current long running project using pic16f18877.
Couple of questions really
Q1: can i put an interrupt anywhere in my code eg in a loop or must it be near the start i.e in an initialisation macro?
Q2; Im using a piece of c code to do a software reset and having dug though a lot of forum messages, I'm trying to use the xc8 function reset() and it doesnt seem to work, but it may be because of q1 above or i'm just a noob

Re: ioc

Posted: Fri Dec 17, 2021 9:27 pm
by medelec35
Hi.
1. You need to place the IOC (or any other interrupt) before the main loop, so it's only called once.

2. Within a C Code block use

Code: Select all

RESET();
It must be all upper case & end with a semicolon.
Otherwise, if it does not, you will get an error.

Re: ioc

Posted: Fri Dec 17, 2021 9:40 pm
by WingNut
Everytime Martin. You are a star. Works a treat :D

Re: ioc

Posted: Sat Dec 18, 2021 1:08 pm
by medelec35
You're welcome.
I'm glad I'm could help.