Simple tip for jumper detection

Dippy

Moderator
Here's a good easy tip for anyone using jumpers in a small space.

Reading three states from one pin.

State Jumper to 0
set to input
Read pin . If 0 then 0

State Jumper to 1
ditto but if 1 then 1

State Jumper Open (i.e. No jumper)
Set to output
Drive pin high
Set to Input
Read... If 1
Set to Output
Drive pin Low
Set to input
Read if 0
If first is 1 and second is 0 then no jumper


(Component values mere suggestions and the faster your process the smaller the cap)
 

Attachments

Mycroft2152

Senior Member
Dippy,

Looks like the basis for a simple logic probe.

Add a hard wired seven segment display and you can display H, L O (High, Low, Open).

Myc
 

BeanieBots

Moderator
Good tip. Think I'd add a large (1M) pulldown just to stop any floating but that might require a larger cap. (can't be bothered to do the sums).
 

Dippy

Moderator
Why is 'floating' a problem? I guess it depends which pin/PICAXE you use? I confess I'd simply transposed from PIC.

Your jumper, when fitted, forces it up or down. And your 'open' sense code forces it one way then t'other...

.. and may be handy if using a mom-off-mom switch too.
it was just something I bumped into.
 
Last edited:

Andrew Cowan

Senior Member
I would add another 330 ohm resistor between the capacitor and the jumper middle pin, so if the PICAXE pin is made an output while the jumper is connected, around 10mA will flow. With just a 150 ohm resistor, 33mA could flow, damaging the picaxe.

Andrew
 
Top