Page 1 of 1

State map compilation error

Posted: Sat Nov 04, 2023 12:37 pm
by niedian
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)

Re: State map compilation error

Posted: Sat Nov 04, 2023 1:37 pm
by chipfryer27
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

Re: State map compilation error

Posted: Sun Nov 05, 2023 3:22 am
by niedian
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!

Re: State map compilation error

Posted: Sun Nov 05, 2023 3:34 am
by niedian
Here is a clearer screenshot

Re: State map compilation error

Posted: Mon Nov 06, 2023 9:23 am
by Steve-Matrix
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:

Re: State map compilation error

Posted: Mon Nov 06, 2023 3:30 pm
by niedian
Thank you, Steve Matrix. After modifying the program, download it to the chip and the hardware runs normally. Thank you.