Frequently Asked Questions

Programming FAQ - other sub sections available via the tabs

Programming Techniques

What operating system does Programming Editor Require?

Programming Editor is a Windows only application.

For Linux and Mac OS users the AXEpad application is available. AXEpad is also available for Windows but we recommend using Programming Editor for Windows users.

Which Windows version does Programming Editor require?

Programming Editor will work with 32-bit and 64-bit versions of Windows XP, 2000, 2003, Vista and Windows 7.

Does Programming Editor work with Windows 95 or 98?

The Programming Editor does not work with Windows 95, Windows 98 or earlier versions of Windows.

Why use the PICAXE instead of assembler or C?

The PICAXE uses a simple BASIC language (or flowcharts) that younger students can start generating programs with within an hour of first use. It is much easier to learn and debug than either C or assembler code.

The second advantage is the direct cable download method. The software is free and so the only cost per computer is a low-cost download cable. This enables students to buy their own cable and for schools to equip every single computer with a download cable. Other systems that require an expensive programmer are generally too expensive to implement in this way.

Finally as the PICAXE chip never leaves the board, all leg damage (as can occur when the chip is moved back and forth from a programmer) is eliminated.

Can I mix assembler with BASIC code?

No. The BASIC command language does not allow the use of assembler.

Do symbols increase program length?

No. All symbols are converted back to 'numbers' by the computer software prior to download and so have no effect on program length. You can use as many symbol commands as you wish.

How do I test more than one input at once?

Use the following command to test two inputs together -

if pinC.0 = 1 and pinC.1 = 1 then...

or either of two inputs -

if pinC.0 = 1 or pinC.1 = 1 then...

How do I create time delays longer than 65 seconds?

The best way of creating long delays is to do minute delays with a loop, for example, to wait an hour (60 minutes) -

for b2 = 1 to 60 'start a loop
pause 60000 'wait 1 minute
next b2 'next loop

The PICAXE microcontroller works at a nominal 4MHz (M2 parts) or 8MHz (X2 parts), but due to device manufacturing tolerances there is likely to be a drift of a few seconds over long time periods (e.g. a day).

Note that the Serial LCD/Clock module (AXE033) has a precision clock and 'alarm clock' function that can be used to trigger the PICAXE at predefined interval or at certain time/dates with much greater precision.

Both M2 and X2 parts can also be used with the i2c DS1307 real time clock.

Does the PICAXE support interrupts?

Yes. All M2 and X2 parts support a 'polled interrupt' on input pins using the setint command. The polled interrupt scans the input pins between every BASIC command (and constantly during pause commands), and so activates very quickly.

The X2 parts also support 'hardware interrupts' on specific input pins using the hintsetup command. Whenever a hardware pin interrupt is detected it is flagged until cleared.

Using the setintflags command allows the interrupt routine to be called between BASIC commands to respond to the hardware interrupt flags and other interrupt conditions.

The PICAXE uses the internal microcontroller interrupts for some of its BASIC commands (e.g. servo). Therefore the internal microcontroller interrupts are not available for general use.

What notes are generated by the sound command?

The sound command generates different 'beep' sounds for the values 1-127.

The tune and play commands are specifically designed to play tunes and musical notes.

Can I run more than one program at a time?

The PICAXE M2 parts support up to 8 separate program tasks which can be active at the same time.

The PICAXE 08M2 and 18M2 support up to 4 program tasks, the 14M2 and 20M2 support up to 8 program tasks.

What version is my PICAXE firmware?

The version of your PICAXE firmware can be determined by using the 'Check Firmware' button within the Programming Editor.

How do I tell if my PICAXE firmware is the latest version?

In the directory in which the Programming Editor is installed (often C:\Program Files\Programming Editor) you will find a firmware.txt file which contains details of PICAXE firmware versions.

How do I upgrade my PICAXE firmware?

It is not possible to upgrade PICAXE firmware outside of our production facilities. If you require PICAXE firmware to be upgraded then please contact our technical support team.

What download cable do I need?

We recommend the AXE027 USB download cable for the PICAXE M2 and X2 parts.

How do I install the AXE027 USB cable drivers?

Please follow the instructions in AXE027 USB Cable Installation Guide

Which AXE027 USB cable driver should I use?

The AXE027 drivers are available from this site and can be found on the AXE027 USB Cable Driver page.

Does the AXE027 USB cable driver work with my Windows version?

The AXE027 USB driver is suitable for use with 32-bit and 64-bit versions of Windows XP, 2000, 2003, Vista and Windows 7.

