picaxe 20M2, pin a.0 support

ncoplin

Member
Hi,

Though not documented in the manuals, pin a.0 (normally serial out) is actually usable for the 20M2. This is great as it makes the upgrade path to 20x2 more complete.

Issue is support is only available in "direct mode", eg:
high a.0
low a.0
toggle a.0

The P.E. has a hissy-fit when you try:

SYMBOL name = a.0

or

SYMBOL name = pinA.0

I presume the commandline compliers may also have an issue, but not tried.

Simple one to fix for next update, and the 20M2 can then claim an extra pin?

Cheers,
Nick
 

hippy

Technical Support
Staff member
SYMBOL name = a.0
SYMBOL name = pinA.0
As it's an output that would have to be "SYMBOL name = outpinsA.0", but that isn't accepted by the compiler either.

A.0 on the 20M2 isn't the same as other PICAXE pins in that there's no internal 'pinsA' nor 'outpinsA' variable so HIGH, LOW, TOGGLE A.0 are special (undocumented) cases, and, as A.0 only has limited use, it's not documented as a "general purpose output".

It's a firmware feature and it may have been considered that allowing "SYMBOL name = A.0" which has only limited use would lead to greater confusion than simply not documenting the limited A.0 feature at all but I'll ask if that can be supported.
 

ncoplin

Member
Thanks Hippy, appreciate the reply.

Agree, its of limited use - I'm only using it as LED backlighting for an LCD display. Easier to be a dedicated pin than one that has to be masked when controlling all the other pins on port B for 4-bit LCD control... But the 08M and 14M make do with multiplexing the SerialOut so I thought to try it (since the 20X2 has it).

Hopefully "SYMBOL name = A.0" is controlled at compiler, not firmware level... ie the compiler does a substitution rather than the firmware doing an lookup/interpretation. That would mean a fix is available to existing chip owners. Also, expect that it would be faster to resolve the definition once before downloading the code to the PicAxe.
 

Technical

Technical Support
Staff member
The M2 internal architecture only allows for 2 ports (B,C) whilst the X2 architecture allows for 4 (A,B,C,D).

So the 20X2 has a real A.0 pin, whilst the 20M2 does not, as the M2 architecture does not support portA.

However to give a little bit more flexibility the 20M2 compiler does some 'pokesfr magic' to give control of the serial out pin with a very limited set of commands (high/low/toggle/serout). But you will still have to use the A.0 name exactly (e.g. high A.0), as the pin is not being used as a normal pin and so cannot use 'symbol' definitions etc., as the compiler is 'catching' the special case and so 'manually controlling' the pin by some hidden pokesfr's.
 
Last edited:

ncoplin

Member
Thanks Technical, handy to have the extra pin regardless. At least the A.0 name is the same between 20M2 and 20X2 allowing for an upgrade path.
 
Top