Have almost completed my first project using Flowcode 5 student version however when I compile it says I have gone over the 4K limit.
This was some concern to me when I initially bought the program as I had no real indicaton of limitations.
This has since been rectified in an earlier post and thanks to the suggestions there.
Thought perhaps someone could suggest a better way of approaching the job and get down under the limit.
Presently it is 290 odd over.
Suggestions on how to minimise code size
Suggestions on how to minimise code size
- Attachments
-
- sept16.fcf
- (25.74 KiB) Downloaded 243 times
-
- sept16.txt
- (555 Bytes) Downloaded 219 times
- 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: Suggestions on how to minimise code size
Hello,
Would it be possible to do the calculation using integer maths. The Floating point library for PIC will be huge and is likely consuming a lot of your ROM space.
Would it be possible to do the calculation using integer maths. The Floating point library for PIC will be huge and is likely consuming a lot of your ROM space.
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: Suggestions on how to minimise code size
The reason I used the floating point was because of the following calculation......
Calculate_Degrees = BCD - (Delay_Time / Cycle_Time) * 360
Without using floating point values, It would always return BCD value only and I thought the floating point approach was the only way.
Calculate_Degrees = BCD - (Delay_Time / Cycle_Time) * 360
Without using floating point values, It would always return BCD value only and I thought the floating point approach was the only way.
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Suggestions on how to minimise code size
You could reorganize the formula a bit:
Calculate_Degrees = BCD - ( Delay_Time * 360 ) / Cycle_Time
Use a Long for Delay_Time if the result of the multiplication exceeds 32768.
Calculate_Degrees = BCD - ( Delay_Time * 360 ) / Cycle_Time
Use a Long for Delay_Time if the result of the multiplication exceeds 32768.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis