Jump to content

Recommended Posts

Hi I need to read a pulsed output with my vision V130-33-TR6. The pulsed output consists of 100mS pulses and I need to measure the frequency of these pulses. Pulse frequency is between 100ms and 10s (it's the pulsed output from an electricity meter to give the number of kW directly proportional to the pulse frequency)

At the minute I am connecting the pulse to a digital input and using the 1.25mS interrupt to measure the time between the rising edge of the input but the output value jumps around a bit due to the error margins i.e. measuring once every 1.25mS.

To measure the time between rising edges I am simply incrementing a MI during each 1.25mS interrupt and multiplying it by 1.25 to get the time in mS. I know there are timers that count down from a preset value but is there a way of more accurately measuring the time between rising edges i.e. starting a timer that increases until I reset it.

I could use a large timer a subtract the value it reaches from the preset value but this is a bit untidy and leaves room for error if the timer reaches zero before I read it and timers only read down to deciseconds.

I looked at the HSC frequency measurement but I am unsure how to exactly use these.

I could also average a few values but more accurate measurement in the first place would be preferred.

My other small issue is how do I specify the number of decimal places a MF is displayed to on screen as I only need 2, not the full number.

Thanks in advance

Adam

Link to comment
Share on other sites

  • MVP 2014

Reading the frequency of relatively slow pulses is always a grumpy sort of problem.

Firstly, I think your approach is as good as any. The HSC frequency measurement has a maximum timebase of 1 second, and will give a lot of zero readings on this type of signal.

With a measurement resolution of 1.25ms on a minimum pulse length of 100ms, you should not see a huge variation due to the timebase (approximately 1.25%).

I do think one of the problems with this is the human expectation of what the data should look like. With a slow signal like this, you can see the natural variation in the signal. If you filter the signal, it seems even slower. In contrast, a fast signal can be filtered, and still look fast to the human observer.

However if you want a smooth signal, you will almost certainly need to filter it. Maybe use a filter of 5-10 values, by calculating the values as you currently are and averaging them together (use the FB filter block). At higher rates of kWh usage the values will come more quickly, and your filter will give a faster response.

Link to comment
Share on other sites

There is one other small trick that might help give you a little better resoution, but ultimately your scan time is going to limit you.

Look at Utils > Debug > Interval >

You will find a block for Interval Start and Interval End. They give a very precise meaurement of time between two events.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.