LED Flashing Delay

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
driftlogic
Posts: 5
Joined: Thu Oct 13, 2011 5:58 am
Contact:

LED Flashing Delay

Post by driftlogic »

In a complex LED flashing pattern where the delay between LED outputs is determined by a variable called 'rate' how can I instantaneously change the rate value without relying on a macro to do it. For example, Say I have a switch, and depending on the switch state a certain value to 'rate' is set. How can I utilize an interrupt that can read the change in the switch and set the rate value so the change in flashing seems instantaneous?

Thanks.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Flashing Delay

Post by Benj »

Hello,

You could use say the port interrupt which is basically an interrupt on change for some of the port B pins (normally the upper 4 bits of the port). Then if any of the switches change state you will get an interrupt which can be used to read in the switches and update the delay variable. Some devices allow for interrupt on change for all of port B and some even support multiple ports depending on how many switch inputs you need to the interrupt.

driftlogic
Posts: 5
Joined: Thu Oct 13, 2011 5:58 am
Contact:

Re: LED Flashing Delay

Post by driftlogic »

thank you for the response Ben. i am using a pic16f873a. I'm having a little trouble achieving this based on your suggestion, do know if there are any example files that may help me?

Best,

DriftLogic

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Flashing Delay

Post by Benj »

Hello,

Here is a basic example.
Attachments
IOC.fcf
(7 KiB) Downloaded 480 times

Post Reply