Do I need a resistor when using a LED?
In almost all cases; yes. Using a LED without a suitable current limiting resistor can draw too much current through the PICAXE pin and may damage or destroy your PICAXE, the LED or both.
Can I control servos using the PICAXE?
Yes, all PICAXE M2 and X2 have a servo command that allows control of up to 8 servos.
Can I control an LCD display?
Yes, the PICAXE supports serial LCD modules (like the Serial LCD/Clock Module AXE033) via the serout command. Note that the AXE033 module can also be preprogrammed with up to 8 messages to reduce the memory usage of the PICAXE microcontroller.
Can I use a PICAXE for PWM control of a motor?
The PICAXE M2 and X2 have a dedicated pwmout command which acts on one up to four pins for full PWM control. The M2 and X2 also have a servo command that allows control of up to 8 servos. The servo command uses the internal timer and internal interrupts so that the pulses are maintained 'in the background' all the time that the PICAXE is running the main program.
The servo command produces a pulse of length 0.01ms to 2.55ms approximately every 20ms. Therefore it can also be used as a simple background PWM output with PWM mark:space ratios between 1:2000 and 1:8 (approx).
Can the PICAXE count pulses?
All PICAXE M2 and X2 support the count command which can count the number of pulses in a defined period. All parts also support the pulsin command to measure the length of a pulse.
Can I use i2c devices with the PICAXE?
All PICAXE M2 and X2 parts support i2c devices using the hi2cin and hi2cout commands.
When using i2c devices do not forget to include the 4k7 pull-ups on the SCL and SDA lines of the i2c bus.
Can I send and receive data via the download cable?
All PICAXE M2 and X2 parts can send data via the download cable using the sertxd command and can receive data using the serrxd command.
What baud rates are supported by serial commands?
The PICAXE M2 supports 600, 1200, 2400 and 4800 baud rates when operating at its default 4MHz operating speed. The PICAXE X2 supports 1200, 2400, 4800 and 9600 baud rates at its default 8MHz operating speed.
The baud rates will correspondingly double with every doubling of operating speed. For example, 4800 baud at 4MHz will become 9600 baud at 8MHz and 76800 baud at 64MHz.
Both M2 and X2 parts support higher baud rates and a wider range of baud rates via the high-speed serial interface using the hserout command.
Can I alter the pin arrangement of my PICAXE?
All PICAXE M2 and X2 parts have fixed pin positioning but almost all pins can be configured for digital input or output. A few pins are input or output only due to bootstrap requirements and chip design.
How do I use Serial In as an input
The Serial In pin used for download can be used as a general purpose digital input on the PICAXE-08M2, 14M2 and 18M2.
A push switch may be added between the Serial In pin and PICAXE V+ power supply, and then the switch state can be tested by if...then and other similar commands.
A disconnect command must always be executed at the start of the program when the Serial In pin is used as a general purpose input pin.
This is to disable the chip's download mode - without a disconnect command any push of the switch will cause the chip to enter the download mode and cause incorrect or unexpected program operation. This also means that the switch must not be pressed during any PICAXE reset, as the disconnect command must have been processed before the switch is allowed to be pressed.
Once a disconnect command has been executed a power cycling 'hard reset' will be required to start a new program download (unless a reconnect command execution has followed it).
Note the switch should not be pressed while the PICAXE is powered-up as the program will be delayed from starting until the switch is released. The switch should not be pushed during a program download as this may result in the download failing.
I need more outputs - what can I do?
One simple solution is to use a larger PICAXE. The PICAXE 08M2 has 5 I/O lines, the 40X2 has 32.
An alternative is to connect one PICAXE to another and use the first to control the outputs of the other. The second PICAXE, in this example a 20M2, can be programmed with the simple program:
let dirsb = $FF
main: serin C.0, N2400, b1
let pinsb = b1
The eight Port B outputs of the second chip can now be controlled with a serout C.7,N2400,(b2)
command by the first chip, where b2 contains the 'pinsb' value (0 to 255) desired on the second chip. Connecting C.7 output from the first PICAXE to the C.0 input of the second gives an additional 8 usable outputs.
I need more inputs - what can I do?
In the same way an additional PICAXE can be added to provide more outputs, another PICAXE can be added to provide additional inputs. In this example one PICAXE-20M2 reads its C.0-C.7 inputs and sends them out on pin B.7. A second PICAXE reads that signal on C.0 and puts them on its output pins B.0-B.7.
; Input reading PICAXE
main: b1 = pinsC
serout B.7, N2400, (b1)
; Displaying PICAXE
let dirsb = $FF
main: serin C.0, N2400, b1
let pinsb = b1
Does the PICAXE support touch sensors?
All PICAXE M2 parts plus the 28X2 and 40X2 support touch sensors. The PICAXE 20X2 does not have support for touch sensors.
How do I make a touch sensor?
Touch sensors are usually a metal pad connected by a wire to a PICAXE 'touch' pin.
Note that touch sensors are 'capacitive' so you should not make direct contact with the touch pad or PICAXE pin it is connected to. The touch pad should be separated from your finger touch by thin plastic or other non-conductive material.
A touch pad may be etched on to one side of a PCB and then 'touched' and activated from the other side of the PCB.
Can the PICAXE handle RF communications?
The PICAXE 14M2, 20M2, 28X2 and 40X2 all support rfin and rfout commands which allow for direct interfacing to 'dumb' RF modules such as the RFA001 transmitter and receiver pair.
The PICAXE 08M2 and 18M2 do not support rfin or rfout but can use the NKM2401 to interface to RF receiver and transmitter modules, as can any PICAXE.
A PICAXE can interface to 'dumb' RF modules using serin and serout commands but we recommend the above solutions as easier, less difficult to make work and giving more reliable operation.
How do I connect a microphone as a sound sensor?
Please see this example circuit.