Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: RBPLC on September 30, 2019, 09:48:43 PM

Title: $On
Post by: RBPLC on September 30, 2019, 09:48:43 PM
Can someone tell me what the purpose of the $On contact is for. Being relatively new to PLC programming I don't exactly get why this command is necessary. I see this with other hardware (Mitsubishi has the equivalent M8000 bit). In DMD not all outputs require the $On but some do. When is $On required and why?   
Title: Re: $On
Post by: franji1 on September 30, 2019, 10:35:05 PM
Use it in a NO contact to drive an instruction that you always want to run.  Or in a NC contact to drive a 0 to an input leg (say the JOG leg in RAMPSOAK instruction).
Title: Re: $On
Post by: RBPLC on September 30, 2019, 10:55:47 PM
I know it's used to always allow an instruction to run but why is it necessary? For example, why can't I just have output Y0 connected directly to the left power rail?
Title: Re: $On
Post by: franji1 on September 30, 2019, 10:59:49 PM
I know it's used to always allow an instruction to run but why is it necessary? For example, why can't I just have output Y0 connected directly to the left power rail?

You can when it is the first output after a "block" instruction, e.g. the first rung, or the first rung after a FOR, or the first rung after a SG.

The PLC does not know what a "rung" is.  It uses a push-down-stack for the Boolean logic.  Hence, if there is no input contacts, the OUT coil looks at the "top of stack".  Hence, if it wasn't one of the previous mentioned "beginning of block" instructions, it is based on the ToS of the previous rung (or possible a rung before THAT).