Shop OBEX P1 Docs P2 Docs Learn Events
My new LED Matrix 8x7 driver — Parallax Forums

My new LED Matrix 8x7 driver

HydraHackerHydraHacker Posts: 77
edited 2022-07-11 18:18 in PASM2/Spin2 (P2)

Hello Everybody,
I have rewritten my driver from a couple of years ago. I added a few methods to demonstrate the ROTXY() method, I hope you like it!

HydraHacker

https://youtu.be/35v3SWpJVrE

CON

VAR
        long fpf, pf, stk[64]
        byte bc, bfh, matrixCogID

OBJ

PUB start(bfhv)
   'start next free cog and if started get its ID
   matrixCogID := COGSPIN(NEWCOG, LED_matrix8x7(bfhv), @stk)

PUB stop()
   'terminates the cog that renders to the LED matrix
   COGSTOP(matrixCogID)

'get methods
PUB get_bmpAdr() : a
   return @bmp

PUB get_fpf() : v
   return fpf

'set methods
PUB set_pf(b)
   pf := b

PUB set_bitFieldRender(bf)
    bfh := bf

PUB LED_matrix8x7(btfh) | a, a1, bmb, c, i, i1, m, t, w
   a := @bmp
   a1 := @bc
   bfh := btfh

   repeat

      'stop bmp from being rendered, set fpf to indicate that rendering has stopped
      repeat while pf
         fpf := true

      'rendering has started
      fpf := false

      'cnt the one bits in the section of bmp that is being rendered
      org
            bmask    m,     #07
            cmp      btfh,  #15   wz
      if_z  shl      m,     #08
            mov      ptra,  a
            mov      t,     #0
            mov      i,     #07
      nw   rdword    w,     ptra++
            and      w,     m
            ones     c,     w
            add      t,     c
            djnz     i,     #nw
            wrbyte   t,     a1
      end

      'scans bmp top to bottom from left to right, for one bits and turns on the led(s)
      repeat i from 0 to 110 step 2
         if bmp[i / 2 / 8].[bfh - i / 2 +// 8]
            pinh(hghLwTbl[i])
            pinl(hghLwTbl[i + 1])
            waitct(clkfreq / 50 / bc + getct())
            dira.[7..0] := 0

DAT

hghLwTbl byte 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7
         byte 1, 0, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7
         byte 2, 0, 2, 1, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7
         byte 3, 0, 3, 1, 3, 2, 3, 4, 3, 5, 3, 6, 3, 7
         byte 4, 0, 4, 1, 4, 2, 4, 3, 4, 5, 4, 6, 4, 7
         byte 5, 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 6, 5, 7
         byte 6, 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 7
         byte 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6


bmp      word    %00000000_00000000
         word    %00000000_00000000
         word    %00000000_00000000
         word    %00000000_00000000
         word    %00000000_00000000
         word    %00000000_00000000
         word    %00000000_00000000

Comments

  • Awesome !!

  • Very cool. I need to dig out my array and give the code a try.
    Can you add a link to this thread in the video's description? It might be helpful to people who find your video first.

    Thanks for sharing your code with us.

  • Thanks Duane,
    I will include a couple of files for a complete character set and the methods.

    HydraHacker

  • HydraHackerHydraHacker Posts: 77
    edited 2022-07-11 18:19

    Hello Everyone,
    I have added a method to draw or erase lines on the LED Matrix 8x7 board

    HydraHacker

Sign In or Register to comment.