Page 1 of 1

Interrupt set rollover value with a variable

Posted: Fri Jul 03, 2020 10:37 am
by stefan.erni
Hi Ben

At first.. Interrupt with FC8 are very nice to use. It is so easy to set the desired frequency and the later in the hardware the frequency is correct.
Sometimes you want to change this frequency during the program.
For the next flowcode version...
Would it be possible to set the rollover value with a variable?
And would it be possible to show the time in second (millisecond) in addition to the frequency?

regards
Stefan
rollover.PNG
rollover.PNG (15.79 KiB) Viewed 3826 times

Re: Interrupt set rollover value with a variable

Posted: Fri Aug 14, 2020 3:08 pm
by Benj
Hi Stefan,

Great suggestion there thanks I'll pass it on and see if we can do anything with it.

Re: Interrupt set rollover value with a variable

Posted: Mon Aug 24, 2020 12:17 pm
by Steve
Thanks for the suggestion, Stefan.

I've spent some time investigating this suggestion this morning and it is possible, but would require a lot of effort.

As a workaround, you could add the appropriate C code to change the rollover value to a variable's value. This code would depend on the chip and timer module and you can find the appropriate code by either viewing the C code for the interrupt icon within Flowcode or by looking at the chip's FCDX file and searching for "rollover".

For example, the TMR2 module in the 16F18877 uses the following code to set the rollover to 111:

Code: Select all

PR2=111-1
To change the rollover value to a variable value (for example, the global variable "rollover"), add a C code icon with the following:

Code: Select all

PR2=FCV_ROLLOVER-1
I hope this helps.
Steve.

Re: Interrupt set rollover value with a variable

Posted: Mon Aug 24, 2020 2:29 pm
by stefan.erni
Hi Steve

Thanks a lot. It's working nice the way you wrote.

regards

Stefan