Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

can I generate a trigger with counter out put?

And If I remove the trigger functionality from this VI, I encounter another error

 

Error - Image4.PNG

0 Kudos
Message 11 of 36
(3,640 Views)

Hello Puspa,

 

Where is your trigger line physically wired to your X-Series device? To get rid of the first error, delete the get full terminal VI with the "ao/starttrigger" string. Instead, create a constant directly wired into the Start Digital Edge trigger VI and select the actual line that will be receiving the trigger. (Typically this will be a PFI line.  It is up to your application as to whether you need a trigger at all. You can select any PFI line to accept the trigger.)

 

As for the second error, it would be helpful to know where it is throwing. Have you run your code using highlight execution to find out which VI it's coming from? Here is a KB that addresses several common causes of that specific error:  http://digital.ni.com/public.nsf/allkb/485201B647950BF886257537006CEB89?OpenDocument

 

Let me know if this helps!

David R
Systems Engineer
National Instruments
0 Kudos
Message 12 of 36
(3,630 Views)

Hello David,

 

Thank you for your reply. I was able to solve the first error. I assigned source of trigger for both channel as /Dev1/PFI0 and I do not have that error anymore.

 

But I am still struggling with second error. I ran my VI with highlight execution and it looks like I have problem in my " DAQmx write task" of my Master channel.

 

I also reviewed the link you posted but was not able to resolve the problem.

 

Is there anything I am missing?

 

Thank you,

 

Pjkunwor1

0 Kudos
Message 13 of 36
(3,619 Views)

Error.png

0 Kudos
Message 14 of 36
(3,617 Views)

Hi Puspa,

 

Be sure to start your tasks only after writing to both AI channels. (Also, make sure that you are writing to different AI channels.)

 

You can also double check that you are not running a task in MAX using the specific AI channel that is throwing the error. I also noticed that you have some for loops with the "N" terminal set to 1. This will iterate through the for loop once and thus makes the loop unnecessary. You can remove the for loops, and your code should run the same.

 

Regards,

David R
Systems Engineer
National Instruments
0 Kudos
Message 15 of 36
(3,603 Views)

Hello David,

I apologize for taking long time to get back to you. Actually I was trying different things to get this done.

In this process I realized that I cannot use “Multi channel synchronization” because I have a single A/D in my USB-6353 board. And hence I received some helps from this forum and wrote both AO channels to same task.

 

This approached solved my problem half way. Now I am able to generate two AO of single sine pulse from two channels of my board.

Buy my final results I am aiming for is

 

AO Channel 1: DAT

AO Channel 2: -----50us wait-----DATA

AO Channel 3: ---------------100us wait---------------DATA

AO Channel 4: --------------------------150us wait-------------------------DATA

Where DATA is my analog output of a single sinusoidal signal.

 

So my question is how do I write zeroes (microsecond delays) to my AO channel 2 before my single sine output (DATA)?

Right now I am successfully generating this

AO Channel 1: DATA

AO Channel 2: DATA

AO Channel 3: DATA

AO Channel 4: DATA

 

Please let me know if my explanation is not clear

 

 

The image of my 2 channel output.

 

 working.PNG

 

0 Kudos
Message 16 of 36
(3,576 Views)

Hi Puspa,

 

To write empty data, just use the "Initialize Array" function with as many zero samples as you like.  You can then use the "Append Signals" VI to add your sine wave to the end of the flat (zero) signal.  You can use the "Convert To Dynamic Data" and "Convert from Dynamic Data" blocks to move between data types, as shown below:

 

Untitled.png

 

In the above example, you will have the same sine signal appearing after 5 samples in the first channel and after 10 samples in the second channel.  The amount of time the delay represents will be a result of your sample rate.  In other words, if my DAQ task was running at 100 samples per second, there would be a .05 second and .1 second delay before my sine waves appeared in my two channels, respectively.

 

Let me know if you have further questions!

 

Best,

David R
Systems Engineer
National Instruments
0 Kudos
Message 17 of 36
(3,567 Views)

Hello David,

Thank you very much for your reply. The explanation you provided is very clear. I tried to implement your suggestions to my running VIs but I am facing new error.

 

Error201435.PNG

 

 

At this time it says “No samples for buffered generation". Is there anything else I have to add to my Daqmx to get rid of this error?

Thank you very much for your help.

Best,

PJK

0 Kudos
Message 18 of 36
(3,556 Views)

Hi Puspa,

 

Could you try running your code with the "Highlight Execution" and "Retain Wire Values" options enabled?  (They are the two icons immediately to the right of the "Pause" button on your block diagram.)  Watch the code as it executes, and let me know where the error actually originates.  It would be good to see where that error is actually throwing, as it mentions occurring at "SinePulse.vi" despite the description calling out DAQmx Write.  Do you have a VI called "SinePulse" in your code?

 

As a side note, the for loop you have only iterates once, so effectively it is not accomplishing anything and can be deleted by right-clicking on it and selecting "Remove For Loop" without any change to the current function of your code.

 

Regards,

David R
Systems Engineer
National Instruments
0 Kudos
Message 19 of 36
(3,548 Views)

Hello David,

a)      So I ran my VI using highlight execution and it looks like the problem is occurring at Daqmx write. Image below

b)      The VI is saved under the name " SinePulse vi" hence the error is thrown under that name.

c)       So if I delete my for loop would it still generate single pulse of sine wave??

 

Thank you very much for your help.

 

Append Signal Error.PNG

0 Kudos
Message 20 of 36
(3,545 Views)