PICAXE

From Wikipedia, the free encyclopedia

PICAXE is the name of a UK-sourced microcontroller system based on a range of Microchip PICs. There are presently (early 2007) 8 offerings, titled by the number of chip pins 8,18,28,40 [1].Although initially intended for education and electronics hobbyists, they've gained wider use in serious technical fields, especially for rapid prototype development. All use pre-loaded factory bootstrap interpretation code to allow user generated programs to be downloaded using a simple RS-232 serial connection.


The High Level Language used to program PICAXE chips is similar to that used in the US-sourced BASIC Stamps, and resembles the BASIC programming language. Like the BASIC Stamp the PICAXE system is interpreter-based but, rather than using an external I²C EEPROM for program storage, uses either on-chip EEPROM or Flash Memory. This allows a single-chip solution which is far cheaper,and with a smaller circuit footprint, than the comparable BASIC Stamp circuit.

Although the interpreter naturally slows system speeds, typically 4000 commands a second can be handled - more than enough for applications as diverse as data logging, LED sequencing, sounds, wireless data comms (especially 433 ISM & ZigBee), and even motor or process control.

PICAXE is a registered trademark licensed by Microchip Technology Inc. PICAXE products are developed and distributed by Revolution Education Ltd. www.picaxe.com Revolution Education is not an agent or representative of Microchip and has no authority to bind Microchip in any way.


PICAXEs require a bare minimum of components to provide a complete development platform. A PICAXE microcontroller can control a LED, via code as simple as:

DO
     TOGGLE 1
     PAUSE 100
LOOP

Contents

[edit] Hardware

Based upon a variety of Microchip PICmicros, as of early 2007 there are eight members of the PICAXE family. The chips come in a number of DIP footprints, from an 8-pin, 128-byte program capacity device ( the PICAXE-08) through to a 40-Pin, 2048-byte program capacity device (the PICAXE-40X).

The deceptively powerful 8-pin PICAXE-08M is priced at just ~GBP£2 and is considered the best entry-level PICAXE. It includes commands to both send and receive 38 kHz IR data, its memory stores some 80 lines of code, and it lends itself to easy prototyping using solderless breadboards or via diverse Rev. Ed and third-party soldered PCBs.

Both the PICAXE-08(M) and 18 range use an internal 4/8 MHz oscillator, and hence require few (if any) components to create a basic hardware platform.

[edit] Minimal configurations

The PICAXE-08 and 08M require nothing more than the connection of power to operate, although the Serial In pin used for downloading must be connected to 0V (directly or through a resistor) to ensure proper operation.

In addition to the power and Serial In pin connections, the PICAXE-18 range requires a pull-up resistor (4K7 recommended) to the +V rail from the Reset pin. An optional Reset button can be added between the Reset pin and 0V.

The PICAXE-28 and 40X require the connection of a resonator or crystal plus associated capacitors in addition to power, Reset and Serial In pin connections.

[edit] Power supply requirements

PICAXE supply voltages are usually very flexible (3 - 5.5V) and with current drains of only a few mA (load dependent), even cheap AA batteries can be used. 3 x 1.5V AAs (= 4.5V) have become the default supply standard, although normal 7805 3 terminal regulators can also be used. A capacitor with short leads across the power pins is recommended.

[edit] Low power modes

The PICAXE offers two commands (SLEEP and NAP) to put the device into low power operating modes in order to conserve power and extend operational lifetime when powered by batteries.

The PICAXE-08M, 18A and 18X have controllable clocks, allowing for operation below their nominal 4 MHz or 8 MHz oscillator frequencies, to achieve even lower power consumption. Execution speed can be controlled by the user program.

[edit] Non-volatile data storage

All PICAXEs contain non-volatile data memory which allows data to be stored and recovered when power is removed. Access to the non-volatile data memory is through the use of the READ and WRITE commands and, on the PICAXE-28A, the READMEM and WRITEMEM commands can also be used.

