I'm using DAQmx with Python on a USB 6363.
I currently have AO an AI tasks synchronized as per the example code, "SynchAI-AO.c".
However I'd like to be able to pause the task every N samples so I can go and do some other stuff, then restart again later when that other stuff is done.
I started with something like the following function in a PyDAQmx task object:
def setEveryN(self, N):
""" Change how often the callback is called """
self.lenToRead = N
self.AutoRegisterEveryNSamplesEvent(pd.DAQmx_Val_Acquired_Into_Buffer, N, 0)
if N != len(self.data):
print('Configuring pause trigger')
self.SetPauseTrigType(pd.DAQmx_Val_DigLvl)
self.SetDigLvlPauseTrigSrc(....????????)
All the discussion about triggering is about physical wires, so I figured I could set the pause trigger to be when the AOTask has done N samples, but then I got very confused about what terminal and signal to connect, and I have no clue how to UNPause (ie restart) the sampling again with software control.
Can someone please provide some pseudo code, or actual C or Python code for this? I don't have LabView, so I'm unable to interpret VI images.
Otherwise, I think I may have to manually re-arm the device every N samples.
(In most circumstances, N is actually 1, so I want to do something in between each DAQ sample).
It's conceivable I do the extra stuff within the EveryN callback, but this other stuff is slow, so I'd have to set DAQ sample clock to something very slow, which is probably fine, but then it's a matter of trying to find a suitable rate, which means some hand-tuning for overall timing. I'd rather everything be sequential and serialized/synchronized on the same thread.
Thanks