18M2 vs 20M2

erco

Senior Member
Looks like the new 20M2 has numerous improvements over the 18M2, beyond more pins. Seperate data & program storage, improvements in the silicon die, etc. Is there any reason NOT to use an 20M2 instead of an 18M2?
 

Technical

Technical Support
Staff member
We would actively encourage using 20M2 intsead of 18M2, mainly because your PCB would then also work with a 20X2 if you ever needed to swap out.
 

nick12ab

Senior Member
It doesn't actually have any more digital I/O pins but the serial in/out pins are separate and the location of the power pins means that power isn't reversed if the chip is inserted the wrong way round.

Unfortunately, the 20M2 can't be used directly with the AXE029 breadboard adaptor like the 18M2 can so it takes up a lot more breadboard room since the adaptor needs to be connected with jumper wires elsewhere on the board. Although that space isn't very significant and it doesn't matter once the thing is assembled on stripboard/PCB. The extra commands on the 20M2 compared to the 18M2 might bloat up the interpreter a bit but there's so few there wouldn't be any noticeable difference.
 

Technical

Technical Support
Staff member
No, not at all. The 18M2 will be available for those who want to use 18 pin chips, 20M2 for those who want to use 20 pin chips.
All we are saying is that if you are doing a brand new design and trying to choose between the two, it often makes more sense to use the 20M2 - as you then also have the option to use a 20X2 part on the same board (if you decide to later swap from M2 to X2 series e.g. if you need a longer program).
 

Haku

Senior Member
The 18M2 specs pdf had a nice chart detailing the differences between the previous 18 pin chips and the replacement 18M2, is there such a detailed chart comparing all the specs of the currently available Picaxe chips?
 

Technical

Technical Support
Staff member
Feature08M214M218M220M220X228X240X2
Memory Capacity (bytes)2048204820482048409640964096
RAM (bytes)12851225651225612801280
Byte Variables (bytes)28282828565656
Input/Outputs Pins6121617172233
ADC/Touch Pins371011111627
Max. Freq. (MHz)32323232646464
Serial In/OutYesYesYesYesYesYesYes
Infrared In/OutYesYesYesYesYesYesYes
I2CYesYesYesYesYesYesYes
Tune (ring tones)YesYesYesYesYesYesYes
Parallel Tasks4848111
Program Slots1111144


i/o pin count includes serial in/out pins where they can also be used as general input or output
 
Last edited:

manuka

Senior Member
A handy summary table- it may be worth extending somewhat to cover operating voltages,EEPROM & typical costs etc.
 

ValueAdd

Senior Member
Unfortunately, the 20M2 can't be used directly with the AXE029 breadboard adaptor like the 18M2 can so it takes up a lot more breadboard room since the adaptor needs to be connected with jumper wires elsewhere on the board.
If not using the AXE029 then you would need extra space on the breadboard for the two programming circuit resistors


Although that space isn't very significant [U}and it doesn't matter once the thing is assembled on stripboard/PCB..


Using that separate driver chip results in:
  • More board space

  • Criticality of space is something of a relative thing.

    The extra commands on the 20M2 compared to the 18M2 might bloat up the interpreter a bit but there's so few there wouldn't be any noticeable difference.
    Both have the same amount of user program space as 2048 bytes .
    18M2 has 256 bytes of RAM available for user data using PEEK, POKE, etc, whereas the 20M2 has 512 bytes of such RAM.
    20M2 has capability for more program “parallel starts, more pwmout channels, hpwm capability and RFsupport. Even if the interpreter takes more space, it does not impact on program space and likely not perceivably upon the execution speed, and has added useful commands.

    The Rev Ed produced M2 briefing gives a good comparison: http://www.rev-ed.co.uk/docs/picaxem2.pdf


    EDIT
    Hmm, duplication with technical :-O
    Only saw up to post 7 when I typed my some hours later! Then all were displayed
 
Last edited:

nick12ab

