Pin Low Setting

robonuk

New Member
Hi,

I'm attempting to make a model railway signalling system, which in part has been copied from a tutorial on YouTube. I have the setup of the wiring etc correct but am struggling with a certain aspect of the program. The circuit features an Infrared transmitter & receiver and when this is triggered the voltage from Pin1 of a 18M2 chip dropped to around 0.4v. How do I program the chip to detect that this pin has dropped low? Currently when the sensor triggers it simply turns out the green signal then turns it back on once the sensor isn't receiving. The idea is that when the sensor is tripped it starts a sequence turning the red signal on then yellow etc. I'm just confused how I get the program to recognise and start this sequence.
 

hippy

Technical Support
Staff member
Welcome to the PICAXE forum.

To determine when a pin has gone low you would usually use something like -

If pinC.1 = 0 Then ...

It may help if you could post a link to the YouTube tutorial and your circuit diagram then members will get a better grasp of exactly what you are doing and may be able to offer more specific advice.
 

geoff07

Senior Member
Voltages are converted to logic levels according to thresholds. So an input voltage < 0.8v is a '0' (TTL standard), and > 2v is a '1'. Using CMOS levels, the thresholds are Vcc/3 and 2Vcc/3. It can get quite complicated according to technology, supply voltage, and the different types of digital input. A Picaxe is a CMOS device, but is compatible (mostly) with TTL, though you can change this on newer devices.

But in all cases, your 0.4v would be read as a '0' using the command that hippy suggested. It should then revert to > 2v or so to give the opposite reading.
 
Top