LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel loop delays before starting

Solved!
Go to solution
This is my first post, so please bare with me. 
 
Brief Project overview:
I am working on a remote motor control project.  Im using LV8.2  on my computer, I also have the realtime module on my target device.  I am reading 5 analog signals using a usb 6009 on the host computer.  These values are then sent to a compact rio 9004 thru an ethernet connection.  The VI on the rio then converts these values, which are then written to a FPGA VI reference.   The FPGA vi generates the step and direction signals in parallel loops.  There is an additional loop that reads the position of the motors through potentiometers. 
 
The Problem:
Everything works well... but I have to wait approximately 1min and 50 seconds before the step and direction signals start.  After they do start, they work fine.    The wierd thing is, Im reading the analog measurements thru the FPGA VI ref, and they are coming thru as soon as I start the program, as are the user inputs coming in thru the ethernet. 
 
Any help in this issue would be greatly appreciated.  I have attached my project as a zip file.
 
thanks for your time,
Jason
 
 
0 Kudos
Message 1 of 3
(3,950 Views)
Solution
Accepted by topic author j coates
I love a good mystery!
 
Posting your code really helped.  I believe your problem is with your initial conditions.  On the 9004 code, all the default values are set to 0.  These values do not have time to be updated before they are read for the first time.  If you look at the way Ttilt(Ticks) is calculated on the first run of the loop, I think the problem reveals itself.  On the initial run, tiltInputLatched is 0.  Follow the math, and by the time you get to the portion circled in red below, you get 24064.  Subtracting this from 16384 and multiplying by 1800 gives -13824000.  Since this is less than 20000000, it is passed to the FPGA.  The FPGA is looking for a U32 rather than an I32, so the value is coerced to the correct representation.  In this case, -13824000 becomes 4281143296 (the sign bit is included in the resulting U32).  On the FPGA, this number is not equal to 20000000, so it is fed to the wait function.  On a 40MHz clock, this is 107 seconds or 1min 47sec.
 
To fix the problem, you should either make sure your default values are set to something reasonable, or make sure the value is not read before a reasonable value is written to it.
 
Hope this helps!!
 
 
 
 

Message Edited by Dustin W on 03-05-2007 08:41 AM

Message 2 of 3
(3,912 Views)
Thanks a lot Dustin.  That was it exactly.  Problem Solved... silly mistake. 🙂
0 Kudos
Message 3 of 3
(3,891 Views)