Step 6Programming
Ah that'd be a good idea. Becasue of my forthought, I have a download socket already on the PCB, so, just whack in the download cable, plug that into a serial port on your PC, get Programming Editor, and get coding!
Of course it helps if you've programmed a PICAXE before, I've had about 4 years experience so far, GCSE and AS/A level.
The first thing to do is to type:
main:goto main
This just sets up the PICAXE for the program, put the important code between the main and goto main, I do this so I don't forget to do it later. The next task is to set the outputs, which pins do you want high, and which low. The long and time consuming way is to go:
high 1high 2high 3low 1low 2low 3
Or you can be cool and set the states all in one line with:
let pins = %00001110let pins = %00000000
This works by giving each pin a specific digit, so pin 8 is the fist digit, pin 0 is the last digit and so on. We also need to be able to put a time delay in there so the pins are actually left on long enough for the LEDs to light. There are 2 main PICAXE waiting commands, wait and pause, wait 1 waits for 1 second, where as pause 1 waits for 1uSecond, which is what we need.
Those inclined to nit picking will have noticed that there are only 8 pins on the pins=%00000000 command. Yes, the ninth output on a PICAXE18X is infact the serial out pin. This requires a completely new piece of code to set.
poke $05,%00000000poke $05,%00001000
I'm not too sure why this works, or why it's nessesary, but I did get it from the friendly people at the PICAXE Forum
So putting all that together gives us:
main: ' Letter Alet pins = %00011000 'poke $05,%00000000 ' Set SERTXD line lowpause 1 'let pins = %00100101 'poke $05,%00001000 ' Set SERTXD line highpause 1 'let pins = %01000101 'poke $05,%00001000 ' Set SERTXD line highpause 1 'let pins = %10001000 'poke $05,%00000000 ' Set SERTXD line lowpause 1 'goto main '
That should display the letter A on you dotmatrix display
| « Previous Step | Download PDFView All Steps | Next Step » |
6
comments
|
Add Comment
|
![]() |
Add Comment
|


















































