PICAXE-20X2 microcontroller
Product Details
The smallest PICAXE microcontroller in the enhanced X2 range. Very popular in hobbyist projects due to its compact size and powerful features, but also suitable for more advanced educational use. Capable and powerful!
This chip supports up to 18 inputs/outputs with 11 analogue/touch sensor channels and an operating speed up to 64MHz using an internal oscillator. This chip has a single internal program slot, supports up to 32 external program slots and is capable of acting as an i2c slave device.
All X2 series parts support enhanced features such as configurable i/o pins, ring tone music and touch sensor inputs, i2c, spi and high-speed serial with background receive. Scratchpad memory plus separate Data EEPROM and Data Table are supported.
Click here for more X2 series information.
For more details see the What is PICAXE and PICAXE Pinout pages.
The PICAXE-20X2 can be used as a drop-in replacement for PICAXE-20M and PICAXE-20M2 chips.
Specification
Pack size | 40x10x15mm |
Pack weight | 2.8g |
The following table gives a brief summary of the various PICAXE chips.
For a more detailed comparison please see the PICAXE manuals and pinout diagrams.
Feature | 08M2 | 14M2 | 18M2 | 20M2 | 20X2 | 28X2 | 40X2 |
Memory Capacity (bytes) | 2048 | 2048 | 2048 | 2048 | 4096 | 4096 | 4096 |
RAM (bytes) | 128 | 512 | 256 | 512 | 256 | 1280 | 1280 |
Byte Variables (bytes) | 28 | 28 | 28 | 28 | 56 | 56 | 56 |
Input/Outputs Pins | 6 | 12 | 16 | 18 | 18 | 22 | 33 |
ADC/Touch Pins | 3 | 7 | 10 | 11 | 11 | 16 | 27 |
Max. Freq. (MHz) | 32 | 32 | 32 | 32 | 64 | 64 | 64 |
Serial In/Out | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Infrared In/Out | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
I2C | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Tune (ring tones) | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Parallel Tasks | 4 | 8 | 4 | 8 | 1 | 1 | 1 |
Program Slots | 1 | 2 | 2 | 2 | 1 | 4 | 4 |
The same software, BASIC language and USB download cable is shared between all the PICAXE chips.
Resources
PICAXE-20X2 Microcontroller Datasheet | PDF Datasheet |
PICAXE X2 Product Summary | PDF Datasheet |
Video
Revision History
Current 20X2 production firmware is version C.3
ISSUE - KBLED COMMAND DOES NOT WORK CORRECTLY
The kbled command does not light the keyboard LEDs as expected.
There is no workaround for this issue.
ISSUE - NAP 1 CAUSES RESET At K31 CLOCK FREQUENCY
To workaround this issue do not use 'nap 1' after 'setfreq k31'
All other values (e.g. 'nap 2') work correctly.
ISSUE - CALIBADC IS UNSTABLE AT >= 32MHz CLOCK FREQUENCY
To workaround this issue use two consecutive 'calibadc' commands to give time for the Vref to settle.
Previously resolved issues:
ISSUE - CORRECTED ISSUE WITH SHIFTIN AND SHIFTOUT IDLE HIGH MODES
The xxxx_H 'idle high' modes of shiftin and shiftout do not operate as expected.
To workaround this issue use the bit-busting routines described in manual part 2.
Fixed in vC.3
ISSUE - ISSUE WITH READREVISION FROM EXTERNAL I2C SLOT
The readrevision command did not function correctly on programs in external i2c memory.
Fixed in vC.3
ISSUE - MODIFIED FVR OPERATION SO NO LONGER RESET BY READADC COMMAND
A readadc command would reset fvrsetup to 0.
To workaround this issue reissue a fvrsetup command after the readadc command.
Fixed in vC.3
ISSUE - IMPROVED SERIN AND SEROUT BAUD RATE ACCURACY (9600_8)
The following baud rate settings are not as accurate as would be expected for serin/serout commands
: 9600 at 8MHz
: 4800 at 4MHz
: 19200 at 16MHz
: 38400 at 32MHz
To workaround this issue use the baud rate at a different setfreq frequency, e.g. instead of using
serin pin,N9600_8,variable
use 9600 at 16MHz instead e.g.
setfreq m16: serin pin,N9600_16,variable : setfreq m8
Fixed in vC.3
UPDATE - IMPROVED PULSOUT ACCURACY, INTERNAL INTERRUPTS NOW DISABLED DURING PULSOUT
The pulsout accuracy has been improved, and internal interrupts are now suspended to improve accuracy.
Updated in vC.3
ISSUE - USE OF PWMDIV ON DIFFERENT PWM CHANNEL NO LONGER RESETS OTHER PWM CHANNEL DIVIDERS
Use of pwmdiv on a pwmout channel could cause the divider on a different channel to be reset to 1.
Updated in vC.3
ISSUE - CORRECTED ISSUE WITH SHIFTIN COMMAND
The shiftin pin may not work correctly on certain pins.
To workaround this issue make sure the (SDI) data in pin in C.3, C.4 or C.5
Fixed in vC.2
ISSUE - CORRECTED ISSUE WITH RUN COMMAND SOMETIMES NOT WORKING IF SERVO IS ACTIVE
Run command may not activate quickly if active servo outputs in current program.
To workaround this issue switch off all servos and add a small delay before the run command.
Fixed in vC.2
ISSUE - PERIPHERAL MODULES (HI2C, HSERIAL, HSPI, SRLATCH) NOW RESET AFTER NEW PROGRAM DOWNLOAD
Some internal peripheral modules are not reset after a new program download.
To workaround this issue either manually reset these modules or simply press the reset button.
Fixed in vC.2
ISSUE - TIMER3 CLEARED AFTER RESET
Timer3 value is not cleared upon a (non power up) reset.
To workaround this issue manually reset using tmr3setup command.
Fixed in vC.2
ISSUE - PAUSE WITHIN AN INTERRUPT CAN NO LONGER BE INTERUPTED AGAIN AND HENCE SHORTENED
A pause within an interrupt command can be shortened if the interrupt condition is still true.
Fixed in vC.2
ISSUE - CORRECTED ISSUE WITH FIRST BYTE AFTER A BREAK IN HSEROUT BEING IGNORED
The first byte after a break within a hserout command is ignored.
To workaround this issue add an extra dummy byte at the start of the hserout command.
Fixed in vC.2
ISSUE - CORRECTED ISSUE WITH SERIN TIMEOUT HALTING BACKGROUND TASKS
Upon a timeout from a serin command background tasks such as timers and i2c can momentarily pause.
Fixed in vC.2
ISSUE - CORRECTED ISSUE WITH HPWM FULL AND HALF MODE OPERATION
HPWM modes do not work correctly.
Workaround for PWMHALF mode
Symbol PWMPOLARITY = PWMHHHH
PokeSfr $B9, %00001111
HPwm PWMHALF, PWMPOLARITY, 0, ,
PeekSfr $BD, b0
b0 = b0 | %10000000 | PWMPOLARITY
PokeSfr $BD, b0
Workaround for PWMFULL_F mode
Symbol PWMPOLARITY = PWMHHHH
PokeSfr $B9, %00001111
HPwm PWMFULL_F, PWMPOLARITY, 0, ,
PeekSfr $BD, b0
b0 = b0 | %01000000 | PWMPOLARITY
PokeSfr $BD, b0
Workaround for PWMFULL_R mode
Symbol PWMPOLARITY = PWMHHHH
PokeSfr $B9, %00001111
HPwm PWMFULL_R, PWMPOLARITY, 0, ,
PeekSfr $BD, b0
b0 = b0 | %11000000 | PWMPOLARITY
PokeSfr $BD, b0
Fixed in vC.2
ISSUE - CORRECTED ISSUE WITH SERVO COMMAND IN EXISTING PROGRAM PREVENTING DATA MEMORY AREA REPROGRAMMING CORRECTLY
A servo command in the current program can cause a verification error when reprogramming with a new
program (data program area only).
Workaround 1 - Add a '#no_data' directive to your program
Workaround 2 - Start the programming with a hard reset (ie power on)
Fixed in vC.1
ISSUE - CORRECTED ISSUE WITH STRONG PULL-UP OPTION BIT AFTER OWIN/OWOUT COMMANDS
The strong pull-up option after a owin/owout command does not work correctly with devices such as DS18B20
due to incorrect timing tolerances.
No workaround available.
Fixed in vC.1
ISSUE - CORRECTED ISSUE WITH SETTING Vref+ ON EXTERNAL ADC1
Bit 14 of ADCSETUP does not correctly select the Vref+ as external ADC1.
To workaround add 'pokesfr $22, 4' after the ADCSETUP command.
(note also that Vref- is always fixed to 0V on all versions of the 20X2)
Fixed in vC.1
ISSUE - CORRECTED ISSUE WITH HSPISETUP COMMAND
The hspisetup command does not automatically configure the pin B.7 as an output.
To workaround the issue add an 'output B.7' command directly after the hspisetup command.
Fixed in vC.1
ISSUE - CORRECTED ISSUE WITH HARDWARE INTERRUPT EVENTS (E.G. HINT0, TIMER ETC) STOPPING HSPI COMMUNICATION
HSPIIN / HSPIOUT commands can be erratically corrupted by other hardware interrupt events.
To workaround this issue disable all hardware interrupt based events during HSPI communication.
Fixed in vC.1
ISSUE - CORRECTED ISSUE WITH SERVO COMMAND AT 32MHZ
The servo command does not work at 32MHz
To workaround this issue add a 'pokesfr 11,194' command after 'setfreq m32'
Fixed in vC.1
UPDATE - MODIFIED SERVO COMMAND TO HELP REDUCE OCCASIONAL TWITCHING
Updated in vC.1
ISSUE - MODIFIED SEROUT TIMING FOR MORE RELIABLE OPERATION WITH AXE033 SERIAL LCD
On #var within 'serout' commands the data may be sent to quickly for AXE033 to process.
To workaround this issue use BINTOASCII instaed of #var
Fixed in vC.1
ISSUE - CORRECTED ISSUE WITH PLAY/TUNE/OWOUT/OWIN/READTEMP/READOWSN AFFECTING OTHER OUTPUTS
The play and tune commands operate but also incorrectly corrupt the value of up to two other output pins.
Two different workarounds are possible.
Workaround 1 - Use C,4, C.5 or C.6 for the piezo connection. These pins are not affected by the issue.
Workaround 2 - Make sure the affected associated pins are configured as inputs rather than outputs so
these associated pins will then not be affected.
Output Affected Pins Output Affected pins
B.0 A.0 AND B.1 C.0 C7
B.1 B.0 AND B.2 C.1 B.3 AND C.7
B.2 B.4 AND B.0 C.2 B.4 AND C.6
B.3 C.3 AND B.1 C.3 OK TO USE
B.4 C.4 AND B.2 C.4 OK TO USE
B.5 B.6 AND B.4 C.5 OK TO USE
B.6 B.7 AND B.5 C.6 N/A
B.7 C.0 AND B.6 C.7 C4
Fixed in vC.1
Share