State map compilation error
-
- Posts: 105
- http://meble-kuchenne.info.pl
- Joined: Thu Jan 07, 2021 11:28 am
- Has thanked: 3 times
- Been thanked: 4 times
State map compilation error
Hello, I would like to use a state diagram as an example of a running light. Why is there a compilation error and only one light flashing during simulation? Help me! (The program is attached)
- Attachments
-
- Flowcode1.fcfx
- (52.7 KiB) Downloaded 459 times
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: State map compilation error
Hi
I don't have the capabilities to compile to your chip on this machine, however from your chart I assume you are trying to "run" your LEDs much like "Knight Rider's " car.
If so, your C-Code seems to be the issue. Instead of using C-Code to calculate the value of "n" if you instead just use "calculation" with n=n+1 and later n=n-1 it should work.
Well it at least simulates OK with me.
Regards
I don't have the capabilities to compile to your chip on this machine, however from your chart I assume you are trying to "run" your LEDs much like "Knight Rider's " car.
If so, your C-Code seems to be the issue. Instead of using C-Code to calculate the value of "n" if you instead just use "calculation" with n=n+1 and later n=n-1 it should work.
Well it at least simulates OK with me.
Regards
Re: State map compilation error
Hello chipfreer27, thank you. I have modified it to calculate "n=n+1" in the "calculation" and now it runs normally in the simulation window. However, when writing the program to the chip, there was still a compilation error. I have sent a screenshot below, please help me take a look. Thank you!
- Attachments
-
- 5.png (137.71 KiB) Viewed 7408 times
-
- 4.png (261.47 KiB) Viewed 7408 times
-
- 1.png (100.97 KiB) Viewed 7408 times
-
- Matrix Staff
- Posts: 1472
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 204 times
- Been thanked: 349 times
Re: State map compilation error
Thanks for the error report. I see what the issue is. The following fix should allow the project to compile correctly:
Edit the "Main" macro and add a call to LED_Array1::AllOff() before you call your state diagram macro, like this:
Edit the "Main" macro and add a call to LED_Array1::AllOff() before you call your state diagram macro, like this:
- Attachments
-
- State diagram error fix.png (13.06 KiB) Viewed 7381 times