State map compilation error
- 
				niedian
- Posts: 122
- http://meble-kuchenne.info.pl
- Joined: Thu Jan 07, 2021 11:28 am
- Has thanked: 3 times
- Been thanked: 5 times
 State map compilation error
 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 486 times
 
- 
				chipfryer27
- Valued Contributor
- Posts: 1758
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 388 times
- Been thanked: 598 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 7736 times
 
- 
			
		
				- 4.png (261.47 KiB) Viewed 7736 times
 
- 
			
		
				- 1.png (100.97 KiB) Viewed 7736 times
 
- 
				Steve-Matrix
- Matrix Staff
- Posts: 1619
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 224 times
- Been thanked: 382 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 7709 times
 
 
