Pulse Width Counting

IAA

Member
Join Date
Sep 2007
Location
Michigan
Posts
34
Hello All, I am using a Micrologix 1100 with a HSC counter. The HSC counter is working the way it should be. I am trying to detect the Duty Cycle of a PWM input. I have been trying to figure out the time between pulses, but can't seem to figure out the proper way. The frequency of the PWM is 140hertz. Anybody have any examples or suggestions? Thanks
 
Normally I just setup a timer to take a sample every X seconds. So if the accumulated value increases by 280 every 2 seconds your would be running 140 hz
 
The poster refers to the Duty Cycle. I believe they are trying to measure the individual ON time and OFF time of each cycle.

As the cycle lasts for a little over 7 ms you would need a clock of much higher accuracy (say to the micro second) to give an accurate measurement. I think that the Free Running Clock is the fastest clock available to the program and that increments every 100 microseconds giving approximately counts in one cycle.

If you connect the PWM signal to two inputs and use two interrupt (EII) routines (one for rising edge, one for trailing edge) and sample the Free Running Clock at each one you may have some usable information but not of high accuracy. You would be able to tell if the signal changes by a large amount, maybe 10% but not much closer.

Good luck.
 
Bernie, I was thinking the same thing...would the resolution be 70 counts then? And half of that could be on or off so you end up diving integers like 30/40 to find the duty cycle. But we must add in any input signal latency, variability, and that of the code being executed in the interrupt routine.

I would just but a din rail mount wilkerson converter...I think they have a model with a comparator for frequency pulse width...

Surely there's a dedicated device, or a way to reconfigure the signal at the sending device.

http://www.electronumerics.com/micro/micro_duty_cycle_meter.htm
http://www.laurels.com/duty-cycle.htm
 
Last edited:

Similar Topics

I am monitoring two BMXDDO3202K digital outputs for their behaviour, they are each for opening and closing, and so the on time affects how far the...
Replies
1
Views
285
Hi, folks. I want to know, whether it is possible to read the pulse width or some instruction, I have not found something abou that, with...
Replies
3
Views
1,752
Hey guys, I have a client that has a v-notch chlorinator that doesn't run off a 4-20mA loop, it instead has two discrete inputs that drive the...
Replies
6
Views
1,871
Help me. I want to create a PLC program Pulse width modulation (PWM) with Simatic PLC s7300. using SFB49. but I have never made it. is there who...
Replies
0
Views
2,574
Hi, I am trying to write a ladder logic using PWM and INI instructions to actuate a fast switching solenoid valve at a range of frequencies. I...
Replies
9
Views
11,264
Back
Top Bottom