Interrupt on analog voltage change on Analog Input pin?


Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8955
Posted: 08:11pm 26 Feb 2021      

I've just been experimenting with a micromite using the idea I presented earlier. I used a 1k pullup to 3.3v then experimented with pull-down resistors. I needed resistors of 470R or less, but resolution allowed values down to 10R easily (I couldn't test lower due to lack of bits) so a few buttons should be possible. 0R also works, of course.

The test routine was:

fkeys was set to the input pin number

Setpin fkeys, intl, ibutton

Do
'temporary nothingness
Loop

Sub ibutton
Setpin fkeys,ain
x=pin(fkeys)
Print x
Setpin fkeys, intl, ibutton
end Sub

Operation was pretty clean. There's a 100nF capacitor from the input to ground, which probably helps, although I didn't test without it.