I have a very simple program to send signal to DAQ. I have a case structure to send different types of signal to the daq. If the case is '0' it sends out a DC signal. If the case is '1' or '2' it sends out a square wave with different amplitude. I am able to do all of the above as shown in my code but I would like to send the square waves in case "1" and "2" for 5 seconds. In my code, when I trigger my condition to switch to case "1" or "2", it will send a square wave immediately for under a second and switch back to the '0' case. I want to send the square waves in case "1" and "2" for 5 seconds. However, I just couldn't figure out how to accomplish this. Will appreciate for any suggestions!