MIAC Counter Problem
MIAC Counter Problem
Hi Matrix,
We have had a problem with our Matrix MIAC controller.
What has happened is a variable (a counter) in the Flowcode program is assigned as a ulong but when this variable is actually used by the matrix controller it is acting like an integer, i.e. it gets to 32767 and starts counting down. I have re-uploaded the program but it makes no difference. What could be the possible problem?
Best Regards,
We have had a problem with our Matrix MIAC controller.
What has happened is a variable (a counter) in the Flowcode program is assigned as a ulong but when this variable is actually used by the matrix controller it is acting like an integer, i.e. it gets to 32767 and starts counting down. I have re-uploaded the program but it makes no difference. What could be the possible problem?
Best Regards,
- 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: MIAC Counter Problem
Hello,
Please could you attach your Flowcode project file so we can have a look at your code.
Please could you attach your Flowcode project file so we can have a look at your code.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: MIAC Counter Problem
Hi Benj,
I have attached what I believe is the project file! I did not do this programming but have been asked to try fix it!
Best Regards
Roy
I have attached what I believe is the project file! I did not do this programming but have been asked to try fix it!
Best Regards
Roy
- 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: MIAC Counter Problem
Hello Roy,
The PrintNumber function in the MIAC component only supports a signed integer and cannot display longs.
To work around this you can use the StringToInt function in the Strings tab of the calculation icon to convert your long variable to a hexadecimal string you can print to the display.
Flowcode 6 has an additional new function which allows you to correctly convert a long to a decimal string.
The PrintNumber function in the MIAC component only supports a signed integer and cannot display longs.
To work around this you can use the StringToInt function in the Strings tab of the calculation icon to convert your long variable to a hexadecimal string you can print to the display.
Flowcode 6 has an additional new function which allows you to correctly convert a long to a decimal string.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: MIAC Counter Problem
Hi Ben,
Thanks for the reply and possible solution! Since I am new to this are you able to do a short flowcode v5 file to show how your workaround solution works?
The company is still assessing whether they want to upgrade to Flowcode v6 but it might be an idea after this, I will push again with them! If we get Flowcode v6 would our current file need any changes or would it work as is?
In the meantime are you able to take down my flowcode file as I don't think the company wants it widely available! How do you Private Message so that you can send files without them being accessed by the wider world?
Many thanks again!
Regards
Roy
Thanks for the reply and possible solution! Since I am new to this are you able to do a short flowcode v5 file to show how your workaround solution works?
The company is still assessing whether they want to upgrade to Flowcode v6 but it might be an idea after this, I will push again with them! If we get Flowcode v6 would our current file need any changes or would it work as is?
In the meantime are you able to take down my flowcode file as I don't think the company wants it widely available! How do you Private Message so that you can send files without them being accessed by the wider world?
Many thanks again!
Regards
Roy
- 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: MIAC Counter Problem
Hello Roy,
Here is a quick example.
To PM a user simply click on their name e.g. "Benj" to get to their about page and then click the Private Message (PM) link. Or there is a button marked PM on the right hand side of the forums under the poster's username --> .
Here is a quick example.
To PM a user simply click on their name e.g. "Benj" to get to their about page and then click the Private Message (PM) link. Or there is a button marked PM on the right hand side of the forums under the poster's username --> .
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: MIAC Counter Problem
Hi Ben,
Having thought about it a bit and played with your small program [Thank you for that!!], would it not be easier to just change the PrintNumber (CountedCycles) function [which doesn't work due to CountedCycles being a long variable] to the PrintString (CountedCyclesString) function because we have already calculated CountedCyclesString = ToString$ (CountedCycles) in the calculation icon?
Would it mess with the formatting at all on the screen, though I suspect it won't?
Best Regards
Roy
Having thought about it a bit and played with your small program [Thank you for that!!], would it not be easier to just change the PrintNumber (CountedCycles) function [which doesn't work due to CountedCycles being a long variable] to the PrintString (CountedCyclesString) function because we have already calculated CountedCyclesString = ToString$ (CountedCycles) in the calculation icon?
Would it mess with the formatting at all on the screen, though I suspect it won't?
Best Regards
Roy
- 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: MIAC Counter Problem
Hello Roy,
You're right, ToString$ assumes a signed 32-bit INT as the maximum bit depth so should work fine.
In Flowcode v6 we added the a function to the LCD component called PrintFormattedNumber which supports 32-bit INTs in signed or unsigned formats just in case you need the extra flexibility.
You're right, ToString$ assumes a signed 32-bit INT as the maximum bit depth so should work fine.
In Flowcode v6 we added the a function to the LCD component called PrintFormattedNumber which supports 32-bit INTs in signed or unsigned formats just in case you need the extra flexibility.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: MIAC Counter Problem
Thanks Ben, I think it's problem solved as we only count to 200k for now! I'm looking at v6 anyway so I can do arduino as well, but as always funding is tight!
Best regards
Roy
Best regards
Roy
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times