not sure about the settings... read some over here..
viewtopic.php?t=3476
i thought i could use the log to determinate how fast its going high between and low but thats not how the web-logging interface works..
but heres the signal i like to count (and seems to count but not sure if its correct counting)
Im not able to find any wiki about this plugin but im using the almost the same settings as
viewtopic.php?t=5284
but instead om 100ms, i use 10ms with falling... its around 50-100ms between low and high, forgot to check.. but what does mode type "change" mean?
Pulse counter - Is this correct settings for the signal?
Moderators: grovkillen, Stuntteam, TD-er
Re: Pulse counter - Is this correct settings for the signal?
I am not entirely sure what you try to measure here.
Are you trying to count events and failing because some pulses are too short?
Or you you want to measure the pulse width?
If it is about counting pulses with a relative long interval and short pulse width, then you could add a flipflop in front of the GPIO pin and then count each change (rise and falling edge).
The flipflop will be much faster in reacting to a pulse and will keep the changed state until it changes again.
So it will also clean up the signal for you.
Are you trying to count events and failing because some pulses are too short?
Or you you want to measure the pulse width?
If it is about counting pulses with a relative long interval and short pulse width, then you could add a flipflop in front of the GPIO pin and then count each change (rise and falling edge).
The flipflop will be much faster in reacting to a pulse and will keep the changed state until it changes again.
So it will also clean up the signal for you.
Re: Pulse counter - Is this correct settings for the signal?
change means it counts a pulse when the signal goes from 0-1 and also when going from 1-0
in your case you want to count the pulse so it needs to be either falling or rising
falling counts when signal goes from 1-0
rising when signal goes from 0-1
you state your pulse is 50-100ms
what you need to know is when you can expect another pulse(is it also 50-100ms or longer)
the debounce time is to avoid jitter(eg counting distortion)
if the fastest time between pulses is 1 second the debounce time should be below 1 second(500ms)
however if the time between pulses is 50ms then the debounce time should be lower than that
if debounce is to long it will miss pulses, if to short it might count a disturbance as a pulse
in your case you want to count the pulse so it needs to be either falling or rising
falling counts when signal goes from 1-0
rising when signal goes from 0-1
you state your pulse is 50-100ms
what you need to know is when you can expect another pulse(is it also 50-100ms or longer)
the debounce time is to avoid jitter(eg counting distortion)
if the fastest time between pulses is 1 second the debounce time should be below 1 second(500ms)
however if the time between pulses is 50ms then the debounce time should be lower than that
if debounce is to long it will miss pulses, if to short it might count a disturbance as a pulse
Re: Pulse counter - Is this correct settings for the signal?
Please note that the debouncer should not be needed if the pulse comes from something that does not give bounces like a digital output of some chip.
It should have strong enough pull-up or -down resistors to make sure the signal will not pick up noise from some other source.
It should have strong enough pull-up or -down resistors to make sure the signal will not pick up noise from some other source.
Re: Pulse counter - Is this correct settings for the signal?
thanks for all replies, i will use RISING with debounce of 56ms.
the counter works perfect.. now i need to read some more about using rules... I am not really comfortable using the rules but here you get a preview of what I am trying to achieve if there is someone who knows to point me in the right direction.
the counter works perfect.. now i need to read some more about using rules... I am not really comfortable using the rules but here you get a preview of what I am trying to achieve if there is someone who knows to point me in the right direction.
Code: Select all
if (GPIO(7) == HIGH && GPIO(1) == LOW) {
//read pulse counter value to dummy1
}
else if (GPIO(7) == LOW && GPIO(1) == HIGH) {
//read pulse counter value to dummy2
}
else {
// reset pulse counter value to 0
// send notification that high/low values are set
}
Code: Select all
//Reset pulse counter.. when going to high/low state.
on MOTOR-A#position=0 do
if [MOTOR-B#position]=0
TaskValueSet 12,1,0 // Empty the value of pulse counter (this is not finished)
endif
endon
// IF motor-A not running but motor-B does, then save values from pulse counter to dummy 1 (high state)
on MOTOR-A#position=0 do
if [MOTOR-B#position]=1
TaskValueSet 12,1,0 // Save var1 to dummy1 (this is not finished)
endif
endon
// IF motor-A running but motor B does not, then save value from pulse counter to dummy 2 (low state)
on MOTOR-A#position=1 do
if [MOTOR-B#position]=0
TaskValueSet 12,1,0 // Save var1 to dummy2 (this is not finished)
endif
endon
Who is online
Users browsing this forum: Bing [Bot] and 5 guests