PICAXE Questions & Answers



Everything's easy, once you know how.



Some answers to some commonly asked questions about the PICAXE processor range.

The Questions and Answers have been split into a number of parts, and are available on separate pages to keep each page to a reasonable size.

In-Depth Articles

Projects and Articles under development

Part 1 - Common Questions

Part 2 - Software Issues

Part 3 - Hardware Issues

Part 4 - Miscellaneous and Esoteric Issues

Part 5 - Known Bugs and Other Problems


Where is the latest online documentation ?

The latest online documentation can be found at ...


Where is the latest software download ?

The latest software for downloading can be found at ...


When will the PICAXE-08M be available ?

The PICAXE-08M became an officially available product in mid-July 2004.


Why doesn't Program Download always work ?

When the PICAXE is running, it monitors its Serial In line to determine if a new download has been initiated using the Programming Editor. When you initiate the download, the PICAXE sees the event, responds to the download request, and the PICAXE and Programming Editor manage the download between them, with the PICAXE executing the program once it is completely downloaded.

Because the PICAXE monitors Serial In, it is necessary to ensure that Serial In leg is connected to 0V for reliable operation when the download interface is not used in your PICAXE circuit.

There are a number of commands which require the complete attention of the PICAXE and it will not monitor the Serial In line while executing these; this means that the initiation of a new download is not recognised by the PICAXE and the Programming Editor will report that it was unable to download to the PICAXE.

The commands which will prevent the PICAXE recognising a new download are ...

  • SERIN
  • INFRAIN and INFRAIN2
  • PAUSE or WAIT longer than 5 seconds

Download may also not be recognised if a corrupt program is being executed by the PICAXE. This can occur when a download has failed because the download cable was removed or power failed during downloading. It is also possible to corrupt the program when using the WRITE command on PICAXE-08, 08M, 18 and 18A where EEPROM data shares the same space as program code; a write to a location which contains program code will corrupt it. It may also be possible to corrupt the program by using PEEK and POKE outside of the approved address ranges.

When the PICAXE is executing one of the commands which prevents it seeing a new download or the program code has become corrupted, it will be necessary to reset the PICAXE when the download is attempted.

A push-to-make 'Reset Button' can be fitted to all PICAXE's except the PICAXE-08 and 08M between the Reset pin and 0v; pushing the button will reset the PICAXE.

Note that the Reset pin should be connected to the PICAXE '+V' power supply line through a 4K7 resistor as below ..

