Help with addressing pins

DBB

New Member
I need help with addressing pins. I got the "First program" with blinking one LED on and off to run. It used B.1 to identify the pin. Tried to expand the program to get the other pins to flash LEDs but couldn't get get it past the syntax checker.

So the question is: What is the convention or protocol for addressing the actual pins. I am using the 08M2 chip.
 

Rick100

Senior Member
It's in manual 2 page 28 under Input/Output naming conventions. Use outpinsC and dirsC to address the port and direction registers. Here's an example that sets the pins to all outputs, except for c.3 which is input only, and writes tor them. It works in the simulator.

Code:
[color=Navy]#picaxe [/color][color=Black]08m2[/color]
[color=Purple]dirsC [/color][color=DarkCyan]= [/color][color=Navy]%10111[/color]
[color=Blue]for [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]to [/color][color=Navy]32
      [/color][color=Purple]outpinsC [/color][color=DarkCyan]= [/color][color=Purple]b0[/color]
[color=Blue]next
end[/color]
Good luck,
Rick
 

DBB

New Member
Thank you.
Ok, so what I am seeing here is chip pin number 7 is labelled C.0, pin 6 is C.1
I am counting 2 /Outs, 2 In/Out, and 2 In and then the +V and 0V
What would differentiate B.1 from C.1
and chip description states 5 i/o. Would that 5th /Out be chip pin 4 or chip pin 2 (C.3 or C.5) ?
I guess I also don't understand what the ports do (A, B, C, D)
I am not figuring out the input/ output pin numbers and how to associate them with the actual physical leg numbers.
 

westaust55

Moderator
@DBB,

Welcome to the PICAXE forum.

There are also diagrams in PICAXE manual 1 and online.
Those diagram indicate which pins are available is inputs, which as outputs, which as bi-directional and give you the most common other functions for various pins (such as PWM and i2c)

As Rick100 indicates, not all pins can be outputs. C.3 and C.5 are only capable of being used as inputs. Before you use C.5 even as an input, the DISCONNECT commands must be used and you will need to study up on its use and other requirements first.

Note that for the 08M2 only the pins can equally be referenced as portB or PortC pins.


Some commands such as HIGH and LOW will automatically set the pin as an output.
Others require that you first use the DIRSB or DIRC commands to set the pin direction.

If you post the program you were trying to use that may help us to udnerstand what you are doing and what had not worked as you anticipated.
 

hippy

Technical Support
Staff member
Pin identifiers are rather arbitrarily assigned to PICAXE leg numbers; the Manual 1 "Getting Started" has pinout diagrams which show what the assignments are. PICAXE programming software uses pin identifiers rather than chip leg numbers.

Pin identifiers are arranged in groups of up to 8 as a port ( eg B.0 to B.7 is Port B ). This allows the whole group of pins on that port to be more easily manipulated as a single set.
 
Top