I test ReadPulse to measure frequency and this not work for
var digitalSignalPin = GpioController.GetDefault().OpenPin(SC20260.Timer.Capture.Controller5.PB3);
I used sample from readpulse
you probably mixed up the controllers and it should be like this:
public static class Capture
{
public static class Controller5
{
public const int PA0 = 0;
}
public static class Controller2
{
public const int PB3 = 19;
}
}
for
var digitalSignalPin2 = GpioController.GetDefault().OpenPin(SC20260.Timer.Capture.Controller2.PA0);
We will correct the controller but it doesn’t effect to the pin number. BP3 is still 19. Tell us more detail “doesn’t work” please? Doesn’t read the pulse, no event…?
Correct, there is only once event after issue a ReadPulse command.
Unless you tell us a reason to how more than one, we will add.
Correct, this is generic, no frequency. But there is “count”, from count, time, we will know the frequency.
I’ve tried ReadPulse in finish sring of OnReadPulseReady event handler. The event did not appear again. Show an example of calling ReadPulse again
For different frequencies, you need to read a different number of pulses so that the measurement accuracy is the same. How can I find out the required number of pulses?
Maybe you add one more ReadPulse implementation with the “read time” parameter?
public void ReadPulse2(uint pulseReadTime, GpioPinEdge edge, bool waitForEdge);
Another problem is that if there are no impulses, then the event will never appear.
The way we intended this to work would be by calling read pulse repeatedly to continuously sample the frequency. Each time you read pulse you get an event with the sample. This can be a thread that samples once a second for example.
There is abort for that. And this generate an event after abort is called.
This are reading how long it took from one edge to another. They selected rising edges. This means your frequency is generating 1.4ms… 1/1.4ms is your frequency.
Maybe you add one more ReadPulse implementation with the “read time” parameter?
public void ReadPulse2(uint pulseReadTime, GpioPinEdge edge, bool waitForEdge);