Port bit test during a time delay

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

Moderators: Benj, Mods

Post Reply
medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Port bit test during a time delay

Post by medelec35 »

Running Flowcode V3 with 12F675.

I have the following working routine:

Read ADC channel 0 (0 to 255)
Convert ADC to time delay (1 to 10 Min's)
Run macro A
Start again.

I would like to know how to do bitwise test of a port (it Could be a port without an interrupt) during timing period, and if port is high then immediately stop timing and call a macro.

This is what I would like:

Read ADC channel 0 (0 to 255) e.g. 127
Convert ADC to time delay (1 to 10 Min's) e.g 5 Min's
Run macro A if port a2 has just gone high but still got 2 Min's delay left.
Run macro B if full delay ran since port a2 has stayed low e.g After 5 Min's
Start again.


Thank you.

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post by Steve »

You could use the timer interrupt with a count variable to create the appropriate time delay - this would free up the processor to look at the i/o line.

Alternatively, use a count variable with a loop and a small delay (10 ms?) to generate your large delay times, and look at the input within this loop.

Post Reply