Place your acquisition routine in a while loop. Control the while loop by OR-ing 2 conditions:
1. Read the elapsed time (can use difference of Tick Count which is initialized before the while loop to another one feeding a Shift Register). The elapsed time will be in ms, so you'll have to do the math for your max duration (5 min = 300 000 ms) Or better, you can use the Get Date / Time string, convert to seconds and do that math (1000 less ;o)
2. Count the number of samples taken and verify if greater than your desired value.
Feed the output or the OR to the conditional terminal (square with red dot). Change it to STOP IF TRUE.
Try it.
JLV
(PS: try lower case letters when writing your question. Thanks)