| Lots of blocks can be used for output from the PICAXE; here are a few. Here is a document to help you: Using PICAXE with Outputs. |
| This LCD display sold by Revolution Education is a very versatile device. It includes a real-time clock so that it can display the date and time. It can also be used to set alarms and provides an alarm output. It can store a set of messages so that they don't take up room in the PICAXE chip. It can also display messages on the fly. Here is a program which displays a message on the top line of the display and the date and time on the bottom line. The PCB uses output 4 from the PICAXE. Power supply must not be more than 6 volts; if you are running on 5 volts then short-circuit the diode on the LCD control pcb. |
|
It's fairly easy to get a PICAXE chip to throw the dice for you. I don't want to spoil your fun writing the perfect program - the one shown here just loops the dice through the traditional display values. You can write a program to get the dice to change quickly at first and then roll to a stop. Or to turn the chip off when it's finished. But most important is to make sure the result is always random. If you think this is too difficult go to the dice page to see how to use traditional circuits.'Load dice patterns into EEPROM memory. 'put the next 2 lines on one line eeprom (%00000100,%00010000,%00100100, %00110000,%00110100,%00111000) loop: for b0=0 to 5 'loop through numbers read b0,b1 'read output code from eeprom let pins=b1 'show the value pause 300 'show it for 300mS next b0 goto loop 'forever |
|
This module can be programmed with 30 phrases using SP03.exe from Revolution. The jack socket on the board is for use with that program. Once programmed the module can be used with a picaxe microcontroller using a very simple program such as the following. This speaks phrase 1 followed by phrase 5. The 5 second wait in between is to allow phrase 1 to finish. See spe030.pdf or go to the documentation page at www.picaxe.co.uk for full details. This pcb design uses Picaxe outputs 0-4; outputs 5 and 6 are not available, and output 7 is carried through and made available to a following board. Note that this board must be operated at a maximum of 5 volts.let pins=%00000001 'phrase 1 pause 10 let pins=%00000000 wait 5 'allow speaking time let pins=%00000101 'phrase 5 pause 10 let pins=%00000000 'clear the phrase |
|
| Using a single 7-segment display for counting is easy, but you can only count to 9. Using a two digit display block (eg Rapid 57-0130) allows you to count all the way up to 99. But to do this you have to be a bit tricky! Since we only have 8 outputs it seems impossible – but what you do is this: show the units digit for a short time then show the tens digit for a short time. If you swap backwards and forwards fast enough, your eyes will think both digits are displayed all the time. So we use 7 outputs for the 7 segments, and the one output remaining switches betweens tens and units. On the pcb layout, when output 7 (x) is high then the units are shown and when x is low then the tens are shown. |
|
'input on 1, output 7-0 = xgfedcba, x high for units, low for tens symbol Counter = b1 symbol Tens=b2 'used for digit calculations symbol Units=b3 symbol result = b4 'used for lookup command symbol key = input1 'input on 1 'put values for digits in eeprom - must be on one line start: eeprom (%00111111,%00000110,%01011011,%01001111,%01100110,%01101101,%01111101,%00000111,%01111111,%01101111) Counter=0 'initialise counter loop: gosub display 'display number if key=0 then loop 'loop until button pressed Counter=Counter+1 'button pressed if Counter<100 then skip1 Counter=0 'no carry out skip1: gosub display if key=1 then skip1 'wait til button unpressed goto loop display: tens=Counter/10 read tens, result let pins= result pause 2 units=Counter//10 read units, result let pins= Result | %10000000 'or use LookUp function pause 2 return |
You can buy LED arrays (eg Rapid 57-0655) set up so that you drive them by setting a row high and a column low to illuminate a single LED. This LED is a pixel in the 7x5 picture. If you set all the rows high and just one column low, you get a line of LEDs illuminated. Using a 4017 decade counter, as in the top pcb, you can strobe all the columns in sequence using only one output of the Picaxe, leaving the other seven outputs for the rows. This principle can be used to display a letter or a simple picture like a smiley. You could also use a 4028 and strobe the rows using 3 outputs from the Picaxe leaving the other 5 for the columns as in the second pcb. Here is a scrolling message using the 4017:
'outputs 76543210 are used for ' row 0123456 and bit 0 to clock the 4017 'each 4017 clock pulse moves to the next column symbol frame=b0 'each frame is a symbol loop=b1 'column in a character symbol data=b2 'read from eeprom symbol finish=b3 symbol speed=b4 'put values for frames in eeprom - must be on one line 'each value includes the bit0 clock pulse eeprom(%00000001,%00000001,%00000001,%00000001,%10000011, %11111111,%10000011,%00000001,%01110001,%10001001,%00100101, %10001001,%01110001,%00000001,%11111101,%00000011,%00000011, %00000101,%11111111,%00000001,%00000001,%00000001,%00000001, %00000001) init: pause 500 'need to reset the 4017 for b0=1 to 4 'so it starts at column 1 high 0 'clock 4017 4 times low 0 'so that we start in the next b0 'right place main: for frame=0 to 19 'no of characters multiple of 5 for speed=0 to 20 'sets speed of scrolling finish=frame+4 for loop= frame to finish read loop,data pins=data low 0 'clock 4017 pause 2 next loop next speed next frame goto main |
|
The easiest way to drive a servo from the PICAXE is to use the Picaxe18X chip which has the special servo command so that "servo 4,150" will move a servo on output 4 to its midpoint, and then keep it there. The range goes from 75 to 225 roughly and the command continues sending pulses to the servo in the background while getting on with the rest of your program. Using the Picaxe 18 or 18A requires you to use the pulsout command with a pause egstart: pulsout 4,150 'move to centre pause 20 'pause 20mS goto start 'do it againYou can also control a servo with a 555; see my motors page. |
|
| Pulse Width Modulation is a very useful method for controlling the speed of a motor while maintaining full torque. It is very easy to use with the new Picaxe18X chip since it has a pwmout command for use on output 3; eg "pwmout 2,150,100". On other chips you can use pulsout in a similar way to driving a servo. The ratio between the time the pin is high and the time it is low is the duty cycle. You can also control a motor's speed using a 555; see my motors page. |
|
|
The linear actuator consists of a motor which drives a screw thread. Moving along this screw thread is a block or whatever you need to move. At each end are microswitches which detect when the block gets to the end of its travel. They can simply interrupt the power to the motor, or they could be used as inputs to the controlling PIC; that's what this block is designed for.
For more outputs see the document axe001_pic_electronics.pdf or go to the documentation page at www.picaxe.co.uk. |
|