 David-Baratheon
		
			David-Baratheon
		
		
		
		
		
		
		
		
	
			01-28-2016 07:50 AM
It's supposed to provide pulse width modulation but when I change the clock frequency control input, the output remains at 1Hz.
The speed of the modulation should be determined by the delay VI inside the sequence structure, but it seems to not be changing when I move the control.
 Hooovahh
		
			Hooovahh
		
		
		 
		
		
		
		
		
	
			
			
    
	
		
		
		01-28-2016
	
		
		08:14 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 - last edited on 
    
	
		
		
		01-06-2025
	
		
		12:06 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 by 
				
		 Content Cleaner
		
			Content Cleaner
		
		
		
		
		
		
		
		
	
			
		
In the future you should post the actual VI not a picture.
Because in this case we don't know how that wait until next tick is configured. I assume it is in ms, in a 32bit form but can't know for sure from a picture. Also in FPGA I generally just leave the loop with a constant in the stop function so it never stops. I know this is generally bad edicate in other LabVIEW programming, but in FPGA is there ever a time you don't want your code to respond? It's dedicated and its deterministic, and I just let it run forever. Not that changing that would fix your issue, unless the loop stops running, at which point your Direction of motor wouldn't respond anymore either.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-28-2016 09:22 AM
It is configured as you mentioned. Ok I will bear that in mind in future.
Can you see anything obvious that might be causing this problem? Its stuck at 1Hz, my control doesn't do anything.
I have attached it but I dont think the VI will give you much more. I think the issue is with the logic in my code.
 nathand
		
			nathand
		
		
		
		
		
		
		
		
	
			01-28-2016 10:44 AM
I don't see anything obvious. You've compiled this code before running it on the FPGA, right? And you're using the Run button, not Run Continously?
How are you measuring the loop frequency? I would add an indicator for the loop rate, as shown below, in case the issue is actually in how you're measuring the loop rate.
 Matthew_Kelton
		
			Matthew_Kelton
		
		
		
		
		
		
		
		
	
			01-28-2016 10:55 AM
What about your direction control? Does that work?
 Bob_Schor
		
			Bob_Schor
		
		
		 
		
		
		
		
		
	
			01-28-2016 10:56 AM
So FPGA is not (yet) "my thing", but it almost has to be something to do with timing, initialization of Controls, etc. involving the FPGA. When I ran this on my PC (removing the FPGA-specific functions and substituting the Wait (ms) for the FPGA Wait), it ran fine, although the default value of the Control was way off the value(s) suggested by its appearance on the Front Panel.
How does FPGA code interact with Front Panels? [Sorry for my ignorance, but I didn't think there was the kind of "interactivity" that "regular" LabVIEW VIs have].
Bob Schor
 aputman
		
			aputman
		
		
		
		
		
		
		
		
	
			
			
    
	
		
		
		01-28-2016
	
		
		10:57 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 - last edited on 
    
	
		
		
		05-06-2025
	
		
		10:12 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 by 
				
		 Content Cleaner
		
			Content Cleaner
		
		
		
		
		
		
		
		
	
			
		
@Hooovahh wrote:
In the future you should post the actual VI not a picture.
Nice. BS will be proud.
01-28-2016 10:59 AM
Yeah direction control works fine, I've tested it on oscilloscope im both states.
Good idea regarding an indicator on the number of cycles. I will do that. Helps to see whats going on with the loop.
 Sam_Sharp
		
			Sam_Sharp
		
		
		 
		
		
		
		
		
	
			01-28-2016 10:59 AM
@Bob_Schor wrote:
How does FPGA code interact with Front Panels? [Sorry for my ignorance, but I didn't think there was the kind of "interactivity" that "regular" LabVIEW VIs have].
You access the front panel controls/indicators from the FPGA VI on your host (e.g. RT/PC) using the FPGA Read/Write Control node. Every front panel control/indicator becomes a 'property' which you can select on the read/write control.
01-28-2016 11:01 AM
Bob are you saying that when yuou ran the code, you got some variation in frequency when you moved the control?