Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Pb starting continuous digital output with external clock

Hello, 

in order to start a continuous generation with a PXI-6533, I'm trying to do the following sequence to write the 4 first bits contained in DataTable:

- Create task

- CreateDOChan ("Dev4/port 2")

- SetWriteAttribute(RegenMode, DoNotAllowRegen)

- CfgSampClkTiming("Dev4/PFI3", 1000000, Rising, ContSamps, 32)

- WriteDigitalLines(4, FALSE, -1, GroupByScanNumber, DataTable, NULL, NULL)

- StartTask

 

After that, a loop continuously writes data.

Pb: on the WriteDigitalLines call, before the start, I get an error telling me that there is an insufficient buffer size. I've tried different values without success: Why and how can I correct this ?

NB: at that time, no clock is received on PFI3.

 

Thanks for your help.

 

0 Kudos
Message 1 of 5
(3,440 Views)

I'm not familiar with the syntax for C function calls.  (I know C, I just don't know the order or meaning of the function arguments).

 

It appears that you want a 1 million sample buffer that requires continuous feeding.

 

1. What specific error # & message do you get?

2. How many samples are you writing with your call to WriteDigitalLines?  Only 4?  I presume DataTable is a pointer to an "array"

of data, but don't see anything but the # 4 that might tell WriteDigitalLines how many samples to write.

3. It appears your sample clock is coming in on PFI3.  How fast is it?

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 5
(3,415 Views)

Hello Kevin,

I want to generate continuous data at 1Mhz, sync on an external clock arriving on PFI3, but this clock is not regular and not continuous, it can grow up to 1Mhz but can also be stopped for a while.

DataTable is a pointer to the data array, and initially, I want to feed the buffer with only 4 samples as I don't know yet the value of the next samples to write.

Thanks for your interest.

Stephan

0 Kudos
Message 3 of 5
(3,398 Views)

Let me just make sure we're talking the same lingo.  When you say "sync on" the external clock, do you mean to generate one new digital port update per active edge at PFI3?  So that when the external clock stops running for a while, no updates are made to the digital output at all?

 

I further suppose that this issue is part of the larger system described in this post.  I responded to this one because at least the "insufficient buffer" error sounds like a solvable problem.  Unfortunately, the rest of your app sounds like more than I can confidently predict to be possible.

 

What is the specific error # and/or text that goes with your insufficient buffer size error?  How have you tried different values of buffer size and what sizes have you tried?

 

As the your larger system, I am doubtful you'll be able to:

A. Pre-write 4 digital values in advance of receiving an external clock that runs at up to 1 MHz

B. Detect the presence of active clock edges (meaning that 1 of the 4 values was already output).

C. Use normal OS event signaling of one kind or another to react to that event when it happens

D. (Retrieve and?) write the next bunch of digital values to the output buffer before the external

clock has caused the task to output the remaining 3 pre-written values. 

 

So steps B,C, and D may need to happen within about 3 microseconds if the external clock is in

fact at 1 MHz.  I think it'd be doubtful you could do step D alone that quickly.  I'm extremely

doubtful you can get B&C to happen even nearly that fast.

 

There may be a different approach or workaround that someone else can speak to, but I'm afraid

that I for one don't have any better ideas.

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 5
(3,391 Views)

Yes, you've got it: no updates are made to the digital output when the external clock stops running for a while

And yes, this is part of the larger system described in another post.

In fact, I've got a 28µs delay between a trigger line assertion and the clock first front, so, preloading 4 values let me 32µs to fill the buffer with other data.

But even with that extra time and even if I could preload only 4 values, I've done many many tests, and I'm afraid your feeling is right: it's simply impossible to do.

It sounds more like using an FPGA.

I'm gonna search another way to solve this issue.

Anyway, thanks for taking time to answer Kevin.

0 Kudos
Message 5 of 5
(3,373 Views)