A few of my PICAXE 08M projects

william47316

New Member
hey there i am william and i have made some quite interesting projects using the PICAXE 08M
some of them have videos on my youtube channel
http://www.youtube.com/user/williefleete
and now for a run down of one of my projects

the main project is an 8 digit LED display which controls 64 LED display segments using shift registers, 4 outputs, almost the whole code space of the PICAXE 08M, 8 bytes of 4800 baud serial input and can process 32 ASCII characters; the 10 numbers, colons, ~20 letters of the alphabet and the "bell" character, so you can just send it standard numbers and capital letters (and the bell character) to the display to control it. if you want to select a decimal point the first display can be used to select one of the other 7 displays decimal point, each digit is assigned a ram location, setting the first digit to that ram location (ASCII 81 thru 87, 80 is the first digit on the display) will turn on that digit's decimal point (coincidently Q,R,S,T,U are characters in my "ROM")

there is a video on my channel which shows this character set
plus there's a debug mode which will bypass the "character ROM" and display everything in binary.

of this i have made 3 versions, a red mini version using standard red LED displays a large green version using full size LEDs and "kiwipatch" boards IE making my own LED displays, and another using blue dot LEDs (which is quite bright) the large displays are at the moment slave units for my PICAXE clock receiving 4800 baud serial from the mini display which has the master unit in it

i will make further posts with pictures and code listings and explanations of my other devices which i have used on my 8 digit display


 

william47316

New Member
below is the running code for the display 08M with comments
the picaxe receives 8 bytes of serial, buffers them and figures out what to do with them and updates the shift registers, the shift registers for driving the LED displays are UCN5841's which are basically 595's with internal Darlington drivers and back emf diodes and will drive common anode LED displays, relays or anything under 500mA per line. all the shift register clock and data lines are connected common and the UCN5841's strobe lines are connected to an output of a 74hc595 used for addressing so they are essentially multiplexed but because the 5841's hold their data the display doesnt flicker and sometimes if powered down and re-powered may still hold their contents

this method does take a little bit of time to update the digits so you do need a small delay between 8 byte serial input bursts of at least 315mS which means the display can handle at least three "frames (8 bytes)" per second, if the bell character is used it does take it longer (because of the beep)

Code:
setfreq m8 'clock speed 8Mhz
'pin assignments on the 08M
'out 0 clock
'out 1 data
'out 2 strobe
'input 3 serial and debug button
'out 4 output enable

high 4 'set output enable high (outputs disabled)
symbol sclk = 0 ' clock (output pin)
symbol sdata = 1 ' data (output pin for shiftout)
symbol counter = b3 ' variable used during loop
symbol mask = b2 ' bit masking variable
symbol var_out = b1 ' data variable used during shiftout
symbol bits = 8 ' number of bits

if input3 = 1 then 'if the serial line is high on reboot
b0 = 1 'enter the debug mode
end if
'in debug mode the digit masks will not be in effect and hence display as binary, useful for debugging 


'addressing register codes
'code for use with the new display units with 74HC595 registers for addressing
reverse with (now obsolete by my standards) ucn5841 addressing register
poke 90, 128
poke 91, 64
poke 92, 32
poke 93, 16
poke 94, 8
poke 95, 4
poke 96, 2
poke 97, 1
'display data
eeprom 0,(231,132,211,214,180,118,119,196,247,244,16)'numbers 0 thru 9 and colon
eeprom 15,(245,55,99,151,115,113,103,181,132,135,240,35,18,229,23,241,182,225,118,51,167)
'^letters A through U

'6 use 119 for "fancy" 6 or 55 for plain
'7 use 228 for "fancy" 7 or 196 for plain
'9 use 246 for "fancy" 9 or 244 for plain 9
'colon (:) displays as "-" on display

mainloop: 

 serin 3, n2400, b4,b5,b6,b7,b8,b9,b12,b13 'receive 8 characters
'buffer them
poke 80,b4
poke 81,b5
poke 82,b6
poke 83,b7
poke 84,b8
poke 85,b9
poke 86,b12
poke 87,b13

'process them
for b10 = 80 to 87
peek b10 ,b11



if b0 = 0 then 'if its not in debug mode continue otherwise skip the rest of this

            if b11 = 7 then 'if b11 is 7 (bel) character
            sound 2,(75,50) 'beep
            b11 = 0 'show a blank display when updated
            end if

     if b11 >= 48 and b11 <= 58 then 'if the current variable is between
                      ' 48 and 58
     b13 = b11 - 48 'take off 48
     read b13, b11 'read from eeprom
     end if


         if b11 >= 65 and b11 <= 85 then 'if the current variable is between
                      ' 65 and 85
         b13 = b11 - 50 'take off 50
         read b13, b11' read from eeprom
         end if
        'if none of them are recognised it defaults to raw binary
 
'decimal point selection code
             if b4 > 80 then         'if the first digit more than 80 (ASCII QRSTUV or W)
               if b10 = b4 then        'if the current loop is equal to above

               b11 = b11 + 8 ;turn on the decimal point on the first digit ASCII value above 80
'eg 81 turns on second 82 third etc up to 87 for the end display decimal point ON

                end if
end if
end if
           poke b10, b11 'poke the ram with updated (if any) changes
next

gosub shiftout_lsbfirst 'update the displays
goto randomloop


shiftout_LSBFirst:
for b11 = 90 to 97

peek b11, var_out
'update the address register first
for counter = 1 to bits
mask = var_out & 1
low sdata &#8216; 'data low
if mask = 0 then skipLSB2
high sdata' , 10 &#8216;; data high
skipLSB2: pulsout sclk,1 
var_out = var_out / 2
next counter
pulsout 2 , 1 'update
'pause 10
b10 = b11 - 10
peek b10, var_out
'broadcast the data to the display registers 
for counter = 1 to bits
mask = var_out & 1
low sdata &#8216; 'data low
if mask = 0 then skipLSB
high sdata' , 10 &#8216;; data high
skipLSB: pulsout sclk,1 
var_out = var_out / 2
next counter
'pause 10
pulsout 4 , 1 'update the addressed register 
'by pulsing output enable on the address register low 
next
return
 
Top