Basic PLC question that challenges the best:

greenlantern

Member
Join Date
Apr 2021
Location
tx
Posts
4
Create ladder logic program to count 4 on pulses (not using a counter) and then turn the output on if the on pulse input signal can look like the following:

image001.jpg
 
Last edited:
Welcome to the forum, I think you would be best to post this in the main Q&A, however, a few questions. It says must be on for 50ms but it also says can go on/off between those times, this does not make real sense. if it is on for 50ms and off for 100ms no problem but like the drawing the second pulse is switching on/off multiple time is this going to be classed as an on pulse ?.
I think there is room for clarity, for example:
50ms pulse is classed as a count and a multiple pulse within 50ms is also classed as 1 count, or is the second multiple pulse not counted because it is not on for a min of 50ms.
 
Welcome to the forum, I think you would be best to post this in the main Q&A, however, a few questions. It says must be on for 50ms but it also says can go on/off between those times, this does not make real sense. if it is on for 50ms and off for 100ms no problem but like the drawing the second pulse is switching on/off multiple time is this going to be classed as an on pulse ?.
I think there is room for clarity, for example:
50ms pulse is classed as a count and a multiple pulse within 50ms is also classed as 1 count, or is the second multiple pulse not counted because it is not on for a min of 50ms.

Some clarification: The on-time signal will come in at 40-60ms not less than 40ms and no more than 60ms. Therefore just count the on-time signal(1's) that have time lengths between 40-60ms and ignore any other. Then when your program logic counts to four pulses(1's) then turn output on between 50-100ms.
 


Assumptions

  1. "40-60ms" means valid input pulses are 1 continuously for at least 40ms and for no more than 60ms
    1. If the input is 1 on two successive scans, then it is assumed that it was on continuously between those two scans.
  2. The output comes on immediately after the fourth 40-60ms pulse (as defined above) returns to 0, and the output stays on for ~75ms (which is between 50ms and 100ms).
Program description

  • S:35 is the duration of the previous scan, measured in periods of 0.1ms i.e. ticks of the 10kHz free-running clock.
  • So 400ticks (N7:4), 600ticks (N7:5), and 750ticks (N7:5) approximate 40ms, 60ms, and 75ms.
  • N7:0 is the duration of a continuous 1 value of discrete input I:0.0/0
    • The second branch of Rung 0002 MOVes a value of 0 into N7:0 on any scan where I:0.0/0 is 0
    • Rung 0001 increments N7:0 by the scan duration (S:35) on any scan where I:0.0/0 is 1 and N7:0 does not exceed 600 (60.0ms).
  • N7:1 is the number of valid input pulses detected.
    • The first branch of Rung 0002 detects the end of a valid pulse and increments N7:1
    • N.B. N7:0 can only be greater than 0 when input I:0.0/0 is 0 for one scan at a time.
    • N.B. N7:1 can only be 4 for one scan at a time.
  • Rung 0003 detects the scan when N7:1 is between 400-600ticks (40-60ms) and the input values changes from 1 to 0
    • I.e. the scan when the end of the fourth valid pulse is detected on Rung 0002.
    • Rung 0003 puts a value of 750 (ticks, equivalent to ~75ms) into N7:3
  • Rung 0004 detects when N7:3 is non-negative; when that is detected, Rung 0004 does two things
    • It assigns a 1 discrete output O:0.0/0
      • Otherwise (i.e. when N7:3 is negative) it assigns a 0 to the output
    • It decrements N7:3 by the scan duration (S:35)
 

This is the correct answer.
What is this obsession with ladder logic anyway?

I get that IL translates well to LAD, but really can’t see the point of ladder in 2020? As soon as you process anything other than bits, the ladder becomes obsolete?

Have you heard of FBD or ST? :confused:
 
This is the correct answer.
What is this obsession with ladder logic anyway?

I get that IL translates well to LAD, but really can’t see the point of ladder in 2020? As soon as you process anything other than bits, the ladder becomes obsolete?

Have you heard of FBD or ST? :confused:

Just the (vague...) resemblance to electrical schematics, and it’s (maybe?) easier for non-programmers.

I prefer ST. Graphical languages are pretty much universally worse than text languages.

Also...we may have rolled over to 2021 now. I think it happened back around January.
 
What is this obsession with ladder logic anyway?


... ladder becomes obsolete?


... Have you heard of FBD or ST?



Haha very funny, such naivete. Please stop trolling.



I have a saying: "the only things I don't like about C (or Matlab or C# or Java or Javascript or Perl or Python or etc.) are their proponents." Do I really have to add as underpowered, arcane and boring a language as ST to that list?
 

Similar Topics

What ladder logic is required to have an HMI button that gives output when you push it then removes that output when you push it again? For...
Replies
9
Views
3,804
I will apologize in advance for this question. In a PLC scan I understand the inputs are read, then the PLC carries out a scan out the logic and...
Replies
11
Views
4,090
:banghead: I am a newbie trying PSIM and am facing difficulty with a counter in the Batch program. I observe that there is significance in the...
Replies
2
Views
2,164
Hello Everyone, I am brand new to PLC's (learned they even existed 3 days ago) and have gone through the tutorial on this site. I am a little...
Replies
4
Views
5,203
Please,: Explain the meaning of Scan cycle in a PLC when it is running a program?
Replies
2
Views
3,199
Back
Top Bottom