Count the length of Pulse signal

Steve Cheung

Member
Join Date
Jan 2004
Location
sgp
Posts
12
Dear All,

Any one can help my problem?

We have a project that need to count the pulse of the Flasher Relay at QC production line.

For example the pulse measure: ON is about 0.378 second. The pulse OFF is about 0.745 second.
The Pulse voltage is 0 - 10VDC.
I was choose the FX2N PLC using timer T246 1 ms timer to measure the pulse. It work, but seem it not precision.

The measure pulse always more or sometime less. It's make me confuse, is it because of the Scan time or not, but the program is only 100 address more.

For example the machine show 0.377s, but our FX2N measure 0.379s or sometime 0.376s, always change, not stable. (The existing machine have it PC base system that show the pulse count. Our FX2N is additional system is compare to measure the existing PC base system.)

Anyone that can give me a smart solution in a system or ladder sample?

Thank you & I waiting for you reply early.

Best regards
Steve
 
It looks like your variation is about +/-2 milliseconds. That's about as good as you can do with a PLC based timer. I don't know any specifics about the plc you have but you might want to see if you can configure one of the inputs as a high-speed interrupt. If the plc also has a high resolution free-running clock you might be able to read that and do a time delta.
If you are looking for sub-millisecond resolution you may be better off with a hardware solution or a low cost single board computer. These have the tools to do high speed pulse measurement.

Hope this helps.
Keith
 
Not estable. Use interface signals, frequency to convert other escale frequency it more high.
It for read 2, 3 precision frequency? Find product have capture frequency input and tunning step(s) frequency out (jump) or pay project manufacturer instruments.
 
Hi Steve,

As far as you will use timers your system cannot be accurate. Dig in your manuals. You may find that timers accuracy remains scan-dependent. The results are generally provided with +/- 1 scan time.

Another direction would be to generate some "not scan related" time base. An easy solution consists in providing high frequency pulses and using the internal absolute counters as timers.

1) See how to generate a 100khz or 50 kz or 10kz pulse train
2) Preferably work with motion control instructions: the link between pulse trains and numeric elapsed values is built-in (no externally wired counter involved)
3) Wire your external signal on one or two interrupt inputs
4) Write interrupt programs: read the actual elapsed values of your internal counters, and reset the elapsed value.

Depending on your hardware capabilities, you might be able to decide either pulses falling or raising edges to control your interrupt programs. Two separate and simultaneous pulse output are also convenient.

Let us know what results have been reached.

Laurent
 
Remenber!! PLC LG possessed hardware equipped for tally of the time. An internal circuit (chip) dedicated to count milisegundes pulse ON and OFF. Resolution less ms.

http: //www.lgis.com/

The person that knowledge LG PLC here is hesham
 
Hi Keith, Dandrade, Laurent

Thank you for all your advice.
But, would you please to explain more detail, I have not using the High speed counter before.

I was check at site again yesterday.
I check again the pulse using the machine ( I was paralell with the machine analog input 12bit 0-10VDC (PC104) to our Mitsubishi Analog module FX2N-4AD.

As I use the 0.1ms timr M8099 to measure the on off pulse. I was get the length of the pulse, its ok.

But, the pulse measure is not stable, it changable, not like the display at the machine. Our measure On Off pulse is most likely with display data from the machine. The machine one is stable.

The display is show:

Turn On Rate: (example 50.4%)
Turn On Time: (example 60 Cylce/Minute)


Turn on Rate is: ((Pulse B-Pulse A )/ Pulse B ) x 100%
Pulse A = on pulse
Pulse B = periode of pulse

Turn on Time is: 60 / Pulse B --------> Frequency

As example measure in PLC:

Pulse A=0.312s
Pulse B=0.753s
Result = (0.753-0.512) / 0.753 x 100% = 58.56%

This result always change because plc measure pulse A & B is change, for example
0.312, 0.412.
If this value is change, then we will get the Turn on rate different, example 57.4&, 58.5% etc.
I donot know why the measure value is changeable, although what is show in display machine is stable.
Is it because of the timer or hardware, or because the wrong ladder?

For Hardware Fx2N-4AD is 12bit and also the PC104 is 12bit.

For ladder we design using compare.
If the analog input > the value, then I turn on the bit.
I use PLS & PLF to mov the 0.1ms timer to data register.

I just think to try the signal input to the High speed counter.
But, I donot know shoud I wire it +10VDC & 0V to the X0 & X1?
Need it to wire to input COM?

What do you think for my case, what should I do?

Thanking you all in advance

Best regards
Steve
 
Correct me if I am mistaken:
- You are dealing with voltage pulses
- The signal is wired to analog measurement devices (PLC+PC104)
- Your PLC program continuously checks the analog value
- The counter starts when an "in-scan" comparison with a selected voltage level is achieved.

OK??

Case "no":
- Correct

Case "yes":
- Did you pay attention to your analog conversion speed??
- Is this speed guaranteed (+/- 0.1ms)??
- Do you include any other transfer rate or delay between your analog module and the PLC unit?
- What is your actual PLC scan time?

Refer to your manuals and find: the rated ON/OFF voltages, optocouplers ON/OFF currents and response times of your PLC's high-speed inputs. Are they usable?
Use a "true" measurement tool (oscilloscope). Check the rising/falling times of your pulse. Are we talking about a "true" square signal? Does your PLC comparison value really reflect the ON/OFF pulse ratio? Would you consider a basic external high speed analog/digital conversion? Depending on your electronic configuration, an optocoupler or an amplifier may help you to go ahead with your PLC and a conventional input. In any case, forget your PLC AD module.
 
measure duty-cycle and frequency

Have 03 methods. For measure Duty-cycle.

Common features:

-Scan time << You large pulse: Ex. Scan-time 8 ms, pulse min.312ms
result 312/8 = 39 scans.(less true 03 method)
-Error defined Scan-time.
-Asyncrouns operation: Rate Error inverse proportional at
(sample)/scan-time
-Sensitive control, proportional time sample.(every)
-Good stable: Fix time scan-time register special.

1)Counter time in ON-OFF level logic OR capture change pulse in determined instant.

