Ports or Pins?

On the Picaxe-40x2, can you configure individual pins, or just ports?

ports vs pins (vs legs)

The words “port” and “pin” keep confusing me as well. Picaxe basic often speaks of “ports” whereas people in the physical world only see pins sticking out of chips. To confuse matters even further, some boards are documented to have “legs”.

Be specific Roboto. What are you talking about, exactly?

And configured to do what?

If you want to switch them from inputs to outputs, it has been my experience that they sorta configure themselves when you issue a high low command or a if pin command. I have never configured my pins during start up and have never had a problem.

I think he means, for

I think he means, for example

PORTA has 4 pins, can he choose 2 of those pins as outputs, and 2 inputs? Or is he limited to defining PORTA as input or output? making all 4 of those pins either input or output.

 

I think you can define each pin, it wouldn’t make sense if you couldn’t, but i have no idea how picaxe woks :slight_smile:

Well in that case…

Yes, of course you can. Manual 2, Page 111, Command "Let Dirs"

You can configure any pin to any mode. After the command “let dirs” the pin “lay-out” you want is shown in binary (so you can read it easier).

don’t know if this helps

don’t know if this helps but… with AVR you can define pins via hex or 0b…

I mean you can change it this way:

PORTA = 0x00 this all input

PORTA = 0xFF this is all output

 but if I remember well you can simply use: PORTA = 0b00000001, where pin 1 is out, and the rest is in or don’t know… but some C compilers can even make it easier via PORTA.D1 or PORTA.B1 or PORTA.F1 :slight_smile: theese means that pin 1 of port A… :slight_smile: but this is in avr case…

 

but as Chris said the manual is the best way to make it :slight_smile:

 

 

hope I could help