Senior Member
If not using the AXE029 then you would need extra space on the breadboard for the two programming circuit resistors
The word directly is a key word - the AXE029 can be used but it can't just be shoved in line with the PICAXE like it can for the 18 and 28 pin parts.
Even if the interpreter takes more space, it does not impact on program space and likely not perceivably upon the execution speed, and has added useful commands.
I'm not talking about program space at all - only the execution time but like you say and like I said earlier the difference won't be noticeable.
[table removed to save space]

i/o pin count includes serial in/out pins where they can also be used as general input or output
How can the 40X2 have 33 I/O pins when there's only four 8-bit ports making 32 I/O pins? And again, the 20M2 only has two 8-bit ports so that's 16 I/O pins not 17 (unless you count the (IMHO) rather useless DAC).
 

ValueAdd

Senior Member
the 20M2 only has two 8-bit ports so that's 16 I/O pins not 17 (unless you count the (IMHO) rather useless DAC).
Hmm so the DAC pins doe not count? :confused:
Maybe not in your eyes, but does for at least some of us. DAC = output

and for the X2 parts, after using the disconnect command according to the manual we can use the SerialIn pin for "user serial communications".
In effect it becomes a user input.
 

srnet

Senior Member
How can the 40X2 have 33 I/O pins when there's only four 8-bit ports making 32 I/O pins?
Quite easily I would think, depending on how they are arranged by the PICAXE firmware.

The 18F45k22 (40X2) has for 8 bit ports (A,B,C,D) and one 4 bit port (E).
 

hippy

Technical Support
Staff member
As noted previously it's impossible to provide an I/O count which matches with everyone's individual notion of what that I/O count should be, and I've not been able to create any table which makes it any simpler or clearer which covers all cases. For example the 20M2 has B.0-B.7 and C.0-C.7, giving 16, plus Serial In and Serial Out / DAC, so that could be specified as an I/O count of 16 to 18 depending on what's included and excluded.
 

nick12ab

Senior Member
and for the X2 parts, after using the disconnect command according to the manual we can use the SerialIn pin for "user serial communications".
In effect it becomes a user input.
  1. The AXE401 shield base comparison (which is generally written in favour of PICAXE) says that there are only 20 available I/O pins on the 28X2 but if you include both serial lines, that's 22 and only one of those can be used for normal output.
  2. According to Technical, the I/O pin count included download pins that can also be used as I/O
  3. THERE'S NO CONSISTENCY!!!
  4. I/O means input/output so therefore 'I/O Pins' should only include pins that can be both input and output
The 18F45k22 (40X2) has for 8 bit ports (A,B,C,D) and one 4 bit port (E).
I know that! But there's no port E on a PICAXE-40X2 that are still called port E so there's only 32 port-based pins and the rather outdated serrxd which you're stuck with on the Serial In pin.
 

Technical

Technical Support
Staff member
4. I/O means input/output so therefore 'I/O Pins' should only include pins that can be both input and output
Unfortunately this just proves our point about never pleasing everyone. If we used your defintion the pin C.3, which is input only on the 08M2, would never be counted as a general purpose pin, which clearly it is (regardless of serial in and serial out pins). Input/Output pin simply means input OR output OR both.

On the 40X2 you have 4 ports, 32 i/o. Plus the serrxd which can be used for serial input. So you do indeed have 33 input/output pins.

The AXE401 is a special case, due to the layout of the shield format header pins which are 6 + 8 + 6 = 20.
 

nick12ab

Senior Member
Unfortunately this just proves our point about never pleasing everyone. If we used your defintion the pin C.3, which is input only on the 08M2, would never be counted as a general purpose pin, which clearly it is (regardless of serial in and serial out pins). Input/Output pin simply means input OR output OR both.
How about to keep everyone happy and give a quick overview on how many of each pin type there are the table should also say how many digital in/out and analogue in/out pins there are like this:

