VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using DAQmx in a VeriStand Custom Device

I am trying to use a counter card as a pulse generator to create some quadrature signals.  I have had another post similar to this, but I specifically want help to try to debug/figure what is wrong with the code I have built.  My code works perfectly fine with LV-RT outside of VeriStand and outside of a custom device - so what is left is to implement with a custom device.  This is the first custom device I am attempting to make and so hence all the problems I'm sure.

 

Initially I tried to use the Easy Custom Device Tool and make an asynchronous custom device to run it.  It deployed in VeriStand and everything run without any error, but there were no outputs.  After digging around for a while - it seemed that this project might actually be a Inline HW Interface type.  Although to be honest I'm not sure which would work better.  I used the Custom Device Template to create a template for the Inline HW Interface and put my code in.  I deploy it in VeriStand and get Error -50103.  It seems to be a DAQmx resource error. I have some of these errors initially in my LV-RT code, but thought that I handled them all but using a control task VI with reserve/unreserved parameters.  I'm not sure where to look from here.

 

To try to help anyone that might have the time to look, I have included both of my projects (asynchronous and inline HW) to look at.  I also included my orginal LV-RT code that works as a reference as well.

 

The asychronous file is called PXI6624_Quad_Gen.zip and [if I remember right] should be fairly clean and easy to follow.

The inline HW file is called Quad gen.zip and is kind of messy because I put it together quite quickly to see if I could get it working and do clean up later.

The LV-RT file is simply Quad Timing.zip and all you need is a counter card to run it - I used a 6602 on a remote PXI system.

 

I would appreciate any help that can be offered here.  Thanks.

Download All
0 Kudos
Message 1 of 8
(7,119 Views)

Hello,

 

At first glance, -50103 means the resource is already reserved.  Have you added your counter card to your system definition file under DAQ?  You should not, if you want to use it with a custom device.

 

Regards,

Matt M.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(7,100 Views)

It is not added under DAQ in the SDF.  I took another look at the asynchronous template because I feel like I understand how that one works better.  I created a template from the custom device template tool that comes with VeriStand (not the easy custom device tool).  I then put all my code in there and hooked everything up to what is "correct" from what I can see.  I got a lot further this time.  VeriStand deploys fine and (for now) I have my oupts from the custom device be the same as my inputs just to check to see if the inputs are getting into the custom device.  They are.  If I change a number on my control input it goes through the input FIFO and comes out the output FIFO in my workspace, but I am still not getting any PWM output.  Without any errors and with my inputted values clearing making into the program I don't know what else to check.  Any ideas?

0 Kudos
Message 3 of 8
(7,097 Views)

I know it's kind of tricky to debug custom devices while they are running in VeriStand so what I did is make an error case and send the error code as a double through an output.  I get error -50103 which is a DAQmx resource error - so it's the same problem as before just it was hidden.  I went to here to get more information about the error and realized that Case 2 is where I fall into.  I have to generate these outputs, but for the test that they will be used for I need to change things like frequency, duty cycle, and phase while running the test and not reconfiguring the SDF.  I have a "set" button that allows you to change things and then restart the output.  I have not gotten any errors using LV-RT but I get this resource error in VeriStand.  I know now that it's not proper to keep stopping and starting my task, but how come it works in one and not the other?  And is there any suggestions of how to improve my current code to make it work with VeriStand?  I attached a screenshot of my current code to so you can see what I am doing.  Thanks for the help.

0 Kudos
Message 4 of 8
(7,091 Views)

Hello,

 

Can you please create a custom device that just creates the counter output task, starts it, and lets it run?  This should help us narrow down the issue. If you are able to get output then the issue is with starting and stopping the task.  If you are unable to see output, then there might be something else wrong.

 

Thanks

Applications Engineer
National Instruments
0 Kudos
Message 5 of 8
(7,070 Views)

Thanks for the advice.  I did that and was able to get it working.  Turns out when I was trying to do it with multiple channels I was creating multiple tasks with the same name incidently.  I went about it a different way to make sure I didn't do that and it works great now.  I have all 4 Quad channels working simultaneously with being able to be adjusted independantly of each other.

0 Kudos
Message 6 of 8
(7,063 Views)

Hi,

I am a new bee, working on PXI-6624 custom device. Can you please share your project so that I can study it as a reference?

0 Kudos
Message 7 of 8
(1,742 Views)

I recommend you look through the general Custom Device advice here:
https://niveristand-custom-device-handbook.readthedocs.io/en/latest/

which is more up to date and gives you a better foundation for understanding what is going on.

 

best of luck,

 

Darin Gillis
NI - Chief Product Owner - VeriStand
0 Kudos
Message 8 of 8
(1,727 Views)