Pin default values (High/Low)

ROGER555

New Member
I'm still trying to grasp the concept of logicator and I haven't actually programmed a PIC yet so bear with me. I am a bit confused on the polarity of the pins at rest, and how this ties into input/output functions.

Let me explain with an example.

Say I have a device I want to trigger with a (-) output directly from the PICAXE like a small LED. According to the little digital panel showing my PICAXE all the pin are low by default and go high when you click on them.

How do you get the pin into a neutral state while connected to the LED so it can be triggered Low to properly light the LED?
 

Paix

Senior Member
Hi Roger,
I guess most people in the UK are in their beds by now and will soon be there in the US too. Aus and NZ are still eating breakfast, so although I don't have any Logicator knowledge, perhaps I can share a thought or two.

If you imagine that there is no initial defined state, it would be good practice to initialise output pins into a given output state.

In many programming languages, such as Pascal and Cobol without initialising a variable you could almost always guarantee an unpredictably high value and not the zero that you were anticipating. Other languages and a few implementations of Cobol were a little more friendly. Rule 1: Assume nothing.

How do you get the pin into a neutral state while connected to the LED so it can be triggered Low to properly light the LED?
There is no neutral state, only high (1) or low (0).

From your explanation, it sounds like the LED is connected from the +ve line to a Picaxe output pin and so the LED will light when the output pin is driven low. Also from your description you say that the Logicator seems to have these output pins low until you change their state. Remember Rule 1. it seems that your LED is likely to be on by default unless you switch it off at the start of your program. Let's hope that you are driving LEDs and not explosives . . . Kaboom.

I hope this helps somewhat, or at least amuses as the cognoscenti variously sleeps, eats or scratch themselves at the beginning or end of a day.

Most people tend to code using the Picaxe Editor environment and so will have accounted for the lack of a blisteringly fast response that a lot of questions seem to receive.

I too must depart for bed if I am to be up in the morning.
Welcome to the forum if no one has said it already; and if they have, welcome to the forum anyway. :)
 

Technical

Technical Support
Staff member
Outputs can only be high (=5V = logic 1) or low ( = 0V = logic 0).

So if your LED is betwen V+ and the pin, you need the output to be '0' to light the LED.

If your LED is between the pin and 0V, you need the output to be '1' to light the LED.

Logicator also has the '-' opton when setting outputs, but this does not mean neutral. It means 'ignore' - so if high leave high or if low leave low.
 

ROGER555

New Member
Thanks everyone!

Ok so its either high or low got that. I guess this is a new concept for me or maybe this is the cause with all electricity its just never been a consideration before.

I use relays a lot, Say for example (No PIC involved) I have one side of the coil going to high (+) and the other side going to low with a toggle switch in-between. The wire section between the relay and the switch would be considered neutral in my mind?

Maybe this doesn't really matter when using switching devices with the PIC like a transistor but lets say theoretically the I am powering something directly off one of the output pins and it needs a low output, but sending a (+) signal to this device could be damaging. Do you just install a diode facing the PIC to block the + from reaching the device but allowing - to flow?
 

eclectic

Moderator
Thanks everyone!

Ok so its either high or low got that. I guess this is a new concept for me or maybe this is the cause with all electricity its just never been a consideration before.

I use relays a lot, Say for example (No PIC involved) I have one side of the coil going to high (+) and the other side going to low with a toggle switch in-between. The wire section between the relay and the switch would be considered neutral in my mind?

Maybe this doesn't really matter when using switching devices with the PIC like a transistor but lets say theoretically the I am powering something directly off one of the output pins and it needs a low output, but sending a (+) signal to this device could be damaging. Do you just install a diode facing the PIC to block the + from reaching the device but allowing - to flow?
Best thing you can do initially,
is to read / re-read Manual 3 (Interfacing),
then come back and ask questions in the
Active Forum.

(There's less "traffic" in this section).

e
 
Top