Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: DLTimmons on October 21, 2015, 03:44:11 PM

Title: SETUPIP warning
Post by: DLTimmons on October 21, 2015, 03:44:11 PM
Got to a good point to update to 1.4 I don't like doing update in the middle of a major project.I now get an warning when I try to set my IP in first scan this worked in 1.2

I get "W453 Fully-asynchronous instruction (SETUPIP) used in edge-enabled task (ENTASK $tFirstScan)
Title: Re: SETUPIP warning
Post by: plcnut on October 21, 2015, 04:14:11 PM
The proper method would be to use your conditional contact to RUN a program with the SETUPIP task in it that uses the success bit to HALT the program block.

The idea is, that the SETUPIP 'could' take more than one scan to complete, so when you use it in a task that is only on for one scan, you 'may' not be giving it a chance to complete.
Title: Re: SETUPIP warning
Post by: franji1 on October 21, 2015, 04:44:51 PM
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  ::)
Title: Re: SETUPIP warning
Post by: franji1 on October 21, 2015, 05:17:06 PM
I did verify that SETUPIP does complete immediately (i.e. the WHILE loop only runs once, C200 is turning on immediately by the SETUPIP instruction).

You can IGNORE SPECIFIC Program Check rule violations by right clicking on the rule violation in the Output Window.  I would recommend just ignoring
W453 Fully-asynchronous instruction (SETUPIP) used in edge-enabled task (ENTASK $tFirstScan)
just in that specific rung, $tFirstScan#1

Ignoring Program Check Rules was a feature added in 1.4.  It is useful when you know your logic isn't "pure", but it does what you need it to do, so quit bothering me about it.  This information gets downloaded as part of your project, so you don't have to keep "ignoring" specific violations again and again.  To manage your project's set of Ignored Program Check Rules, go to the Tools->Ignored Program Check Rules... menu item
Title: Re: SETUPIP warning
Post by: BobO on October 21, 2015, 05:25:59 PM
SETUPIP will normally complete immediately, but could theoretically be delayed if the driver is in use by another instruction. It's safe-ish to do the way you are, but technically wrong, hence the warning.
Title: Re: SETUPIP warning
Post by: DLTimmons on October 22, 2015, 09:52:17 AM
Thanks

I put that rung in firstscan in case I need to swap CPU then I don't have to worry with setting the IP it does it for me ;D