Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Digital Output without Regeneration

Hello,

In C, with a PXI-6533, I need to output a fast changing 16 bits data on a single line each time I receive a trigger, but I don't when I will receive the trigger.

The clock is external (about 256kHz) and is provided by the equipment that sends the trigger. The delay between the trigger front pulse and the first clock pulse is 28 microseconds only, and only 16 clock pulses are sent at that time, to get the 16 bits data (no continuous clock).

Here is the challenge: the data I have to send need to be up to date, therefore, I can't write it in advance because I don't know when I will be asked to provide it and the data could be then outdated. So, I only have 28µsec to get the last data value from memory (a shared variable) and write it on the digital line.

 

I think it will be a miracle if I can do such a thing with the 6533, but one thing that can help is that the 4 first bits are always 0, so I can preload 4 bits to have more time to write the 12 other bits.

 

Here are my questions:

1. I'm trying to do the following sequence, in order to write the first 4 bits (ConstDataTable):

- Create task

- CreateDOChan ("Dev4/port 2")

- SetWriteAttribute(RegenMode, DoNotAllowRegen)

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

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

- StartTask

 

At that time, no data is generated since no clock is received on PFI3.

But on the Write call, before the start, I get an error telling me that there is an insufficient buffer size : Why and how can I correct this ?

 

2. Besides the task described up, I'm creating another task to write the 12 changing bits (VarDataTable). I'm using DetectChange and RegisterEvent to call a callback when the trigger is received on Dev4/port0/line0. In this callback I'm calling:

- WriteDigitalLines(12, FALSE, -1, GroupByScanNumber, VarDataTable, NULL, NULL)

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

to write the last 12 bits as demanded, and to already load the next word by writing the first 4 constant bits of the next 16 bits data

 

I'm not sure yet it will work, but in case it doesn't, does someone has a better idea to solve my problem (sending uptodate data on demand, using external clock and trigger) ?

 

Thank you very much for your contribution.

Best regards

Stephan

 

 

 

0 Kudos
Message 1 of 1
(2,895 Views)