LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cDaq Task does not start over VI only by MAX

Hi Community,

 

this is my first post in this community, so please excuse if I make any mistakes.

I have searched the board for similar issues but I did not find anything.

 

I am still rather new to LabView and I am trying to build a small automated test bench.

Part of this is the control of a PWM controlled pump.

For this I am using a cDAQ-9179 with a NI9472 Module.

This module controlls a fast paced relais which then performs a pull down on PWM connection at the pump.

The pump does need a 12V PWM and directly controlling it with the 9472 does not work because ther is no active pull down.

 

Not to come to my issue:

When I start the VI nothing happens at the 9472.

But when I start a frequency task via NI MAX at the same module and output this works fine.

And after that I can also control the pump using my VI, even though MAX is not doing anything.

So every time I connect the cDAQ to my Laptop I first have to start this frequency task via MAX for just a short time and then I can use my VI.

It somehow seems as if the 9472 needs to "wake-up" or something.

The other modules in the cDAQ work fine and they work directly when using only the VIs for example the flow rate sensor goes to a NI9203 and that works immediately without MAX.

 

I hope this is just a small issue that can be fixed rather quickly.

Maybe I just made a mistake writing the VIs..

I attached both VIs to this post for you to check for any mistakes I made.

 

Thanks in advance

Tim

 

Download All
0 Kudos
Message 1 of 9
(949 Views)

Hello, Tim.

 

     When I opened PumpControl (first), it told me that it was looking for PWM-Pump, and opened with a Broken Arrow.  "No problem", I thought, so I downloaded PWM-Pump and tried to open it.  It "hung", showing a white Front Panel with some tiny lettering, never completing, until I forced it to close.

 

     Curiously, when I then re-opened PumpControl, there was no error!  It was somehow linked to PWM-Pump (inside the right-most While Loop), but I still couldn't open it.  [Note -- both PumpControl and PWM-Pump seem to use the exact same VI Icon -- at least change the background color ...].

 

     It seems to me likely that the problem is within PWM-Pump.  Please check this, and make sure that you can open it on another PC running LabVIEW 2021.  You might also consider saving both of these routines using "Save for Previous Version" and specify LabVIEW 2019, "just in case" something is flakey with your LabVIEW installation ...

 

Bob Schor

0 Kudos
Message 2 of 9
(902 Views)

Hallo Tim,

 


@Tim_Rothha wrote:

When I start the VI nothing happens at the 9472.

But when I start a frequency task via NI MAX at the same module and output this works fine.

And after that I can also control the pump using my VI, even though MAX is not doing anything.

So every time I connect the cDAQ to my Laptop I first have to start this frequency task via MAX for just a short time and then I can use my VI.

It somehow seems as if the 9472 needs to "wake-up" or something.

The other modules in the cDAQ work fine and they work directly when using only the VIs for example the flow rate sensor goes to a NI9203 and that works immediately without MAX.


Which error do you get in the first run of your VI? There should be an error when the cDAQ doesn't respond immediatly!

 

On your VI:

  • Why don't you clean up the code? Well-organized code is easier to understand and to maintain!
  • Why do you read the AI value only once? How should your PWM control loop act on process value changes?
  • Why do you call that PWM output VI in a loop as fast as possible?
  • Why do you initialize and quit DAQmx task so quick and often?
  • Why don't you apply a scale to your AI channel so you don't need to scale the reading afterwards?
  • Have you heard of the InRangeAndCoerce function before?
  • To round for 1 decimal digit is quite nonsense: you can format your indicators as needed. (And there still is a problem of floating point precision when dividing by 10!)

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 9
(893 Views)

Hi Bob,

 

thanks for the reply.
I reatached a new save of the PWM-Pump VI as Labview 19 version.

Hope this works.

 

Kind regards

Tim

0 Kudos
Message 4 of 9
(862 Views)

Hi Tim,

 

your "LV19" VI is still saved with LV2021: renaming the file doesn't change the LabVIEW version… 😄

 

"File->Save for previous" is your friend!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 9
(859 Views)

Hi Gerd,

 

thanks for the reply.

I try to answer you questions.

 

Which error do you get in the first run of your VI? There should be an error when the cDAQ doesn't respond immediatly!

There is no error at all. The VI is running continously and there is no error. The Input signal is displayed as it should and reread as it should

 

On your VI:

  • Why don't you clean up the code? Well-organized code is easier to understand and to maintain!
  • To be honest, this is how I can read and understand it best, but I will try to do it better in the future
  • Why do you read the AI value only once? How should your PWM control loop act on process value changes?
  • The PumpControl VI is running inside another VI in the finished product. Therefore I removed the while loop. To try it out I just start the VI as run continiously
  • Why do you call that PWM output VI in a loop as fast as possible?
  • If I call it slower, then the PWM frequency will differ to much as it will have small stops, (that is my understanding)
  • Why do you initialize and quit DAQmx task so quick and often?
  • How would you initialize and quit the tasks regularly? initialize before and quit after the loop?
  • Why don't you apply a scale to your AI channel so you don't need to scale the reading afterwards?
  • Because this VI will run on different PCs which and I thought that the scale configuartion might not transfer propperly
  • Have you heard of the InRangeAndCoerce function before?
  • Nope. But I will have a look into this
  • To round for 1 decimal digit is quite nonsense: you can format your indicators as needed. (And there still is a problem of floating point precision when dividing by 10!)
  • I knew about formating the display value, but does the VI then also only work with the rounded value? Or does it still run using the non rounded value? Because my goal was, that the comparison is not always less or more but could also be equal. And the sensor value is unstable after the 2nd decimal digit
0 Kudos
Message 6 of 9
(857 Views)

Hi Gerd,

 

this is quite weird, because that is exactly what I did...

It generated a new folder and inside was the VI.

I tried it again now. Maybe I should not have opened it in LV2021 again.

0 Kudos
Message 7 of 9
(855 Views)

Hallo Tim,

 


@Tim_Rothha wrote:
  • Why do you call that PWM output VI in a loop as fast as possible?
  • If I call it slower, then the PWM frequency will differ to much as it will have small stops, (that is my understanding)
  • Why don't you apply a scale to your AI channel so you don't need to scale the reading afterwards?
  • Because this VI will run on different PCs which and I thought that the scale configuartion might not transfer propperly

Right now your PWM task is set to "finite elements" with just 10 samples: which duty cycle values are you able to output with these settings?

You can define scales in software, so they are available on each computer…

 

Suggestion:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(848 Views)

Hi Gerd,

 

okay I will have a look into defining scales in software. Thanks!

I am able to output 0 to 100% duty cycle with this.

As long as I first started a small task with NI MAX. Otherwise there will be no output.

 

Thanks for the suggestion. This looks cleaner. 

 

Kind regards
Tim

0 Kudos
Message 9 of 9
(837 Views)