Hello Kenny,
After looking at your block diagram, I have a few suggestions and a couple things to point out.
As for timing your analog input, a couple things come to mind (if I understand what you are trying to do). You could use a local variable of your digital output data, feed it into a shift register, and each iteration of your ai loop, compare the current value to the previous value of the local variable. Then, put your DAQmx Read in a case structure, and only do the read if the value has changed.
Another thing you could try is simply to let the ai control the timing. If you wanted it to read and display data every 5 seconds, and you are sampling at 4 Samples per second, just put 20 for the input of the DAQmx Read VI (you will have to make the DAQmx Read a N Channel read) for number of sample to acquire. If you do that, the Read will wait until it has all 20 samples before it returns. 20 samples at 4 samples per second would be 5 seconds.
A couple LabVIEW suggestions. First, NI-DAQmx Base is not multi-thread safe. So, when you have multiple NI-DAQmx Base tasks, it is recommended that you force single-threaded execution by passing along the error cluster in sequentially (see attached picture for example) to all NI-DAQmx Base VIs. Secondly, I noticed that your loop with the wait in it had no external data dependencies. This means that the loop will execute whenever it can, not necessarily after stuff to the left or before stuff to the right. It is a good idea to use data dependencies, by connecting it with wires. Hope this helps.
-Alan A.