use of integers in version 3 ?

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

Moderators: Benj, Mods

Post Reply
fransky
Posts: 10
Joined: Mon Nov 28, 2005 10:00 am
Contact:

use of integers in version 3 ?

Post by fransky »

Hi,

I was a simple counting up loop in a flowcode version 2 program using as countmaximum a variable that was like everything else a byte, so it couldn't have a larger value than 255.

worked fine, also under version 3, but ....
The number of times I wanted to go through the counting routine before taking a next action was on the short side, I thought that changing the variable countmaximum to type integer and making it 512 for instance would do just that.

It compiles OK, but the pic16F88 used does not know what to do with it, it behaves as though the maximum count is reached the first time the program goes through the loop.

Any suggestions, did I interpret how to use integers wrong, need to change configuration settings of the pic, or ...?

fransky

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:

Post by Benj »

The integers in Flowcode 3 should be 16 bit so a count of about 16000 should be possible. However if you are having probelms then why not have an inner loop count of 255 and then an outer loop count of 2 to reach your goal of 512,

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

Post by Steve »

Hello fransky,

Please recheck your code to see if looks ok. If you think there is a bug within Flowcode, send your program to me or Ben and we'll look into it.

fransky
Posts: 10
Joined: Mon Nov 28, 2005 10:00 am
Contact:

integer as counter part 2

Post by fransky »

Thanks for the advice,

I am sure the two loop approach would solve my immediate issue (I thought about implementing such a solution, but with the availibility of integers in FC V3 that seemed unneccessary, the integer is such a more elegant solution, and we seem to agree it should work, so let's make it work).

My code is quite a program, I give the integer a value in one part of the program and use it in a macro that is called after that.
values up to 255 work fine, but when I make the value 256 it is immediately over.

I will run some experiments with a simplified version of the code, check whether it goes into the macro OK and keep track of how many times it goes through the countloop (none, once or ...?).
Any chance the problem has to do with local and global scopes of the declaration of the variable as integer? The documentation seemed to indicate something like that is not unthinkable?

If after my experiments the problem persists, I'll send you the simplified code and hopefully can also give you more test results a input.

best regards,

Fransky

fransky
Posts: 10
Joined: Mon Nov 28, 2005 10:00 am
Contact:

integer in countloop problem solved

Post by fransky »

Sometimes the solution is so easy (always in hindsight however).

I declared the value against which the counter was compared in the loop as integer. In one of the macro's were a countloop was used, I did not declare the actual counter as an integer but as a byte, as in the existing flowcode 2 version of the macro.

Thought I'd post this, maybe help someone not wander about this for a few hours.

fransky

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

Post by Steve »

Hello fransky,

Thanks for taking the time to post your solution.

Post Reply