| PICAXE Questions & Answers | |
|
Part 3 - Hardware Issues | |
|
Part 1 - Common QuestionsPart 2 - Software IssuesPart 3 - Hardware Issues
Part 4 - Miscellaneous and Esoteric IssuesPart 5 - Known Bugs and Other Problems
From information in PICmicro datasheets I've examined, the following is a list of operating voltages which I have been able to determine ...
The 'maximum' voltage is that which can be sustained for periods without damage being caused to the device. Operating at or above the 'maximum' voltage may cause permanent damage to the device. Although it may be possible to operate below the specified operating voltage ranges, correct operation is not guaranteed.
Although some PICAXE Starter Kits and other hardware is supplied with a battery connector which will fit a 9V, PP3-style battery, the PICAXE must not be connected to 9V. The only exception is when the PICAXE board has a voltage regulator which will convert the 9V to something safe for the PICAXE - Such regulators are not fitted to the PICAXE Starter Kits nor necessarily to any other hardware. The PICAXE Starter Kits are fitted with what many think is a 9V / PP3-style battery connector because those batteries have the same connections and this is what most people are familiar with. Most battery boxes, such as those supplied with the PICAXE Starter Kits, also use the same connectors and the presence of what one might think is a 9V battery connector does not necessarily mean that it is for connecting a 9V battery to. If you have damaged or destroyed your PICAXE by connecting a 9V battery to it, there is little else you can do other than to pull its legs off and buy a replacement chip, while reflecting upon the importance of reading the instruction sheets which accompany a product and other manuals and documentation before you dive in and power it up.
It should also be borne in mind that, where the PICAXE is used in conjunction with other electrical devices, they may not be as tolerant to voltages above 5V as the PICAXE is, and using a voltage that is too high may cause irreparable damage to those devices and the PICAXE. My recommendation is that the PICAXE should not be powered by anything other than a 5V (nominal) power supply, and where battery operation is required, they should be powered at 4.5V ( 3 x AA/AAA 1.5V Alkaline cells ) or 3.6V ( 3 x AA/AAA 1.2V NiCd or NiMH cells ). Note that rechargeable batteries, although nominally rated at 1.2V or 1.25V depending upon whose information one reads, will often present a voltage greater than that when fully charged ( reaching nearly 1.5V ), so using four rechargeable batteries can often be greater than the 5.5V maximum stated in the datasheets. Where a regulated power supply is used; this should be of the 5V (nominal) type.
Power Diode D1 is used to allow either an AC or DC voltage to be applied to the power supply, rectifying the AC voltage, and providing reverse polarity protection for DC. It is highly recommended that this diode is fitted to all power connections, although it may not be suitable for battery powered devices, as the diode may drop up to 0.7V of the input voltage. The Electrolytic Capacitor C1 is to smooth the rectified AC voltage and any minor changes in DC voltage. It should be a reasonably high uF rating, and rated according to the input voltage to be applied, often twice the voltage for AC. A good choice is 470uF/16V for 9V battery operation and 4700uF/25V for an external 10V mains plug-in power supply module. Take care to mount the capacitor with the correct polarity; one of the legs will normally be marked as '-' which should go to the 0V power line. Capacitors C2 and C3 are to 'stabilise' the Voltage Regulator, and should be fitted as close as possible to the Regulator legs. The Voltage Regulator REG1 is a standard +5V Regulator whose physical format will depend upon its current capacity. The current capacity needed will depend upon the current drawn by the PICAXE and all other components connected to the same power supply. As a rule of thumb; every LED will draw 10mA and an LCD backlight will draw 50mA. The PICAXE itself may draw up to 300mA. It is always best to be cautious about current consumption, and assume that everything which could be powered is, and will draw its maximum current. Most TO220 ( slab-style ) regulators can handle 1A of current, and are designed for mounting to heatsinks. Other Voltage Regulators will provide even higher currents. Smaller regulators, capable of supplying circuits where only 100mA will be drawn, are available and will often be in a transistor-style, TO92, package. Regulators dissipate the difference between input voltage and the 5V they produce as output as heat, and therefore the higher the input voltage, the greater the amount of heat will be generated. The amount of heat will also increase as the current drawn increases, and it may be necessary to fit a heatsink to the regulator. While a small difference between input voltage and 5V will reduce the amount of heat dissipated, most regulators require that the input voltage is about 8V to work correctly. There are Low Drop-Out ( LDO ) Regulators which will work with a lower input voltage, and are very suitable for regulating battery supplies such as 9V PP3's. It is recommended that you check the specification of the Voltage Regulator to determine its minimum and maximum input voltage range, its current capacity and what short-circuit and over temperature protection it offers, and, in particular, its pin-out. Likewise, a Voltage Regulator should be chosen based upon the current drawing requirements of your circuit and the power source which is to be supplied to it. Although it is possible to construct a regulated power supply using nothing more than the regulator itself, it is recommended that all the components in the above circuit are used, to prevent problems occurring which are difficult to track down should they emerge, especially if they are intermittent. A project to build a more comprehensive power supply with a fixed 5V plus variable 1.25V to 20V output is described on the following page ...
It is not always necessary to provide such de-coupling capacitors, especially when a battery power supply is being used, but the general recommendation is to fit one decoupling capacitor for every IC on a boad. One of the best answers to this question I've found is from Wouter van Ooijen in the Netherlands ... "Probably ( let's say 9 out of 10 times ) no. Do you need to look right and left to survive crossing a quiet street ? Probably not. Is that sufficient reason not to ?"
To turn on a LED when an Output Pin is low, connect the +V through a resistor, into a LED which has its pointy end connected to the Output Pin. You can connect both of these to the same Output Pin; the one to 0V will be on when the Output Pin is high and the other will be on when the Output Pin is low. The downside is that one of the LED's will alway's be on, and only one can be on at a time, but you can often make them both appear to be on together by repeatedly toggling the Output Pin high and low rapidly.
You can have more than two LED's from two pins by connecting LED's ( and their resistors ) between the two Output pins in opposite directions, plus adding more as described above. Not all LED's will be individually controllable and it takes a bit of effort to work out what configurations you want to use, but basically two pins gives you four possible LED display states, three pins gives eight.
Checkout the useful Microchip Application Note which gives a number of clever hardware tricks ...
The voltage which is fed into the Input Pin must never exceed the voltage at which the PICAXE is operating or the device may be irreparably damaged. If the voltage you wish to read is greater than the PICAXE operating voltage you must run the voltage through a resistive divider or some other active circuitry to bring it to an acceptable level. How to do this is beyond the scope of this article, but if you are reading a potentiometer or a Light Dependent Resistor ( LDR ) or an analogue Thermister in a resistive divider, one end of the potentiometer or divider should go to 0V and the other to the power supply of the PICAXE. If the voltage you are reading comes from another chip which switches between a logic low and logic high level, you will most likely want to connect it to a Digital Input, and read it by using a 'pinN' variable ( when N is the number of the Input Pin ) or by using the 'pins' variable which will read all eight Digital Input Pins together. You should check what the output levels of the chip you are reading from are from the datasheet and check that they are compatible with the PICAXE; the output voltage from the chip must not exceed the power supply voltage the PICAXE is running on. If the two chips are using the same power supply then there should rarely be a problem. If the voltage to be read is variable and doesn't have just a high and low state, or there is a high and low state but the voltage takes a time to change ( "Slow Rising" and "Slow Falling" waveforms ) you will need to read these as Analogue Inputs or use an external Schmitt Trigger Gate before a Digital Input to create the fast switching change between low and high or vice-versa which the Digital Input expects. Any voltage line which has anything but minimal capacitance on it will be a slow rising and falling waveform. Any voltage into a PICAXE Digital Input will be read as a logic low (0) when it is below a certain voltage, and will be read as a logic high (1) when it is above another voltage. Between the two voltage points, what is read is neither guaranteed to be a logic low or a logic high, and what is read will rarely be repeatable over time, nor the same on any other PICAXE. This is why Digital Inputs require two-state inputs ( low or high ) and why the signal must switch quickly between the two states. A Schmitt Trigger has separate voltages to determine when its output will switch for rising and falling waveforms. The actual voltages at which the output will switch will depend upon the device used and this information can only be found in the device's data sheet, but we can describe how a Schmitt Trigger operates which switches at a rising voltage of 2V and at a falling voltage of 1V ... As the input voltage to the Schmitt Trigger rises, it will reach the 2V point and the output will switch from low (0) to high (1). The output will remain high until the input voltage drops back down and reaches the 1V point when the output will switch back from high to low. The output will remain low until the voltage again reaches the 2V point and the output will switch back to high again. The advantage that a Schmitt Trigger has over any mechanism which uses a single point to switch its output high or low ( such as an analogue comparator ) is that it is immune to noise on the input line. Even a very clean signal will have some noise on it, and, at the point where a single voltage point switcher would change, that noise may cause the output to switch rapidly between high and low at whatever frequency the noise has. It would be entirely by luck whether you read that voltage as being a high or a low. This is exactly the problem which a Digital Input intrinsically has, which is why it specifies that only voltages below a certain level are considered as logic lows and only those above another level are considered as logic highs.
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. Having a 'Reset Button' is entirely optional but can often prove to be very useful.
SETFREQ M8 ' Sets 8MHz operation
SETFREQ M4 ' Sets 4MHz operation
SETFREQ M8 ' Sets 8MHz operation
SETFREQ M4 ' Sets 4MHz operation
SETFREQ M8 ' Sets 8MHz operation
SETFREQ M4 ' Sets 4MHz operation
Some PICAXE's may be under-clocked and some may be over-clocked by either poking
control registers within the PICAXE or by changing the crystal or resonator.
The Programming Editor will not however be able to communicate with a PICAXE if
it is not running at one of the officially supported operating speeds for that
PICAXE variant, which may require the code to have a 'PAUSE' at its start if
the under or over-clocking is done in software, or a change made back to an
expected crystal or resonator value. For those who are operating their PICAXE's with crystals or resonators which are
not officially supported, it would be advisable to build a download board
fitted with a
recommended operating speed crystal or resonator, to avoid having to change the
crystal or resonator in your target hardware to download. The alternative is to
switch between crystals or resonators on your target hardware to
facilitate downloading and operation at the required speeds, but this can be
complex to design and implement effectively and may cause unstable operation.
A PICAXE will not execute some commands as expected when it is being
over-clocked or under-clocked. Commands which will not work, or work
differently, when running at anything but 4MHz operating speeds are ...
The following commands will not work the same as they do at 4MHz when a
different operating speed is used ... Note that on the PICAXE-08M, 18A and 18X, where 'SETFREQ' is used to change
the speed of operation, placing a 'SETFREQ m4' before any of the commands
which need to be executed at 4MHz and another 'SETFREQ m8' afterwards allows
8MHz operation normally and allows access to most of the 4MHz specific
commands ...
The SERVO and PWMOUT commands require continual 4MHz operation to work
correctly and cannot be forced to work as expected using this technique.
Because the PICAXE-28, 28A, 28X and 40X have their operating speeds changed by
crystal or resonator choice, it is not possible to force their operating speeds
back to 4MHz using this technique.
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.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
First published on Thursday the 25th of February, 2004 at 14:38:14
Last upload was on Friday the 7th of January, 2005 at 15:57:14 |