Hi guys,
I have a program that does the following:
1) Generate a pulstrain on an AO PCI board and send it through RTSI0
of that board
2) Perform an AO task on this board that does multiple writes (a XY
scan of a piezo stage) synced up by the previous counter (the one
going to RTSI0). Voltage data for 2 channels in the task is provided
in an array of precalculated values and will be written in a timed
way.
3) Perform a photon count with a counter on another board
This photon counter task has a pausetrigger which only makes it
count when a second counter on the second board generates "high". This
second counter is actually triggered by RTSI0 after which it delays
(to allow the piezo to complete movement) and then outputs high for a
set number of miliseconds.
The scanning can take up to 5 minutes. So it is not an option to have
everything in the main thread. I want the UI to update an image with
the photon count data continuously.
I saw the multiple code examples using the async model with callbacks
for reading. However, as I understand the writing would also lock up
the UI.
What I want to know is if I can do something like this:
in the main Program:
-pulsetraintask.start()
-Start the read task
-Start the write task
-Beginwritemultiplesamples with reference to a callback that
contains the endwrite
-Beginread with a reference to a callback that contains endread and
a new call to the callback (like in all the examples provided by NI)
-A while loop continually updating my image while the write.isdone
is not yet true (because this is that task that takes loads of time).
Will everything really run in sync? Will I miss any samples on any of
the tasks in this way? Is it possible for anybody to provide a minimal
code sample for this? Or for anyone to provide a good alternative?
I'm going to try for myself today but I am really confused on some of
the concepts involved...