PLC Program to Measure Unknown Frequency


This is a PLC Program to Measure Unknown Frequency.

Problem Description

Measure and display unknown frequency. Implement this in PLC using Ladder Diagram programming language.

Problem Solution
  • Define an address to which Unknown frequency is given as an input.
  • This address is set to 1 whenever a positive pulse is detected otherwise remain 0.
  • And Frequency may be defined as number of cycles per second. This cycle includes three terms, high (positive) pulse, zero and negative pulse.
  • Frequency input detects positive pulses.
  • Give this input to Up Counter to determine the number of positive pulses per second with unknown frequency.
  • Use timer to stop the counter from counting after 1sec.
  • Reset counter after measuring of frequency is done.
  • However to define a particular Amplitude signals, Limit instruction may be useful.
PLC Program

Here is PLC program to Measure Unknown Frequency, along with program explanation and run time test cases.

List of Inputs and Outputs
 B3:0/0	 = Latching Bit					(Bit)
 I:1/0	 = Unknown frequency input			(Input)
 I:1/14	 = Start PB					(Input)
 I:1/15	 = Stop PB and reset counter			(Input)
 T4:1	 = 1sec time delay				(Timer)
 C5:0	 = Up counter to increment each positive pulse	(Counter)
 O:6	 = Display address				(Output)
 TOD	 = Hex to BCD conversion		       (Compute)
 T4:0/DN = Stop counting				(Timer)
-(RES)-	 = Reset Counter coil				(Output)

Ladder Diagram to measure unknown frequencyplc-program-measure-unknown-frequency-01

Program Description
  • Latching bit is connected in series with all the rungs except -(RES)- in order to master stop the measuring process.
  • Whenever it is required to measure the unknown frequency, I:1/14 Start PB is pressed which activates the Latching rung hence timer is started and counter also allows the positive pulses to increment accumulator value.
  • This is stopped by T4:0/DN bit when 1sec is over.
  • Stop PB I:1/15 input resets counter and timer both.
  • Accumulator value is converted into corresponding BCD number and fed to Display with address O:6.
Runtime Test Cases

When it was tested using timer, Time Base = O.1 and Preset = 0.5 replacing I:1/0 with Timer DN bit.plc-program-measure-unknown-frequency-02


Sanfoundry Global Education & Learning Series – PLC Algorithms.
To practice all PLC programs, here is complete set of 100+ PLC Problems and Solutions.

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.