Picaxe 08m2 input pin c.5 issue

Protoproff

New Member
Hi folks, i hope you can help me.

Im trying to use the input serial pin c.5 on a 08m2, the problem I have is that I`m trying to use it with a sharp IS471F IR sensor. The issue is that the IR sensor is HIGH on power up and LOW on obstacle detect and the problem being that the picaxe pin needs to be low on power up before the DISCONNECT command. Can anyone suggest a way of connecting the IR sensor to c.5, im guessing a PnP ntransistor working as an inverter should work, can anyone acknowledge this or maybe offer a better solution. I would normally test but have popped two sharp sensors messing about and they`re darn expensive. Any help would be great, Thanks in advance.
 

hippy

Technical Support
Staff member
Using Serial In for anything other than a push-to-close button to V+ can be tricky. The best suggestion is not to do that, move I/O around to make things more easily achievable, or use a PICAXE which has enough I/O to avoid having to use Serial In.

A transistor or other inverter should work but, if that ends up holding Serial In low, it will prevent downloading into the PICAXE.
 

AllyCat

Senior Member
Hi,

I believe it could be easy with a few "tricks":

Firstly, the PICaxe serial (programming) input MUST have a pull-down resistor, but it can be much higher than the normal 10k + 22k, say 100k.

Secondly, pin c.5 has an internal "Weak Pullup resistor" (of typically 30k) but the PE doesn't support it directly (it flags an "error"). So what can be done is to start with a weak pulldown resistance (so the PICaxe starts correctly) and then issue a DISCONNECT and Enable the Weak Pullup. The IR receiver can then pull that "Low" again via a diode (anode to PICaxe pin).

To enable the Weak Pullup on c.5 you need to use a POKESFR WPUA,32 . Yes it's called Port A on the base chip, but I don't have the SFR number to hand at the moment. I can find it later if required.

Addendum: The WPUA SFR is $8C (140) for M2 PICaxes and of course 32 represents %00100000 (pin .5). Note that these command values can be used for Leg 2 (SI) of 08, 14 and 20M2 devices. With a few kohms in series with the IR pulldown it should be possible to program the PICaxe normally, or better, the standard 3.5 mm programming socket has built-in changeover switches which could disconnect the IR detector.

Cheers, Alan.
 
Last edited:
Top