LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help converting c program to labview

Hi,

 

I have a C program meant to allow for acceleration of a stepper motor - it's in C, but I need to convert it to Labview to run it on my DAQ.  Could someone help me convert it or show me what I would have to do?

 

I'm new to Labview, so any help would be much appreciated.

 

Thanks a lot!

0 Kudos
Message 1 of 5
(2,970 Views)

Did you write this C program, or are you intimately familiar with what the C program does?

 

I would suggest starting by writing a flow chart or some kind of state chart that describes what the program does, etc.. 

-------
Mark Ramsdale
-------
0 Kudos
Message 2 of 5
(2,946 Views)

Nobody wants to convert a long C program into LabVIEW. (... and google translate cannot do it yet :D)

 

Instead, tell us exactly what the program is supposed to do, and we can give hints how to implement it in LabVIEW from scratch. Chances are that a LabVIEW version already exists.

Message 3 of 5
(2,932 Views)

Hi,

 

The program is an algorithm meant to simulate linear acceleration that can be used to help run a stepper motor - I am trying to use Labview and

 

I have looked at a lot of Labview examples of algorithms and fomulas already but I don't know how to incorporate so many variables into one program.

 

If you guys could point me in the right direction any input would be greatly appreciated.

 

Thanks a lot!

0 Kudos
Message 4 of 5
(2,905 Views)

LabVIEW does not have "variables" in the same sense as text based code. Value are received by the code via front panel controls (human interaction or assigned connectors in the case of a subVI). For the duration of the code, the data lives inside wires (and possibly shift registers if it needs to persist across iterations).


theodyssey12 wrote:

The program is an algorithm meant to simulate linear acceleration that can be used to help run a stepper motor - I am trying to use Labview and


You want the acceleration to increase linearly or the speed to be a linear ramp? Big difference! A linear speed increase is a linear ramp and linear acceleration is a nonlinear ramp of velocities that needs to be translated into stepper motor pulses. What kind of hardware do you use? What kind of drivers do you use for the stepper motors?

 

Can you describe the capabilities that the program needs? How is initialized? What triggers the start of the ramp? what determins the start and end values? What are the limits? What determines the timing?

 

If you can give us a nice flowchart of states, translating it into LabVIEW will be easy. Trying to translate a C program verbatim into LabVIEW would result in a horrible mess, because native LabVIEW is so much more elegant. 😄

 

As a possible quick workaround, you could compile the C porgram into a dll to be called from within LabVIEW. Do you have this capability?

0 Kudos
Message 5 of 5
(2,883 Views)