-High sensityve, get more speed variations.
-Stable => Necessary fix scan-time

Alternative, capture change pulse in determined instant
2)Scan-time logger register

-Sum consecutive scan-time register and make calculus.
-If make capture both change =>calculus get real frequency.
-The method possible calculus more exact Duty-cycle and frequency.
-Stable => The result defined precision variable time scan-time.


Ex: 20Hz=> 50ms 50%ON=>25ms Time sample= 5ms Scan-Time >=2ms
Result table (5ms same as 10% duty-cycle )
Code:
  Timmer(5ms)Scantime  Pulses OFF->ON If get pulse Dtc%(OFF) is value 
     00        (2ms)     ---                    0% ----- 4 % 
     00        (4ms)     ---                    4% ----  8 % 
     01        (6ms)     ---                    8% ---- 14 % 
     01        (8ms)     ---                   14% ---- 18 % 
     02        (10ms)     ---                  18% ---- 22 % 
     02        (12ms)     ---                  22% ---- 26 % 
     02        (14ms)     ---                  26% ---- 30 % 
     03        (16ms)     ---                  30% ---- 34 % 
     03        (18ms)     ---                  34% ---- 38 % 
     04        (20ms)     ---                  38% ---- 42 % 
     04        (22ms)     ---                  46% ---- 50 % 
     04        (24ms)     transition           50% ---- 54 % 
     05        (26ms)     transition           54% ---- 58 %
If Code in below
Result 50%---54% <=Scan time not cause error capture
If Code in top
Result 54%---58% <=Scan time cause error capture.

3)High speed and interruption. For get duty-cycle and frequency.
-More confiable and precision.
-Get result one scantime.
-Get speed variation.

Build system:
-Get component generator frequency 50%duty-cycle, 10X more you frequency and in range input. Set frequency equal integer time cycle.
-Connect generator input speed.
-And program interrupt, register counter speed in pulse ON and OFF.
-Get calculus or build table data for one value result duty-cycle and frequency.

Warning:
-High speed signal, make rate work CPU and get error (acummuled interrupts)
Solution:
-Limited value frequency generator is important OR
-Interval control enable/disable interrupts.

-------------------------------------------------------------------
Here, type and fucntion signal measure? It save!? For you 01 and 02 workend.
 

Similar Topics

What is the raw count of Allen Bradley Flex Analog Output Module 5094-OF8 raw count?
Replies
1
Views
121
I am working on a Markem X40 printer which uses NGPCL Commands and needs to send commands using a .net program. I need help with the following...
Replies
0
Views
110
Hi, I'm programming in RSLogix 500, and I'm wondering how I would program a Jog command that does not increase the encoder count. Basically we'd...
Replies
3
Views
299
Hi all, I am currently working on a software in Automation Studio that is supposed to detect when effort is inputted by a user. This is done via...
Replies
0
Views
587
Hi i have project on micrologix 1400 to display cycle time count on HMI. I am beginner. in project i have six input once all input get high it...
Replies
3
Views
806
Back
Top Bottom