Timer 3 int

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times

Timer 3 int

Post by Mikat »

Does Flowcode4 support timer 3 interrupt?
I tried edit the fcd file,like in flowcode3 but i didnt get the timer3 interrupt at the interrupt list.
So how can i use timer3 interrupt? I need timer3,because 0 and 2 dont give enought low interrupt rates,and the tmr1 is used other thing.
And is there way to limit a floating point calculation precision,like 1,2 or 3 decimal?

Mika

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: Timer 3 int

Post by Benj »

Hello Mika

Which target are you trying to enable the timer 3 interrupt on? As far as I am aware I added the timer 3 interrupt to all devices that are capable of using it in V4.

I dont think there is a way to limit the precision of the floating point maths but you may be able to add an extra section of code to allow you to do this.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times

Re: Timer 3 int

Post by Mikat »

Target is 18F4620,i get the tmr3 int working at fc3,but not in fc4.
I dont really need the limit the fp precision,but is there "easy" way limit the number behind the dot,so that i can print the float value like 12.7 not 12.7563..
Or is the only way to get float back to int,and to it in int numbers?

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: Timer 3 int

Post by Benj »

Hello

The interrupt should be allowed to work if you like attach your FCD file to the forum topic and Ill have a look for you. One think to check is the overall number of interrupts specified at the start of the [Interrupt] section.

Thankfully I anticipated this float request. The C code call that is generated for the Float to string function looks like this when my float variable is named f and my string variable is named s in Flowcode.

Code: Select all

FCI_FLOAT_TO_STRING(FCV_F,6,FCV_S,FCSZ_S);
Flowcode defaults to 6 characters of precision when using the function in the string manipulation icon. You could use a C code icon to change this.

This would give you one character of precision.

Code: Select all

FCI_FLOAT_TO_STRING(FCV_F,1,FCV_S,FCSZ_S);

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times

Re: Timer 3 int

Post by Mikat »

Great,thanks Ben.
Can that be used multiple times,eg. adjust the precision do one calculation in 2 decimal precision then adjust the precision again,next calculation in 3 decimal etc..

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: Timer 3 int

Post by Benj »

Hello Mika

Yes you can use as you wish in as many different combinations. The Flowcode function will always use a value of 6 but if your calling the function from C then you can specify any value you wish (within reason). We picked 6 as a default as this works quite nicely for GPS.

Post Reply