The amount of non-volatile data memory available depends upon the PICAXE device:

  • The PICAXE-08 and 18 have 128 bytes of EEPROM which is used to store both downloaded program and for non-volatile data memory use.
  • The PICAXE-08M has 256 bytes of EEPROM which is used to store both downloaded program and for non-volatile data memory use.
  • The PICAXE-14M has 256 bytes of EEPROM which is used to store both downloaded program and for non-volatile data memory use.
  • The PICAXE-18A and 18X have 256 bytes of EEPROM exclusively available for non-volatile data memory use.
  • The PICAXE-28 has 64 bytes of EEPROM exclusively available for non-volatile data memory use.
  • The PICAXE-28A has 64 bytes of EEPROM exclusively available for non-volatile data memory use and also has 256 bytes of Flash memory which may be used for non-volatile data storage using the READMEM and WRITEMEM commands.
  • The PICAXE-28X and 40X have 128 bytes of EEPROM exclusively available for non-volatile data memory use.
  • The PICAXE-28X1 and 40X1 have double program and variable memory and additional 128 bytes scratch pad memory. I has also many new features for IO etc.

[edit] Software

All programming development is done using the Programming Editor. This free software download (~24MB with registration required) supports the entire PICAXE programming environment from source code editing to program downloading. Only Microsoft Windows 98 or later is supported. A serial port must be available to download programs into a PICAXE; modern USB-only PCs will need a USB-serial adaptor.

The Programming Editor also includes a number of Wizards which aid in PICAXE program and project development.

Editing can be done in plain text or RTF with colour syntax highlighting. Source code can be created outside the Programming Editor and imported for downloading. Programs can be created in a Basic-like language or by using a visual flowcharting tool. The Programming Editor also supports PICmicro Assembly Language programming.

Beyond a command line downloader provided by the manufacturer for commercial developers, all software is by way of the graphical IDE.

[edit] Simulator

Version 5 of the official Programming Editor software includes a comprehensive line by line on-screen simulation of the BASIC program. This enables users to step through the program on-screen, to watch the program in operation, and help identify any programming errors (ensure that the software is set to 'Enhanced Compiler' to use this option).

[edit] Tune wizard

This Wizard is used to create TUNE commands which can be used with the PICAXE-08M. The Wizard includes the ability to import suitable mobile telephone ring tones and convert them to appropriate TUNE commands.

[edit] Serial LCD CGRAM wizard

This Wizard provides a visual means to create custom defined characters to be used with serial LCD displays. The desired character is specified by selecting pixels which will be displayed on a 7x5 grid and the necessary command to program that character within the LCD is generated.

[edit] Datalogger wizard

This Wizard is used to generate datalogging programs for the PICAXE.

[edit] PICAXE connect wizard

This Wizard allows the configuration of MaxStream XBee (ZigBee)modules to be configured for use with a PICAXE.

[edit] PICAXE net server wizard

This Wizard allows configuration of the PICAXE.net Web Server product. The Wizard provides the ability to create and upload page images and to upgrade the web server firmware.

[edit] Programming language

The programming language is BASIC-like and very similar to that used by the Basic Stamp 1 (BS1). Most programs written for the BS1 should be easily convertible for use with the PICAXE. The most notable difference is that the BS1's POT command has been replaced by the READADC command which allows an analogue voltage to be read directly by the PICAXE.

The programming language has been enhanced to include high-level support for underlying processor capabilities and additional functionality for various devices. All PICAXE processors support a common core programming command set but not all support all commands.

[edit] Variables

The programming language provides only 14 bytes readily available to the programmer. This memory can be manipulated in measures of bits (bit0-15), bytes (b0-13), and 16 bit words (w0-6). The bit, byte, and word variables all overlap in the same 14 bytes. Every two byte variables overlap with a word variable, so b0 & b1 make up w0, b2 & b3 compose w1, and so on. The bit values bit1 - bit7 overlap b0, and bit8 - bit15 overlap b1 (which also covers w0). This can be used to carve apart variables, or simply make the most efficient use of the limited memory given.

Variables can be given meaningful names for use within a program through use of the SYMBOL directive. The SYMBOL directive can also be used to create named constants.

In addition to the pre-defined variables, all but the PICAXE-08 have access to the internal SFR (Special Function Registers) of the PICmicro they are based upon, allowing much of the unused SFR to be used as Random Access Memory (RAM) during execution. This can be used for temporary storage of variable values (using PEEK and POKE) and allows re-use of variables within subroutines and other code sections. Most parts have a 32 byte span free for use.

The PEEK and POKE commands can also be used to implement byte arrays and software stacks.

The READ and WRITE commands, which allow data to be stored in and retrieved from the PICAXEs non-volatile EEPROM memory, can be used to retain data and settings while the PICAXE is powered down.

[edit] Arithmetical manipulation

All arithmetical operations within the PICAXE are performed using 16-bit, unsigned, positive only operations. Variables are expanded as required to 16-bits on use by leading zero padding and results of processing are stored by truncating the resultant value to an appropriate number of bits before storage. A byte variable will have the eight least significant bits of the result stored, a bit variable will be set to the least significant bit value of the result.

