Or, you could use a loop in $tFirstScan. The attached screen shot shows the following
Rung 1: Set $tFirstScan's .TimeSlice to 0 to make sure the WHILE loop "yields" every scan
Rung 2: If the IP Address is already set correctly, skip the loop and go to any other logic you might want to add to this task in the future (BELOW the LABEL) (I used a hexadecimal constant here - it's a little closer to an IP Address than a pure decimal value)
Rung 3: The UNCONDITIONAL WHILE that runs the ASYNCHRONOUS SETUPIP instruction until it finishes successfully or in error
Rung 4: The SETUPIP that will run just once (see input leg w/triangle which designates edge-triggered)
Rung 5: Upon completion, either C200 (success) or C201 (error) will be set. Once either one is set, exit the WHILE/WEND loop.
Rung 6: WEND - The end of our WHILE loop
Rung 7: LABEL - where we jump to if our IP Address was already initialized properly
Rung 8: EXIT the task (this isn't necessary, but I stuck it here to emphasize that this system task EXITs once it reaches the bottom, regardless of whether the EXIT instruction exists or not)EDIT: do NOT use EXIT - that can only be used in a PROGRAM code-block