Feature08M214M218M220M220X228X240X2
Memory Capacity (bytes)2048204820482048409640964096
RAM (bytes)12851225651225612801280
Byte Variables (bytes)28282828565656
Total I/O Pins612161717
2233
- Of which can be used as digital inputs16
2031
- Of which can be used as digital outputs16
2132
- Of which can be used as analogue inputs1627
- Of which can be used as analogue outputs11
- Of which can only be used digitally as serial output00
- Of which can only be used digitally as serial input11
ADC/Touch Pins371011111627
Max. Freq. (MHz)32323232646464
Serial In/OutYesYesYesYesYesYesYes
Infrared In/OutYesYesYesYesYesYesYes
I2CYesYesYesYesYesYesYes
Tune (ring tones)YesYesYesYesYesYesYes
Parallel Tasks4848111
Program Slots1111144

Note that the table isn't complete since you've only put 17 I/O for the 20X2 but if you're being consistent by including every controllable pin then it should be 18. Inconsistencies are confusing. After completion, the ADC/Touch pins could be removed.
 

JoeFromOzarks

Senior Member
The previous charts make no mention of ST inputs or tri-state outputs. Here is my chart:

Feature
08M2
14M2
18M2
20M2
20X2
28X2
40X2
Fun to use

Yes​
Yes​
Yes​
Yes​
Yes​
Yes​
Yes​
Suitable for every conceivable purpose

No​
No​
No​
No​
No​
No​
No​
Direct connection to Flux Capacitor

No​
No​
No​
No​
No​
No​
No​
RGB Fader impresses Kids and Ladies

Yes​
Yes​
Yes​
Yes​
Yes​
Yes​
Yes​
Does Laundry (incl. folding)

No​
No​
No​
No​
No​
No​
No​
IC Leg Reliability Consideration (Note 1)

Yes​
Yes​
Yes​
Yes​
Yes​
Yes​
Yes​
DIP Converts to SMD (Note 2)

Yes​
Yes​
Yes​
Yes​
Yes​
Yes​
Yes​
Die Construction (Note 3)

MS8​
MS14​
MS18​
MS20​
MS20x​
MS28​
MS40​

Notes:
(1)
Leg retention is inversely proportional to the total count of insertions and removals: FR = 1/(CI+CR) where FR = Leg Stability, CI = Chip Insertion and CR = Chip Removal.
(2) Randomly place device on hardwood floor, place foot with hard sole shoe directly over chip and apply even pressure. (Easier than you think!)
(3) MS = Magic Smoke, number 189 on the Periodic Table of the Elements. Symbol: UTO (pronounced “uht-oh”) Group 18b – non-noble gas (due to the unpredictable orbit when the device is hurled towards the trash bin)



:) joe
 

westaust55

Moderator


  1. I/O means input/output so therefore 'I/O Pins' should only include pins that can be both input and output
IO is also collective and encompasses points that are only inputs and points that are only outputs.
Think of industrial PLCs and DCS equipment.
A PLC may have 200 IO comprising DI, DO, AI and AO and every pin has only one direction.

Nick you are just try to match you own point of view not the industry norms.
 

srnet

Senior Member
  1. I/O means input/output so therefore 'I/O Pins' should only include pins that can be both input and output


  1. I would assume that in the context of an entire device, I/O pins means the number of pins capable of input OR output.

    But then my experience is limited, I have only been in digital/microprocessor stuff (for fun and commercially) since about 1976.
 

nick12ab

Senior Member
More Inconsistencies!

The PICAXE website has a part comparison chart here and it says that the 40X2 only has 32 I/Os, so WestAust55, you can't go on at me for not classing Serial In as I/O when the makers of PICAXE can't even make up their mind on how many it actually has.

P.S. That table needs updating for the M2 parts and the K22 X2 parts.
 

Dippy

Moderator
I admit I haven't read every Data Sheet in the world, but Microchip themselves include 'Input Only' pins in their total "I/O" pin summary - in the same scheme as mentioned by Westy.

I don't wish to stamp on srnet's teasing comment about working in micros since 1976, but as the PICAXE is based on PICs then it seems only fair to maintain that convention. It IS slightly ambiguous , and I know exactly what you mean , if merely looking at headline summaries.
And whilst I haven't checked the actual pin-count (pin not bloomin' leg) I like the mention of "configurable" now.

I also agree it could be clearer and a summary table like Nick's is good, but all I can suggest is ALWAYS look past the headlines and that really does apply to EVERY Data Sheet in the world.
 
Top