Help - Search - Members - Calendar
Full Version: First scan in ML1500
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Sergei Troizky
Is there a way?
Ken Moore
What difference does it make?
The first scan is the same either way.
Sergei Troizky
QUOTE(Ken Moore @ Nov 5 2008, 01:50 PM) [snapback]75394[/snapback]

What difference does it make?
The first scan is the same either way.

Not really.
In lack of online editing the PLC restarts every time after downloading with even minor changes.
However, I would like to avoid in such case some routines specific for power up start.
b_carlton
I'm not certain if this would work but ...

Establish a rung which reads an input directly tied to the power status but which will turn off quickly if the power turns off. In many cases the hold-up of the Logix power supply will provide at least a couple of scans after this input has turned off. Use the ON status to Latch a bit, use the OFF status to unlatch the bit.

Now, in your program before the monitoring rung mentioned above condition 'First Scan' with the state of this latch. You should have enough information as to whether this was a 'power up' or just a 'return to run'
OkiePC
In a situation like yours, I would find a spare bit to inhibit the actions that are driven by the first scan bit. In your offline file, set the bit, and have an unconditional OTU for your new bit at the end of the program. Then when you download, the first scan bit will be true for the first scan, your spare "inhibit 1st scan" bit will also be true, and you can customize the rungs driven by the 1st scan bit that you want inhibited by adding XIO "inhibit 1st scan" in series on those rungs.
Sergei Troizky
b_carlton and OkiePC,
Thank you for suggestions.
Both ideas definitely will work.
The point is that we do not want neither additional hardware nor specific human actions to be involved.

The PLC has an option to download from memory cassete on power up.
I have no experience with this option and do not work with AB often.
What if I activate this option without the cassete installed.
Will it fatally fault the PLC or just activate a specific error bit (which will be what I need)?
OkiePC
I don't believe you can lie to the CPU about the existence of a memory card, but I could be wrong...

Have a look at the Instruction Set Reference Manual for Micrologix 1200 and 1500 Controllers. It is Publication 1762-RM001E.

You may want to experiment with S:1/9 "Start-Up Protection Fault". If you set S:1/9, when the controller powers up, it will run your fault routine first, before executing the main routine. What is not clear in the book, is whether this will take place when simply switching modes, or if it only happens on power-up. I don't have a 1500 to play with, so I can't say for sure.

Also, another possiblity is S:36/10. It will tell you when a protected data table file is overwritten by a program transfer. You could perhaps create a data table file and assign protection to it in order to utilize this status bit for your purposes. I believe the user program would have to intentionally modify the protected data in order to generate a mismatch and set the bit S:36/10. If the offline file and the SLC data tables are an exact match, then S:36/10 will not be set, but if you can, in ladder logic, ensure that the value of a register in the SLC data file did not match the offline copy (for example MOV or ADD the free running clock value to a group of protected registers) then you could use S:36/10 to detect that programmatically. S:36/10 should then always be true only following a program transfer, but not during a power cycle.

Paul


paulengr
QUOTE(b_carlton @ Nov 5 2008, 02:31 PM) [snapback]75396[/snapback]

I'm not certain if this would work but ...

Establish a rung which reads an input directly tied to the power status but which will turn off quickly if the power turns off. In many cases the hold-up of the Logix power supply will provide at least a couple of scans after this input has turned off. Use the ON status to Latch a bit, use the OFF status to unlatch the bit.

Now, in your program before the monitoring rung mentioned above condition 'First Scan' with the state of this latch. You should have enough information as to whether this was a 'power up' or just a 'return to run'


This works but relies on timing somewhat. You can do something simpler externally and make it not sensitive to timing.

Put a small "ice cube" style relay with both NO and NC contacts on it somewhere in the cabinet. Wire the relay so that one of your PLC outputs controls the relay. In addition, wire up the PLC power source and the NO contact in parallel with the PLC output so that once the PLC output goes on, the relay latches and will not unlatch until power is removed from the PLC.. Connect the second (NC) contact to a PLC input. If this is confusing, open a book and look at how to wire discrete (non-PLC controlled) start/stop buttons with a starter since the logic is the same except you don't have a stop button.

Now when you restart, when the first scan bit is true, check the relay input. If it is true (1), then this is a power up (cold start) condition. Otherwise, it is a warm start (programming) condition. The next rung of logic should set the output bit on.

Since the relay operates independently of the PLC, it will ride through programming changes but not through power loss conditions.
Sergei Troizky
Thank you, paulengr,
this is exactly what I am doing now- activating relay by PLC with following self-retaining from the power source.
I was just curious whether it is possible to be done without extra hardware.
TWControls
A PLC can execute several scans...or at least one...after the power is lost.

If you can connect the PLC power supply to a spare input, you should be able to do it without any additional relays. Simply put a rung in your code that if that input is not seen, you latch a internal bit. Then on power up look for the bit. If the bit is made, it is a true power up, execute power up routine and unlatch the bit. If the bit is not made, it is a program to run mode transition. Execute program to run mode routine and unlatch bit.

We had to manage to send a message on power down one project. We found we could use this method to successfully detect a power loss and execute the message before the PLC went out.
paulengr
QUOTE(TWControls @ Nov 7 2008, 04:57 PM) [snapback]75521[/snapback]

A PLC can execute several scans...or at least one...after the power is lost.


Only partly true. I believe Ron posted something about this as one of his quizzes.

It is highly dependent on the PLC model even with all AB processors. I don't remember which is which but I definitely remember that the CLX will be scanning before and after I/O is really up and running. The PLC-5 on the other hand I believe goes down very quickly, even if you have a low voltage condition that gets anywhere close to 20% below nominal. I'm not sure at all with Micrologix or SLC.

Hence the reason that I defer to more "reliable" methods (not that adding a mechanical relay really falls in the category of reliable hardware!)

TWControls
I know it works with the 1500 Sergei asked about, but your right, you won't find it in the manual
Sergei Troizky
This is solved thanks to OkiePC.
The User Fault Routine executes only on power up start in Run mode and does not execute on mode alteration already under power.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.