Shop OBEX P1 Docs P2 Docs Learn Events
8x8 RGB LED Matrix with Keypad input (SX-28 and BS2 connections) - A-F char not — Parallax Forums

8x8 RGB LED Matrix with Keypad input (SX-28 and BS2 connections) - A-F char not

T&E EngineerT&E Engineer Posts: 1,396
edited 2007-10-09 01:51 in BASIC Stamp
I wanted to show everyone the neat idea for displaying a character on an 8x8 LED matrix. I am using an 8x8 LED matrix module with controller from SparkFun using SPI (Shiftout).

http://www.sparkfun.com/commerce/product_info.php?products_id=760

I took the SX-28 help example showing a 4x4 keypad and modified it for a 4x4 mini keypad I got for $5 from Futurlec:

http://www.futurlec.com/Mini_Keypad.shtml

You will also need at least 1 or more of these (I recommend 2-3 in case they break) and some IDE ribbon cable (like from an old hard drive in your PC):
http://www.futurlec.com/Connectors/IDCC10.shtml

I connected the 10K resistor SIP input·to ground not Vcc as modified in the SX code.

Once I had the keypad working and could display the characters on my professional development board (pdb) 7 seg display. It was time to take it further by transmitting the character to a BS2 or in my case a BS2px (because it had a faster refreshing rate).

ZOOT helped·me with the character display code for a BS2. Thanks ZOOT !!

I was able then combine the ideas together and create my own characters·to get displayed on the 8x8 RGB LED matrix. In this case, I would only need·0-9 and A-F.

Here is the problem, I can display 0-9 and A-F on the·7 seg display using the SX-28 code fine. However, when it goes over to the BS2, only the characters 0-9 get displayed properly. I can manually display letters·A-F fine so I know the character mapping is good but it might be the "char·= char + 48" that is messing me up. When the user tries to press on keys that normally display as A-F on the 7 seg display, they show up as all 64 LEDs "on" the RGB LED matrix.

Another cool thing I did was to add a random color cycle to it. This·RGB·8x8 LED matrix allows·colors of 0 (off) to 7 (off, red, green, blue, yellow....). However, if the controller was removed·and through some clever PWM it could reach more colors than this. But 7 colors is pretty·good all the same.

Can someone identify what is happening with the·A-F characters not getting displayed properly?

Thanks.



Post Edited (T&E Engineer) : 10/7/2007 8:34:37 PM GMT

Comments

  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-10-07 20:09
    More pics.

    Also attached is a character spreadsheet. I had to create the characters in reverse for them to get displayed correctly. I then took the 8 decimal numbers and added them to the CBLOCK Data statements.

    Post Edited (T&E Engineer) : 10/7/2007 8:14:28 PM GMT
    648 x 486 - 101K
    648 x 486 - 89K
    648 x 486 - 88K
    648 x 486 - 90K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-10-07 20:21
    After the char = char + 48 you need to add IF char > "9" THEN char = char + 7. This will map $0A through $0F to $41 thru $46 ("A" - "F").

    -Phil
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2007-10-07 20:24
    T&E:

    After your Get_KeyPad, you'll need to test for the keypad char being greater than 9.
    If it is you need to add 55 to the char to get keypad char into the range of 'A' to 'F'
    otherwise add 48 to get into the range '0' to '9'.

    IF char > 9 THEN
    char = char + 55
    ELSE
    char = char + 48
    ENDIF

    or you can do this:

    IF char > 9 THEN
    char = char + 7
    ENDIF
    char = char + 48

    Your choice.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = AE5AE = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-10-07 20:31
    That did it! Thanks again guy!

    I'll post some more pics later tonight.

    I reposted the correct code.

    :

    Repeat:
    ·· GOSUB Get_Keypad·· ' Get character from SX-28 RA.0
    ·· IF char > 9 THEN
    ···· char = char + 55
    ·· ELSE
    ···· char = char + 48·· ' Ascii it
    ·· ENDIF
    ·· GOSUB doChar······ ' Display it
    ·· GOTO Repeat······· ' Next character please

    :
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-10-09 01:51
    The code has been re-written for the SX-28 (no BS2 is needed).

    http://forums.parallax.com/showthread.php?p=681441
Sign In or Register to comment.