Care must therefore be taken when manipulating variables and values to consider the effect of wrap-round, underflow and overflow. In particular it must be noted that a value can never be less than zero, and a byte value can never exceed 255. These issues must be considered in the implementation of FOR-NEXT loops and other looping constructs, which may, under some circumstances, never meet their terminating conditions. The PICAXE has no facility to automatically report or indicate warp-round, underflow or overflow.

All arithmetical expressions in assignments (LET) are evaluated in a strictly left-to-right maner. There is no operator precedence nor any ability to alter precedence using parentheses or bracketing.

[edit] Program flow control

The PICAXE provides a number of control constructs to handle program flow -

  • GOTO - Redirects program execution to another location in the program.
  • IF-THEN - Not the usual "IF condition THEN statement". The only statement IF/THEN takes is a Label: , which it does a "GOTO" when the condition is true. IF/THEN falls to the next line when the condition is false.
  • BRANCH - Conditionally redirects program execution to one of a number of locations in the program ( similar to ON-GOTO in other BASIC dialects ).
  • GOSUB - Redirects program execution to another location in the program, then continues after the GOSUB command following the execution of a RETURN in the subroutine.
  • RETURN - Returns program execution to after the most recent GOSUB.
  • SETINT - Enables interrupts and automatically redirects program execution to an interrupt handler when an interrupt is detected. Program execution continues from where the program was diverted from upon execution of a RETURN within the interrupt handler. Note that even though SETINT can handle interrupts from several inputs, it is allways working on an "AND" - basis, meaning that all I/O must be excactly as defined at the same time before riderection takes place.
  • FOR-NEXT - Repeats a section of code while a variable value is within a specified range.

With the introduction of the 5.0.X Programming Editors in 2006, the PICAXE supports a number of block structured constructs and constructs found in other BASIC language dialects -

  • IF-THEN-ELSE-ENDIF - Selects one of two paths of execution dependant upon conditions. Also supports an ELSEIF clause.
  • SELECT-CASE-ENDSELECT - Selects one of a number of paths of execution depending upon value of a variable matched against a list of conditions.
  • DO-LOOP - Conditionally repeats a section of code. Allows construction of WHILE-DO and REPEAT-UNTIL loops.
  • ON-GOTO - Conditionally redirects program execution to one of a number of locations in the program.
  • ON-GOSUB - Conditionally calls one of a number of subroutines in the program.

[edit] Program size

The size of program permitted is dictated by the on-chip EEPROM or Flash capacity of the PICAXE device.

  • The PICAXE-08 and 18 have 128 bytes of program memory allowing programs of approximately 40 lines of source code.
  • The PICAXE-08M, 18A, 28 and 28A have 256 bytes of program memory allowing programs of approximately 80 lines of source code.
  • The PICAXE X-range have 2048 bytes of program memory allowing approximately 600 lines of source code.

Because the program downloaded into the PICAXE is stored as variable length tokens, it is not possible to easily predict the size of program which will be generated from any given source code. In particular, the program size will vary depending upon what value constants are used and which input and output pins are referenced in various commands. The Programming Editor does however provide a Syntax Check function which allows the size of program generated to be determined without having to download the program into a PICAXE. This also allows PICAXE programs to be developed and checked even without access to target hardware.

The variable length size of tokens, coupled with the inability to predict their alignment within the PICAXE program memory also means that it is not possible to accurately predict the execution speed of any particular command, although typically this will be a minimum of 250 microseconds at normal 4 MHz operating speed.

[edit] Subroutine nesting

All PICAXE processors support a total of 16 subroutine call statements (GOSUB) in a program (15 if the PICAXE supports interrupts). The X-range supports up to 256 GOSUB statements.

Subroutines can be nested to a depth of four levels. One level of depth must be reserved for interrupt handler use when interrupts are enabled.

[edit] Illusion of limited capabilities

Although PICAXE processors are constrained devices, with a limited number of variables, limitations in the programming command structures and, on lower-end devices, limited program memory, these limitations have not prevented many successful projects and applications from emerging. PICAXEs are increasingly being used in (and to support) many commercial products.

Provided as a range of devices, each offering differing capabilities and functionality, projects and designs can be tailored to using a particular PICAXE to meet requirements at lowest cost. Their low cost also allows multiple PICAXE configurations to be used and still be cost effective to alternative single-chip solutions. Using multiple PICAXEs also has many advantages in system design and modularisation.