+V -----------.---------------.-----------
              |               |
             .|.              |
         4K7 | |        .-----^-----.
             |_|        |    +V     |
              |         |           |
              |         |           |
              }---------| Reset     |
              |         |           |
            | O         |           |
   "RESET" ||           |    0V     |
            | O         `-----.-----'
              |               |
              |               |
0V -----------^---------------^-----------

A PICAXE that is not responding to downloads should be reset when the progress bar appears after download starts, or, for even better reliability, the reset button should be held down, the download initiated, and the button released when the download progress bar appears.

How to reset the PICAXE-08 and 08M is described in a later section.

Note that when resetting a PICAXE-08, 08M, 18, 18A or 18X in this way, the 4MHz operating speed will always be expected by the PICAXE, so 4MHz operation must be selected in the View/Options menu.


Why can't I do a Program Download at all ?

If your PICAXE is not allowing downloads, even when it is being held in reset until the download progress bar appears, there may be some other fault.

Unfortunately the reason, or even reasons, for the problem may vary depending upon whether you are using your own designed hardware or manufacturer's supplied hardware such as a PICAXE Starter Kit or CyberPet board.

The following are some of the reasons why program download may not be working although not all may be applicable to your own situation ...

  • Wrong Serial Port selected in Programming Editor
  • Download cable plugged in to wrong Serial Port on PC
  • Wrong PICAXE operating speed selected ( View/Options menu )
  • Broken download cable
  • Wrongly wired download cable
  • Wrongly wired download socket / connector
  • Missing or wrong components in the Serial In circuit
  • Solder shorts or track breaks on PICAXE PCB
  • PICAXE-08 Leg 7 not connected/linked to download socket
  • Reset pin not connected to +V via 4K7 resistor
  • Faulty PICAXE
  • PICAXE plugged into socket wrongly
  • No socket to PICAXE pin contact
  • No power to PICAXE
  • Wrong power supply voltage
  • PICAXE outputs drawing too much current
  • Incompatible PC Serial Port
  • PC Serial Port Socket not wired to motherboard
  • Wrong PC Serial Port D25 to D9 converter used

If you are using manufacturer's hardware, it is highly unlikely that there are any faults there, however check that the PICAXE is firmly seated in its socket and that you have connected the correct power supply voltage.

It is advisable to install the Programming Editor on another PC and check if a download can be done from there, and to check if you can download into a PICAXE which others can download into. This will help determine whether the fault lies with your PC or the PICAXE.

When using your own hardware, it is advantageous to be able to disconnect the PICAXE from the hardware for programming to help identify those cases where it is your circuit that is causing problems with download. A small vero-board ( strip-board ) or bread-board circuit can be fairly easily constructed for this purpose.


How do I reset a PICAXE-08 or 08M ?

Neither the PICAXE-08 or 08M have a Reset Pin and cannot therefore have a 'Reset Button' fitted in the same way as other PICAXE's; all Resets must be performed by removing the power to the PICAXE and re-applying it.

If the PICAXE is in a circuit which includes capacitors across the power supply lines ( and all circuits should have decoupling capacitors across the power supply near each IC ), and especially power supply smoothing capacitors, it may take a considerable time for the voltage delivered to the PICAXE to drop to a low enough level that the re-application of power is detected as a reset - This applies to all PICAXE's and not just the PICAXE-08 or 08M.

It is possible to use a single-pole, double-throw (SPDT) switch to create a 'Reset Switch' for the PICAXE-08 and 08M as below ...

+V In >----------O                 +V to PICAXE
                    \ O---------->   and other
             .---O                  electronics
             |
            .|.
            | | ?R
            |_| See Text
             |
             |
0V In >------^-------------------> 0V

The choice of value for the 'dump resistor' will depend upon the amount of capacitance within the circuit as all stored voltage will be dumped through the switch in a surge of current. If only decoupling capacitors, a single PICAXE and only passive components make up the electronics which is powered then it will normally be possible to replace the resistor with a link to 0V.


Can I use a PICAXE in a Safety Critical System ?

NO.

The PICAXE may never be used in a Safety Critical System.


Can I use a PICAXE in a Mission Critical System ?

Possibly, but think long and hard before you do.

It is necessary to understand what the system which includes the PICAXE is meant to do and the consequences should it fail or malfunction. If a failure or malfunction may put a life in danger, or lead to a life being put in danger, then it is a Safety Critical System and a PICAXE must not be used.

What may at first appear not to be a Safety Critical System may turn out to be so. A system fitted to a vehicle may not appear Safety Critical at first glance, but even something as apparently benign as an interior light delay circuit or a car burglar alarm in a failure mode could affect the vehicle's electrical system and lead to the loss of power and consequently affect steering, braking and other safety systems during driving. Such faults can obviously be life threatening, to passengers and others, even if not the driver, and such systems must therefore be considered as Safety Critical by consequence. That is why you should never fit a PICAXE system to an automobile's power supply or interface it to any other vehicle electronics.

Some systems may not be life threatening in their own right should the system fail, but may also be life threatening by consequence. Should a smoke detector system designed around a PICAXE fail then it will not alert occupiers of a fire or the smoke from it, which could obviously lead to fatalities. Such systems are, by consequence, Safety Critical Systems.

Other systems may be harder to classify; Home Burglar Alarms are a typical case in point. Such an alarm is obviously designed to prevent some loss which may occur if the system fails, so it is certainly Mission Critical. The question you must ask is - are you prepared to suffer the consequences of your system failing or malfunctioning ? If not, or are reluctant to do so, then do not use a system designed around a PICAXE.

Do not forget that it is usually not only the consequences to yourself which have to be taken into account, but the consequences to others - How do you explain when you have led your family to believe that something you have designed and built to protect them fails to do so, injures them, damages their valuable property or allows its loss ? Seeing your PICAXE project burn your family home down will not get you to the top of the popularity list.

If your burglar alarm or entry alert system is also designed to alert occupiers when entry is made into a property, then it may well be that your system is also Safety Critical. As can be seen; it's not a simple issue to deal with.

The rule of thumb is to consider anything and everything that could go wrong, and assume that it will, and what could go wrong is anything which has even the remotest likelihood of going wrong, from mains failure to a single faulty component. In professional terms this is "risk assessment" and "failure mode analysis", and both are incredibly difficult tasks to undertake properly and fully without previous experience and professional, qualified guidance.

It is absolutely essential that when you are considering what could go wrong that you are as pessimistic, cynical and as depressive as you can be; if it can go wrong it will, and it is necessary to know what that is and the consequences as early as possible. One failure may lead to another, and a small insignificant failure in its own right can have severe consequences - That's what tends to happen even in major disasters; Chernobyl, Three Mile Island, Piper-Alpha, even 9-11.

It is also necessary to get friends, family and colleagues to have a look at what you are doing, or proposing to do, in order to get their opinions; they may see something which you had never considered, or had dismissed as unimportant.

Do not forget that you are also likely to have faults in your PICAXE program code which you may be unaware of until it is too late.


How do I use a PICAXE in an Automobile ?

Do not attempt to connect a PICAXE into an automobile's electrical system

Only use a PICAXE in an automobile when it is not connected to the vehicle electronics or power supply in any away.

Incorrectly fitted electronics could easily lead to damage to your vehicle and may even lead to your own death or that of others.

It is highly likely that any electronics you add to an automobile will invalidate your insurance and make the vehicle illegal for use. The consequences could be that you may personally face huge legal bills should you be involved in an incident or accident ( even if it is not your fault ). You may be prosecuted, and face a prison sentence or large fine, if such electronics are found to be fitted by the police or other authorities.

If you are considering fitting a PICAXE to a vehicle which will not be used on the public highway, you will face numerous difficulties in making the PICAXE safe for use and in connecting the PICAXE to the vehicle electronics.

You will need to run the PICAXE from a regulated power supply, and will need to design your circuit to work with the voltages used within the automobile.

Most automobiles are so-called "12V Negative Earth", which means that the chassis of the car is at 0V and all power is +12V relative to the chassis. The actual voltage is however nominally 13.8V, but the voltage may often exceed this by a huge amount - hundreds of volts - for brief periods, and may also drop well below that.

The extremely high voltages, low voltages, brown-outs, and general 'noise' and interference which can be found on an automobile's power supply can make it extremely difficult to connect any electronics into a vehicle. The power supply needs to be protected from the massive input voltages which can destroy the power supply and other electronics, and drops in voltage may cause the electronics to reset or latch-up.

On top of that; any electronics you fit to an automobile may cause problems to other electronic systems within the vehicle and may render safety and other necessary equipment ineffective. Any flaws in your electronic design or faults in assembly may lead to consequences which are not acceptable; fire and even death.

Do not attempt to connect a PICAXE into an automobile's electrical system or interface it to any other vehicle electronics.


How fast is a PICAXE ?

This is one of the most difficult questions to answer about the PICAXE in a meaningful way. As with modern desktop PC's the speed of program execution is not a direct reflection of the speed of its controlling oscillator.

The PICAXE range uses a 4MHz oscillator by default, with the PICmicro it is based upon having a 1uS instruction cycle. This equates to a basic 1 MIPS ( Million Instructions per Second ) execution speed, although some instructions do take two cycles to execute, slowing it slightly.

The PICAXE is however what's called a pre-programmed interpreter, and while the interpreter program itself runs at 1 MIPS, the program it interprets ( your encoded Basic Language program ) is run much slower. It is estimated from testing that the interpreted instruction set executes about 250 times slower, giving an interpreted instruction speed of around 0.004 MIPS, but this can vary as the actual instruction time depends upon where the instruction is placed in program code memory in the PICAXE, and how long a particular statement takes to execute depends upon how many things it has to do; how many instructions it converts to.

It is therefore not easy to give a clear or meaningful measure of PICAXE speed. And while the estimated 0.004 MIPS seems incredibly low at first glance, it is often far more important to know that a program will complete its task in the time allocated to do it, rather than how long it does actually take. The following code snippet takes 0.9mS to execute on a PICAXE-18 at 4MHz ...

    Loop:
        pins = pins ^ $FF
        GOTO Loop

This equates to around 2000 Statements Per Second, but that is not reflected accurately in the execution of other statements, some of which are quicker, some slower. You may often get much better performance than this, but it cannot be guaranteed, and you may also see worse performance in some cases. Some statements such as WRITE and those accessing I2C and other peripherals can be much slower than other statements. The execution time of the SERIN and SEROUT statements are dependant upon the baud rate selected; the higher the baud rate, the faster their execution. Overall execution speed will drop massively whenever a DEBUG statement is executed, but the inclusion of DEBUG statements does not slow the program down unless they are executed.

The PICAXE 08, 08M, 18, 18A and 18X all use an internal "RC" oscillator and do not have reliably stable operating speeds which will vary due to manufacturing tolerances and with changes of temperature and operating voltages. It is not uncommon that a particular program may run 10% faster or slower on a same variant PICAXE under different environmental circumstances.

The PICAXE-28, 28A, 28X and 40X all use a resonator or crystal controlled osciallator which will give much more stable and consistant operating speeds.

The PICAXE 08M, 18A and 18X can have their operating speeds doubled by use of the SETFREQ command which will give a better, doubled, Statements per Seconds figure, as will the PICAXE-28, 28A, 28X and 40X when an 8MHz resonator or crystal is used. A PICAXE-28X or 40X can do even better, delivering a quadrupled Statements per Seconds figure when a 16MHz resonator or crystal is used.

As a rule of thumb, for guidance only; at 4MHz, you can expect a PICAXE to execute around 2000 Statements per Second, at 8MHz that figure becomes 4000, and at 16MHz it becomes 8000.


PICAXE is a trademark of Revolution Education Ltd. These PICAXE pages are produced entirely independantly of Revolution Education Limited and may not reflect the opinion of Revolution Education Limited or its agents. The information provided is based upon and derived from information published by Revolution Education Limited, other sources of PICAXE information and the author's own experiments and prior experience. The views expressed by the author do not necessarily represent those of Revolution Education Limited or its agents. While every effort has been made to ensure that the information on these PICAXE pages is accurate and correct, the author can accept no responsibility for any errors or ommissions which do occur. The information provided is used entirely at your own risk.





Associated Articles

  The PICAXE Processors
  PICAXE News
  PICAXE Comparisons
  PICAXE Pinouts
  PICAXE Serial Interfacing
  PICAXE Serial Interfacing
  PICAXE Infra-Red Interfacing
  PICAXE Wireless Interfacing
  PICAXE LCD Interfacing
  PICAXE LCD Interfacing
  A Real-Time Clock for the PICAXE-18X
  PICAXE Optimisations
  The PICAXE Birthday Box Project
  PICAXE Telephone Exchange Simulator
  The Brainf**ked PICAXE
  The PICAXE Extended Programming Interpreter
  Build Your Own Basic Stamp
  Tech Toys



Sites to Visit

  PICAXE Home Page
  Revolution Education Ltd

  Tech-Supplies Ltd



Site Navigation

  Home Page
  What's New
  Search
  Add Bookmark
  Have Your Say
  Guestbook




First published on Friday the 5th of December, 2003 at 02:44:52
Last upload was on Friday the 7th of January, 2005 at 13:07:16