Greetings rigicon ...
I saw the [ONS]online behaving strange. I need the state to be predictable.
actually, the ONS is "predictable" – as long as you do things its own way ...
judging from what you've posted so far, my guess is that you're somewhat confused with how the processor's "prescan" operation affects things each time that the system first enters the "go to run" state ... trust me, you are NOT alone in that confusion ...
let's take a look (for better or for worse) at the information available from the RSLogix5000 menu's Help / Instruction Help area for the ONS instruction ... let's specifically concentrate on the part about "prescan" ...
Prescan: The storage bit is set to prevent an invalid trigger during the first scan. The rung condition out is set to false.
the most confusing issue here is that the author used the same word ("set") to mean two different things ... first let's slightly abridge that same statement – eliminating that troublesome word "set" completely ...
Prescan: The storage bit is WRITTEN TO A ONE STATUS to prevent an invalid trigger during the first scan. The rung condition OF THE ONS WILL BE EVALUATED AS FALSE.
that's a little better – now here's another swing at the same information again – this time in a slightly less ambiguous style ...
each time the system first goes into the Run Mode, a "prescan" operation takes place ... during this prescan operation, the system automatically writes a status of ONE into the ONS storage bit ... this has the effect of telling the ONS that it has already been "fired" ... so – even if the rung condition leading into the ONS happens to be TRUE when the rung is first scanned (note that's AFTER the prescan), then the ONS will NOT "fire" ... specifically, the rung condition leading into the ONS must now be scanned as FALSE (at least once) and then subsequently be scanned as TRUE before the ONS will "fire" normally ...
the best way to get a handle on how this works is to use a SPARE system and set up a couple of test rungs ... then experiment by going in and out of the Run mode until you understand the patterns ...
I've attached a suggested "test" program below ... NOTE: the figure below is NOT intended to be a "fix" for your problem ... in particular, the first rung is NOT normally used in most programs ... but ... if you understand how the S:FS (Status: First Scan) bit is being used to "unlatch" (WRITE A ZERO) into the ONS status bit – AFTER the prescan – but BEFORE the processor first scans the ONS, then you'll have come a long way toward understanding exactly what goes on under the hood of the ONS instruction ...
now then ... if you have any further questions about this subject, please post the program that's confusing you, and we'll try our best to straighten everything out ...
as for your other questions:
Under edit what is "Clear all instruction defaults" ?
this feature is mostly for "power user" programming people ... suppose that you use a certain type of instruction quite often ... (let's use a TON timer as a simple example) ... suppose that most of the TON timers that you use have a certain Preset value ... (let's say the Preset is usually 1000 as a simple example) ... so ... enter your first TON – and the 1000 preset – and then highlight the TON with your cursor ... now go to Edit / Save Instruction Defaults and confirm the operation ...
now whenever you enter a TON, the 1000 Preset value will automatically be entered for you ... (in other words, you have "saved" the "default" settings for any TON timers that you subsequently enter into your program ...
now suppose that you're finished with the 1000 Preset TON timers ... you could highlight a TON – and then go to Edit / Clear Instruction Defaults and confirm the operation ... this releases the defaults for the TON ...
and finally ... suppose that you have already set up other instructions besides TONs with their own defaults ... if you want to clear the slate completely, go to Edit / Clear All Instruction Defaults and confirm the operation ... this SHOULD put everything back to square one ...
And when you are online and save the program a warning that to upload tag values appears I normally say yes?
I recommend that my students always say "yes" to this one ... (and frankly I think that the word "Warning" is a little too strong for what's going on here) ... the software is basically just asking for your permission to extract all of the data values stored in your tags – and to then save those values along with the rest of the program ...
now there ARE some instances where you MIGHT want to say "no" – but that would be the subject for another post ...
hope this helps ...