PICAXE 08 Pin Naming (4, b.4, c.4...) Question

Siegel_Kenevil

New Member
I programmed a 08M2 and at first, I used "4" to identify pin 4. After reviewing other programs, I saw that B.4 was used sometimes. I tried my code with "B.4" and it worked the same as "4". Then I tried to use the same code on a 08M chip and it failed but "4" and "B.4" both worked.

What is the logic here? Is it better to include the alpha (B or C) with the numeric?
 

srnet

Senior Member
Myself, I would stick to the pin numbering given in the manual for the 08M2, even if other options appear to work.

See manual 1 page 10.
 

nick12ab

Senior Member
Using B.x on the 08M comes up with a syntax error but it works on the 08M2. C.x pins and B.x pin constants all equal the same number (C.1 = B.1 = 1, C.2 = B.2 = 2, see second attachment).

Including the letter makes it clearer that you are using a pin so if you are using a command that you want to change the pin it operates on but you don't remember the syntax of the command, you can tell by the number preceded by the letter which argument is the pin number.

If you don't want a program to work on the 08M, you can use B.x lettering as that way it will need modification beyond changing the #picaxe directive. Otherwise, use the C.x lettering.
 

Attachments

hippy

Ex-Staff (retired)
Multiple 08M2 pin naming arises to conform with other M2 devices and to make it easier for users of older PICAXE 08M to run their programs on an 08M2 without change. There's no reason not to use any convention.

For backwards compatibility and ease of use the same pin naming conventions for the 08M2 have been applied to the 08 and 08M; as to why only B.4 and not the other B.x pins are defined we will have to investigate.
 

westaust55

Moderator
While there interchangeability between a numerical and the port.pin nomenclature, I would recommend to stay with the Rev Ed proposed naming conventions.
In that way we all use the port.pin format for the M2 and X2 parts
And the simple 0,1,2, ... For input and also separate output pins for earlier "", "A", "M", "X" and "X1" parts.

Amongst other reasons, this will help readers helping respond to queries posted here to try to ascertain the type of PICAXE involved.
By way of example, your thread header indicates a PICAXE "08" which is a very early chip whereas you then discuss an 08M2 in the words in the body of the post.
 
Top