y PCI-1409 and IMAQ function) at accurately (hardware) specified time intervals and then 2)read these values from the file, again at an accurately known rate (real time) in order to synchronise with the video being played through a PCI-1409 frame grabber ?Synchronizing data from a serial port is difficult. That part may not be possible to synchronize accurately. Synchronizing the analog and video data wouldn't be too bad, though. You could get them synchronized within a couple of frames.
For acquisition, set up buffers for the analog and video, with the analog running at the same rate as the video. These should be a few seconds long or more, and the same size. You can start them simultaneously using the RTSI connection. These should run continuously while you wait for your trigger. Once your trigger occurs, go back to your buffers and figure out what index the trigger occurred at. Start logging your analog data from that point on by reading it from the buffer and writing it to a spreadsheet file. Abou
t the best you will be able to do with the serial port is continuously monitor it for changes and update a variable that is written to your file whenever it changes. It won't be synchronous, but it will be fairly close.
For playback, do the video acquisition loop again. In the meanwhile, fill an analog buffer from your spreadsheet file. If you can, read the whole thing, but make sure you always have a few seconds of data ready in memory. Once your video trigger occurs, go back and figure out what the index was. The difference between the start index and the current index gives you the offset for your analog data. You can use a loop to check the current video index, display the image and the appropriate analog data.
Bruce
Bruce Ammons
Ammons Engineering