ioc

Post Reply
WingNut
Posts: 127
http://meble-kuchenne.info.pl
Joined: Tue Jul 13, 2021 1:53 pm
Has thanked: 8 times
Been thanked: 6 times

ioc

Post 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
Attachments
flowcode.jpg
flowcode.jpg (113.6 KiB) Viewed 1023 times

medelec35
Matrix Staff
Posts: 729
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 267 times
Been thanked: 269 times

Re: ioc

Post 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.
Martin

WingNut
Posts: 127
Joined: Tue Jul 13, 2021 1:53 pm
Has thanked: 8 times
Been thanked: 6 times

Re: ioc

Post by WingNut »

Everytime Martin. You are a star. Works a treat :D

medelec35
Matrix Staff
Posts: 729
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 267 times
Been thanked: 269 times

Re: ioc

Post by medelec35 »

You're welcome.
I'm glad I'm could help.
Martin

Post Reply