Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

concurrent tasks in HSDIO PXI-6551

Hi All,

 

I want to attempt the following tasks concurrently.

 

1.  Create a custom clock (duty cycle and frequency) using the sample clock and export via a chosen DIO channel (say #7).

2. Create a discrete (finite duration) simultaneous acquisition and generation task using the same sample clock as in (1) but different channels than #7. 

 

Task (1) is created and left running DURING which task (2) is invoked multiple times by the user.

 

As long as I don't reset the card, I feel this should be possible.  

 

Thanks in anticipation for all suggestions/comments.

 

Anand

0 Kudos
Message 1 of 6
(4,237 Views)

Hey Anand,

 

The only issue I see with your idea is that you are trying to have 2 different Generation tasks going, one using the onboard clock and the other using an external clock. You cannot do this. You can do #1, but for #2 I would recommend that you also use the onboard clock for the generation part, and just adjust the data you generate accordingly.

 

Let me know if you have any questions or concerns. Thanks, and have a great day.

 

Regards,

DJ L.

Message 2 of 6
(4,229 Views)

Hello DJ,

 

 

Its been a while. Is it possible to setup and run two GENERATION tasks that can be initiated sequentially in the *following fashion*, e.g in C#

 

 

// preliminary task setup function calls for task1 and task2.

 

task1.initiate();

 

task2.initiate();

 

task2.WaitUntilDone(waitTime);

 

task1.WaitUntilDone(waitTime);

 

task2.Dispose();

 

task1.Dispose();

 

Thanks in anticipation!

 

Anand

Message Edited by ajog on 05-05-2010 06:46 PM
Message Edited by ajog on 05-05-2010 06:48 PM
0 Kudos
Message 3 of 6
(3,958 Views)

Hi ajog,

 

You should be able to use this sequence to initiate tasks and terminate tasks.   If you run into problems, let me know, thank you!

Kyle A.
National Instruments
Chief Applications Engineer
0 Kudos
Message 4 of 6
(3,925 Views)

Hi Anand,

 

The trick to this is to set up your generation waveforms so that they're always an exact multiple of your divided down clock, and your task 2 waveform contains your clock in it.

 

So, let's say you wanted to write a waveform that on one channel created a divide by 4 clock that was "free running" and then when you received a trigger, you played back a waveform of toggle.

 

                                             | <-- Trigger

ClockOut   0011 0011 0011 0011 0011 0011 0011

Data       0000 0000 0000 1010 1010 0000 0000

Wvfm      |AAAA|AAAA|AAAA|BBBBBBBBB|AAAA|AAAA 

 

This is pretty straightforward scripted output.  You are actually only running a single generation task, but it looks like you've got two tasks running at once.  The script for this would look like this:

 

 

script myScript1

Repeat forever 

Repeat until scriptTrigger0 

Generate wvfmA     

end repeat 

Generate wvfmB     

end repeat 

end script

 

There are some limitations on the minimum waveform size based on the frequency you're running your sample clock, but overall, this is a method to accomplish what you're asking for without having two generation sessions running at once, which we do not support on NI-HSDIO devices. 

 

Hope that helps,

 

Keith Shapiro

National Instruments R&D 

 

0 Kudos
Message 5 of 6
(3,923 Views)

Thank you Kyle and Keith,

 

 

I am familiar with the scripted case - having tried it with VB6 sometime ago.

 

 

 Good to know that scripting is the only option.

 

 

Anand

 

 

Message Edited by ajog on 05-06-2010 08:30 PM
0 Kudos
Message 6 of 6
(3,911 Views)