Interrupt set rollover value with a variable

Moderator: Benj

Post Reply
stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Interrupt set rollover value with a variable

Post 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 3665 times

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: Interrupt set rollover value with a variable

Post by Benj »

Hi Stefan,

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

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

Re: Interrupt set rollover value with a variable

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

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Interrupt set rollover value with a variable

Post by stefan.erni »

Hi Steve

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

regards

Stefan

Post Reply