Maximum of (Pulse)Inputs?

35 views
Skip to first unread message

Gabor Schilten

unread,
Sep 8, 2015, 2:16:58 AM9/8/15
to ioio-users
Hi,

For an interesting new project, i have to intercept 6 rc receiver channels, and around 4 ultrasonic sensors to start with.
Outputting 6 pwm signals then for all engines and servo's..

However, according to the wiki, we only have single-precision and 3 double-precision pulse input modules.
If I'd exchange the 3 doubles for 6 single precision, I'd end up with 9.

Is there something I'm missing here? Or do I need to look for eather another IOIO board or Sensors based on I2C?

Thanks.

Gabor

Tyler

unread,
Sep 8, 2015, 3:28:45 AM9/8/15
to ioio-users
Gabor, 

Based on the datasheet for the pic24FJ256 family, there are 9 input capture modules that can be configured any way you like. You should be able to do as you propose, unless the IOIO firmware is purposefully limiting you, which I doubt. 

Have you tried it yet? The IOIO firmware will tell you if you try to initialize something illegally (with a runtime exception).

Tyler

Tyler

unread,
Sep 8, 2015, 3:37:00 AM9/8/15
to ioio-users
Just in case you're curious, here is an overload for initializing a pin as a pulse-input in single-precision mode:
This would open IN_PIN as a single-precision pin with a clock rate of 250KHz and measuring the time the signal stays high. 

// input = ioio_.openPulseInput(Spec spec, ClockRate clock_rate, PulseMode mode, boolean double_precision)
Input = ioio_.openPulseInput(new Spec(IN_PIN), ClockRate.RATE_250KHz, PulseMode.POSITIVE, false);

More detailed explanations are available in the javadoc.

Tyler

Gabor Schilten

unread,
Sep 8, 2015, 5:59:05 AM9/8/15
to ioio-users
Thanks. Got it working. However, no idea how to get the 10th 'sensor' working based on PWM ;)

Op dinsdag 8 september 2015 08:16:58 UTC+2 schreef Gabor Schilten:

Tyler Trombetta

unread,
Sep 8, 2015, 11:33:14 AM9/8/15
to ioio-...@googlegroups.com
Gabor,

I'm reading the value of a toggle switch outputting PWM by passing the signal through a low pass RC filter and then reading the value on an Analog IN pin. It's not pretty, but it works pretty reliably since I'm out of PuseInput modules. If you have something that doesn't need any fidelity that could be an option. 

--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+...@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Ytai Ben-Tsvi

unread,
Sep 13, 2015, 1:11:10 PM9/13/15
to ioio-...@googlegroups.com
Sorry for responding late. In case it matters, the IOIO is potentially capable of up to 9 single-precision PulseInput, where every pair of single precision can form a double precision.
For simplicity, I chose to expose this as 3 single + 3 double, but that's strictly an arbitrary software decision.
The code that does that is here:

The part that says new int[] {0, 2, 4}, new int[] { 6, 7, 8 },
Says "use modules 0+1, 2+3, 4+5 as double precision and 6, 7, 8 as single precision. You can change this to whatever other combination you want (remember that double precision always need to use an even index and would use up the next index too, and that in total you have 0 through 8).
There's currently no API to make that change, you're need to modify IOIOLibCore as explained.

Gabor Schilten

unread,
Sep 13, 2015, 4:00:32 PM9/13/15
to ioio-...@googlegroups.com
Hi JTai,
No problem, still in designing phase.
Thanks for the link, will look into it when it's due.



Op zo 13 sep. 2015 om 19:11 schreef Ytai Ben-Tsvi <yta...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages