I'm using a DAQ USB-6251 for generating a raster scan with two galvo mirrors and read the PMT signal to form an image in a confocal microscope setup.
Building the waveform and writing it to two multiple channels (X and Y) seems to work properly up to a decent speed. I can most likely scan a 500x500 pixel area at 50kHz.
The problem comes when trying to sync the writing of the galvos waveform and the PMT reading.
I'm using the onboard clock to sync write and read, but it seems that I can't scan over a certain (very low frequency). For instance, if I scan a 100x100 pixel square and read 5 PMT samples per points, average them and put them into a matrix, everything works up to 3kHz. If I put 4kHz, the raster reaches the last line before all the lines of the matrix are filled with values and it restarts from the top. The number of times it restarts from top rises as I rise the scan frequency. Nothing changes if I change the number of PMT samples to average for each point.
There might be a buffering issue or something I can't really figure out.
Any help would be very appreciated!
I've just noticed one thing: over a certain sample rate (kHz), the elapsed time function, always reports the same duration of the entire scan(s), in seconds, regardless of the sample rate set. The higher the sample rate, the higher the speed, but also the higher the number of times the scan restarts from the top, but the overall time is always the same, around 7,8 seconds.