Page 1 of 1

Read-out current GPIO status

Posted: Mon Oct 19, 2015 1:42 pm
by jvandenbroek
Is it possible to include some command to probe the GPIO A/B current status? I had some leakage near my boiler, which got me thinking to connect a water sensor which shorts as soon as water hits it (no kiddin' :D), so when GPIO is pulled down I can read this status and let the alarm bell ring. Since I really don't want to install an additional controller (KISS), I thought to use the OTGW build-in GPIO for this purpose. Unfortunately I figured out that setting it to high and manually pulling it down doesn't change it's status.

What do you think? :)

Re: Read-out current GPIO status

Posted: Tue Oct 20, 2015 6:20 pm
by hvxl
There's not a lot of space left in the PIC for new features, but this one only took 6 instructions to implement. That was acceptable. So, firmware version 4.2.5 now supports the PR=I command which will give you a 0 or 1 for both GPIO A and GPIO B. Enjoy.

By the way I don't suggest to set the GPIO pins high and then pulling them low. That will result in the maximum current out of the pin (something like 25mA). Instead set the function of the pin to 0 ("None") and use a pull-up resistor. Then you can pull it low without drawing a lot of current.

Re: Read-out current GPIO status

Posted: Sat Dec 12, 2015 11:59 am
by jvandenbroek
It has been a while, but I wanted to thank you for implementing this. Very useful. Thanks for your suggestion, in my tests I got a reasonable amount of resistance when shorted by water, so that should not be a problem. But it's good practice to always use resistors, I agree :)