[edit] Points of note

[edit] PEEK and READ

Whereas most internal processing is done using 16-bits, a value read using the PEEK or READ commands is returned as an 8-bit value, and when stored in a word variable, only the least significant bits of that word will be altered.

[edit] RANDOM

The RANDOM command provides pseudo-random number generator functionality which updates a variable to a new value when it is used. The new value is determined by the existing value of the variable when the RANDOM command is used.

Because all variables are initialised to zero when power is applied or the PICAXE is reset, the variables to be used with RANDOM should be seeded first to prevent the same sequence of random numbers being generated whenever the program is started. Seeding can be done by storing and updating a seeding value within the PICAXE's non-volatile EEPROM memory. A mechanism to avoid seeding is to repeatedly execute RANDOM (such as when waiting for an input condition) so the value it has generated will be unpredictable when it is used later.

Although RANDOM can be used with a byte variable, because such a byte value is expanded to 16-bits before the randomising function is applied, the sequence of 'random results' will be very short and produce only a limited set of values.

[edit] MIN and MAX

The MIN and MAX operators using in assignments are 'limiting operations', ensuring that the result of the expression evaluated to that point never falls below or exceeds a specified value respectively.

Although somewhat counter-intuitive, MIN can also be thought of as returning the highest of two values, and MAX can be thought of as returning the lowest of the two.

[edit] Programming interface

Programs are downloaded from the Programming Editor using a serial link, either a physical serial port or a USB to serial adapter. USB serial ports must be able to support RS232 break signalling for successful use.

The basic programming interface to the PICAXE consists of just two resistors and does not need RS232 level converters.

[edit] Debugging facilities

Although the PICAXE development environment offers neither simulation of programs nor single-stepping of executing programs within a PICAXE device, there are a number of options for debugging downloaded programs.

  • If spare output lines are available, these can be used to control LEDs or Piezo sounders to visually or audibly indicate the program's execution reaching the points where such commands are placed. The Serial Output command (SEROUT) can be used to send execution progress indicators and variable content information to a PC or other terminal device.
  • Many PICAXE processors support the SERTXD command which is equivalent to using the SEROUT command to return information about program execution but it uses the Serial Out line of the download interface alleviating the need to use a Digital Output line for this purpose.
  • All PICAXE processors support the DEBUG command. When used with the Debug Monitoring facilities of the Programming Editor, the contents of the PICAXE variables when the DEBUG command is executed can be observed.

[edit] Interfacing

Being based upon the PICmicro, the PICAXE has great versatility in interfacing. Most PICAXE processors support the on-chip hardware of the underlying PICmicro.

[edit] Digital outputs

Digital Outputs can each sink and source around 20mA and are capable of driving LEDs and other loads directly.

[edit] Digital inputs

Most Digital Inputs are protected by diode clamps to the power rails, which as well as offering good ESD protection, allows interfacing to high voltage signals often with little more than a current limiting resistor being required.

This is particularly useful for interfacing to PCs, PDAs and terminals where a complete serial interface can be implemented using just one resistor. This allows for low-cost designs which do not necessitate the use of RS232 level conversion circuits, although such converters can be used to provide a more traditional interface if desired.

[edit] Bi-directional inputs and outputs

The PICAXE-18, 18A, 18X, 28 and 28A have fixed direction Input and Output pins. That is to say that every pin is pre-defined as either an input or an output and this use cannot be explicitly changed under program control.

The PICAXE-08 and 08M have three bi-directional pins which can be either input or output pins and can be explicitly set as such and changed under program control. The PICAXE-28X and 40X also have eight 'PORTC' lines which can be made inputs or outputs under program control.

At the start of program execution (after power is applied or the PICAXE is reset) the bi-directional pins will automatically be set as inputs and only become outputs when instructed by the executing program.

Because it is not always clear what program has previously been downloaded into a PICAXE which supports bi-directional pins, care must be taken when inserting such a PICAXE into alternative hardware. It is recommended that a PICAXE should have its existing program erased before it is inserted into hardware different to that which it was previously used with. Inadvertently, or deliberately, making an input line an output line may have damaging effects upon the PICAXE and any hardware connected to those pins.

[edit] Interrupts

The PICAXE-08M, 18A, and all X parts support hardware interrupting on a pattern match with the input pins.

[edit] Analogue inputs

