I am having sync issues with my code. I wish to generate a certain number of samples - these correspond to raster scanning mirror positions. However, I also have a optical switch (PCI-6731) and camera (PCIe-1427) in the code. For each mirror position, I want to switch my optical switch and capture a camera frame. Seems simple enough but in practice it's proving frustrating!!
In an effort to sync everything, I outputted the CO.Pulse.Term to (1) RTSI0 channel (camera) and to (2) Ctr0Out which my switch is connected to. I have used the IMAQ Generate Pulse.vi to trigger the camera. I know that my board does not have an RTSI frame trigger so in MAX, I have set Trigger Mode to 1 (Internal), Trigger Source to CC1, I have unticked the CC Lines source box and CC1 is set to External trigger 0. I connected my two boards by an RTSI cable. Is this correct??? Or do I have to do it in hardware and wire the DAQ output to my frame grabber's TTL trigger lines??
Originally, I was grabbing triggered images and putting them in a folder but they were completely out of sync with the switch and took a long time to capture. I decided to grab the frames and save them to .avi instead and then split the frames afterwards. But I am still having sync issues. I tried to put in the IMAQ ConfigureTrigger3.vi to configure the action to trigger each buffer but I kept getting timeout errors so I removed it. The .avi capture is within a while loop, set to stop when is equal to the number of original samples (i.e. positions) I set. (Also when I run the code the buffer number that I output from IMAQ Grab Acquire.vi in the while loop is greater than the number of samples used to control the loop??)
As I have a line-scan camera, I am setting the number of lines in each frame capture to be very much less than the switching time of the camera. I am also factoring in the switching time of the camera. I really don't know what to try next .. has anyone any ideas?? Please see the attached code.