Can I use other download cables?

We recommend the AXE027 USB download cable for the PICAXE M2 and X2 parts.

Older RS232-style serial cables (AXE025, AXE026 and USB010) are compatible with the standard download interface and may continue to be used but may sometimes give erroneous readings on analogue, touch and other commands. We recommend using an AXE027 in preference to those cables.

We do not recommend the use of other USB to serial cables or modules as these may have device driver, signal polarity, voltage and interfacing issues when used, can cause problems with downloads and may be difficult or impossible to get working with a PICAXE system.

How is a download started?

When the computer starts a download an interrupt is generated on the serial input pin on the PICAXE. This interrupts the main program and puts the PICAXE into a state for a new download to be received. Therefore you must ensure that the 'serial in' pin is tied to ground (0V) via the 22k/10k resistors on ALL project boards for reliable operation of the microcontroller (to prevent unwanted 'floating pin' interrupt signals).

Do I need to erase the PICAXE?

There is generally no need to erase the memory at any point. However if you want to stop a program running you can select the 'Clear Hardware Memory' menu to download an 'empty' program into the PICAXE memory.

How do I stop a PICAXE program?

Each download automatically overwrites the whole of the previous program. If you want to explicitly stop a program running you can select the 'Clear Hardware Memory' menu to download an 'empty' program into the PICAXE memory.

What is the memory capacity of a PICAXE?

The PICAXE M2 parts have 2048 bytes of program and 256 bytes of EEPROM data memory.

The PICAXE X2 parts have 4096 bytes of program and 256 bytes of EEPROM data memory. In addition the X2 parts can access up to 32 slots of external program memory of 4096 bytes each held in I2C EEPROM. The 28X2 and 40X2 have four slots of internal program memory of 4096 bytes each.

The PICAXE X2 parts include 256 bytes of table data, similar to EEPROM data memory but read-only.

The eeprom command is used (within the program) to preload data EEPROM which can then be accessed and changed with the read and write commands.

The table command is used (within the program) to preload table data which can then be accessed with the readtable and tablecopy commands.

The program and data EEPROM (plus table data for the X2 parts) is usually overwritten with every download. To prevent the data EEPROM from being overwritten the #no_data command may be used. To prevent the data EEPROM from being overwritten and the data table being downloaded on the X2 parts the #no_table command may be used.

How large can a PICAXE program be?

This varies on the commands used, as not all commands use the same amount of memory.

There is no fixed 'byte' formula as to memory usage e.g. pause 5, pause 50 and pause 500 will all take different amounts of memory space! To calculate memory usage use the 'Check Syntax' option from the PICAXE menu. This will report the amount of memory used.

As a rough guide, a PICAXE M2 can hold a program of between 600 to 1800 lines of code (ignoring blank lines, comments and 'symbol' definitions), a PICAXE X2 can hold 2000 to 3200 lines of code per program slot.

Some commands, such as sound and serout use more memory and so will reduce this count. In our experience most educational programs that are too long to download are generally badly composed, and can be greatly reduced in size by use of sub-procedures etc.

My program is too long! What can I do?

Tips for reducing program length (see BASIC Commands help file for more details):

1) Use 'let pins =' instead of multiple high/low commands
2) Use sub-procedures for repeated code
3) Try to reduce the use of sound and serout commands, which use a lot of memory
4) If using an LCD, store the messages in the AXE033 Serial LCD Module, rather than in the program
5) Use eeprom and read commands to store messages in data memory
6) Restructure your program to reduce the number of 'goto' commands
7) Use a PICAXE chip with the largest memory ( X2 parts )

You can use the 'PICAXE>Check Syntax' menu to test the length of your program without a download.

Why is an 'empty' program not 0 bytes long?

Each downloaded program contains some configuration data, and an end command is always added automatically to the end of each downloaded program. Therefore an 'empty' program on screen will not generate a zero byte program.

To prevent the end command being automatically added to the end of a program use the #no_end directive.

Can I see the assembler code downloaded into the PICAXE?

The BASIC commands are converted to a tokenised form when downloaded so are not stored within the PICAXE memory as either source code nor as assembler code.

How often can a PICAXE be reprogrammed?

PICAXE chips can be reprogrammed at least 100,000 times. Note this is a minimum value and the actual value may be much greater.

Can I read my program out of a PICAXE?

No. Downloading your program into a PICAXE is a one way process and there is no mechanism to get it back. This protects your program code from being taken or exploited by someone else without permission.

We recommend that when developing PICAXE programs you save the program to disk and make regular backup copies.