All PICAXE processors support analogue input. The PICAXE-08 and 18 support only coarse, low-resolution analogue inputs which is delivered as one of 16 8-bit levels. The others support full 256-level, 8-bit analogue input, and some offer 1024-level, 10-bit inputs.

The number of analogue inputs depends on the actual device, and in some cases the analogue inputs and digital inputs share the same pins, allowing them to be used as either analogue or digital inputs, and with some design, both.

[edit] Analogue outputs

Like most microcontrollers, the PICAXE does not have any ability to generate an analogue output voltage directly, however analogue voltages can be produced by using the PICAXE PWM output capabilities plus the addition of suitable circuitry.

[edit] Dallas one-wire device

The PICAXE Firmware supports interfacing with some Dallas 1-Wire devices, including the iButton and DS18B20 Temperature sensor. The firmware also provides the ability, through the READOWSN command, to read the unique serial number of any 1-Wire device, whether it can access and use that device's capabilities or not.

[edit] I²C

All of the X Parts (18X, 28X, and 40X) have the capability to use the in-built I²C commands for reading and writing to most I²C devices.

Prior to firmware revision 8.6 on the 18X, and 7.7 on the 28X and 40X, the device being accessed must require at least two data bytes (3 bytes total including the address byte) to be able to be used with the built in picaxe commands. Starting with the above mentioned firmware revisions, and the latest editor software, devices that only require two bytes (an address byte and a data byte) can be used.

Some limitations with the firmware controlled I²C functions are that there is no control beyond telling the picaxe to read or write. Protocol options like repeated start, early stop, attention, and using the picaxe as an I²C slave are not supported. By the use of bit banging the signals, however, the entire gamut of I²C options can be used, but this requires an in depth familiarity with the I²C protocol itself.

[edit] Infrared

The PICAXE offers three commands to support infrared interfacing -

  • INFRAIN - Allows reception of infrared signals which use Sony's SIRC protocol. This command is tailored to supporting key press codes which would be sent from a TV remote control and supports only a subset of possible remote control commands.
  • INFRAIN2 - Allows reception of infrared signals which use Sony's SIRC protocol. This command allows the reception of any remote control command.
  • INFRAOUT - Allows the generation of an infrared signal using Sony's SIRC protocol.

The INRAIN and INFRAIN2 commands require that an external infrared sensor (TSOP18) is used to demodulate the incoming infrared signal for processing by the PICAXE. INFRAOUT can be used to drive an infrared LED (and optional visible light LED) directly.

PICAXEs which support neither the INFRAIN nor INFRAIN2 commands can read incoming infrared signals which use Sony's SIRC protocol by means of bit-banging; sampling the signal provided by the infrared sensor and determining the remote control command sent. This technique is also applicable for decoding infrared signals sent using other protocols, but is not suitable for all such protocols.

[edit] LCD

All PICAXE processors can interface to serially controlled LCDs using the SEROUT command providing they use a baud rate which is supported by the PICAXE.

All but the PICAXE-08 and 08M can directly control Hitachi HD44780 and similar LCDs operating in parallel, 4-bit mode. The PICAXE-08 and 08M, having too few output lines to support direct interfacing, can connect to such displays, but only through additional interface circuitry, for example by using shift registers. Such interfacing schemes can also be used by any of the other PICAXE devices.

[edit] PC keyboard

The PICAXE-18A, 28A and the X-range all provide the ability to interface to a PC keyboard using the KEYIN and KEYLED commands.

These two commands respectively allow a PICAXE to determine which key was pressed on a PC keyboard through its scan code and to control the setting of the keyboard LEDs. The KEYIN command can be used to flash the keyboard LEDs to indicate when a key press has been received by the PICAXE.

[edit] PWM output

The PICAXE-08 and 08M support the PWM command and the PICAXE-08M and the X-range support the PWMOUT command.

The PWM command provides for a burst of a pulse-width modulated signal to be generated which may be used to charge a simple Resitor-Capacitor circuit to generate an analogue voltage output. PWM can be used with any Digital Output pin.

The PWMOUT command allows a pulse-width modulated signal to be continually generated while the PICAXE continues execution, which may be used to generate analogue voltages, as with PWM, but can also be used for speed control of motors and brightness control of visual indicators. PWMOUT can only be used with certain Digital Output pins. The PICAXE-08M and 18X provide only a single PWMOUT output, while the 28X and 40X provide two.

[edit] Serial

