03-09-2010 05:39 AM
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.
03-12-2010 08:24 AM
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
03-15-2010 08:52 AM
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
03-15-2010 11:37 AM
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
03-16-2010 06:21 AM
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.