User programmed serial input and output by the PICAXE is implemented in the firmware, allowing the serial communications to be received on any Digital Input pin and transmitted on any Digital Output Pin. The serial interface supports a variety of baud rates between 300 and 4800 baud when operating at 4 MHz, up to 9600 baud at 8 MHz (M, A, and X parts), and up to 19,200 baud at 16 MHz (28X and 40X only).

On the PICAXE-18X, 28X and 40X access to the on-chip AUSART through the use of PEEK and POKE allows bytes to be sent and received at higher baud rates. Those which allow access to the AUSART are capable of transmitting MIDI compatible data and potentially DMX-512 data streams.

[edit] Servo control

All PICAXEs except the PICAXE-08 and 18 can simultaneously support the control of multiple servos connected to any of its Digital Output pins.

Up to eight servos can be controlled directly by a single PICAXE using the SERVO command. Once the servo positions have been specified, the PICAXE will continue to send the required signal stream for each servo whilst the PICAXE continues its execution.

[edit] Sound control

All PICAXE processors support the SOUND command which allows tone generation on any of the Digital Outputs. Piezo sounders can be directly connected to the Digital Output pins and loudspeakers can be driven through a simple amplifier circuit.

The PICAXE-08M is the most comprehensive device for sound generation and supports the PLAY and TUNE commands. PLAY allows one of four pre-programmed tunes to be generated with LEDs optionally flashed in step with the tune's beat, while TUNE allows user created tunes to be played.

Whereas the SOUND command provides for the frequency of a tone and its duration to be specified, the TUNE command allows the tone to be specified in terms of a musical note and the tempo of the tune to be specified. The Programming Editor includes a Wizard to convert suitable mobile phone ringtones to an equivalent TUNE command.

[edit] SPI

The PICAXE provides no native support for SPI and similar interfacing. However, such interfaces can be implemented by direct control of the digital output lines, using a technique known as bit-banging.

[edit] Handy coding conventions

If you're coming from a fuller Basic dialect, the following samples may help with the transition.

[edit] Making an If/Then/Else statement

If b0 = 1 Then IF_B0_EQ_1
'ELSE_B0_EQ_1

       false code goes FIRST!

Goto ENDIF_B0_EQ_1
IF_B0_EQ_1:

       true code goes here

ENDIF_B0_EQ_1:

[edit] Making a stack

SYMBOL  stackP = b13
stackP=$80 ' The top of free SFR memory on 18X and others

'cut, paste, and change _X_ to push a byte
stackP=stackP-1:poke stackP, _X_ 'PUSH 

'cut, paste, and change _X_ to pop a byte
peek stackP, _X_ :stackP=stackP+1 'POP

[edit] Reusing registers in a function

FullFunction:
       stackP=stackP-1:poke stackP, b0 'PUSH
       stackP=stackP-1:poke stackP, b1 'PUSH
       stackP=stackP-1:poke stackP, b2 'PUSH
       stackP=stackP-1:poke stackP, b3 'PUSH
       stackP=stackP-1:poke stackP, b4 'PUSH
       stackP=stackP-1:poke stackP, b5 'PUSH
       stackP=stackP-1:poke stackP, b6 'PUSH
       stackP=stackP-1:poke stackP, b7 'PUSH
       stackP=stackP-1:poke stackP, b8 'PUSH
       stackP=stackP-1:poke stackP, b9 'PUSH
       stackP=stackP-1:poke stackP, b10 'PUSH
       stackP=stackP-1:poke stackP, b11 'PUSH
       stackP=stackP-1:poke stackP, b12 'PUSH
       'Don't touch our stack pointer, b13!
       
       you can peel out PUSHs/POPs for variables that the function doesn't need
 
       FullFunction_end:
       peek stackP, b12 :stackP=stackP+1 'POP
       peek stackP, b11 :stackP=stackP+1 'POP
       peek stackP, b10 :stackP=stackP+1 'POP
       peek stackP, b9 :stackP=stackP+1 'POP
       peek stackP, b8 :stackP=stackP+1 'POP
       peek stackP, b7 :stackP=stackP+1 'POP
       peek stackP, b6 :stackP=stackP+1 'POP
       peek stackP, b5 :stackP=stackP+1 'POP
       peek stackP, b4 :stackP=stackP+1 'POP
       peek stackP, b3 :stackP=stackP+1 'POP
       peek stackP, b2 :stackP=stackP+1 'POP
       peek stackP, b1 :stackP=stackP+1 'POP
       peek stackP, b0 :stackP=stackP+1 'POP
RETURN 'FullFunction

[edit] See also

[edit] External links

In other languages