Shop OBEX P1 Docs P2 Docs Learn Events
ROBOLYMPIC circuit — Parallax Forums

ROBOLYMPIC circuit

T&E EngineerT&E Engineer Posts: 1,396
edited 2005-11-25 21:56 in General Discussion
I have·used 4028 IC's as in the Robolympic circuit and using a PDB with a SX28 and 0.1 caps. I have them going to a custom built LED array going through ULN2003 drivers (20 using 16) and PN200 transistor circuit (7).

I am trying to build the Robolympic circuit to learn how it works and build from it. What I am getting is all 16 x 7 LEDs display all LEDs are on (2-3 seconds) and then "rows" of LED patterns up and down occur. It repeats itself in the same way.

Do I have to do something to the SXB code first?

See this·picture showing what the basic LED display looks like.



I have rechecked all the connections 3 times and see nothing wrong with the wiring.


Ideas on where to go with this?

Post Edited (tdg8934) : 11/24/2005 1:14:40 AM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-24 15:24
    The Robolympic badge drives the rows high (from RC) while pulling the selected column (output on RA through a multiplexer) low -- does your modified circuit work like this too?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-11-24 22:04
    Jon,

    That explains it. I have the opposite with the 7 Rows LOW (black wires) and the collumns HIGH (red wires).

    Is it possible to modify the code to invert the lines?



    Thanks,


    Timothy Gilmore
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-11-24 23:46
    Well, I figured out what the problem was..Kind of embarrasing too but...

    On the PDB, I had the 4028 Vcc pins connected to GND and the 4028 GND pins connected to Vcc. (also had 1 7404 inverter wrong too). All those wires...

    When I fixed this messages starting going across with inverse lettering (cool all the same). In the SX/B code I changed 1 line of code to get it to work correctly with LOW rows and HIGH columns.

    ·I changed this:

    RC = Display( RA )···· 'LOAD NEW ROW DATA TO RC

    to this (begining of the SX/B code)...

    RC = NOT Display( RA )···· 'LOAD NEW ROW DATA TO RC



    Now I get it to work beautifully.

    What I will do next is modify the code (and add another 4028) to add another·5 columns of LEDs (20 x 7 display) and the original Robolympic uses 15 x 7.

    Thanks Jon!!
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-11-25 00:22
    I added another 4028 and moved the inverter to the last 4028 pin 11 (D). However, when changing this line:

    Display VAR Byte (15)

    to

    Display VAR Byte (20)

    I get the error message:

    ...VARIABLE EXCEED AVAILABLE RAM

    All of the other variables used, I don't see a way to reuse them either.

    How about adding another SX28 to fix this RAM issue? or is there another way?

    Please help...I really like it but can't expand it past "Display VAR Byte (16)"

    Ideas???
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-25 06:15
    (Just back from Thanksgiving with friends) -- The SX28 only supports 16-byte arrays, so what you can do is split the buffer into two chunks (16 + 4). If you look at the Serial Inkjet Printer code I wrote it has a 64-byte character array that uses four banks this way.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-11-25 15:32
    The problem I am seeing is the interupt code with RA:

    ·
    INTERRUPT
    '
    ISR_Start:

    RC = 0······ 'CLEAR DISPLAY OUT TO PREVENT GHOSTING
    Inc RA······ 'INCREMENT COLUM ADDRESS (RA I/O PINS)
    RC = NOT Display( RA )···· 'LOAD NEW ROW DATA TO RC

    ISR_Exit:
    RETURNINT 63

    RA can only go from 0 (%0000)·to 15 (%1111) (actually it goes from 0 to 14 (%1110) for 15·lines out).

    I need to go to 20 lines out but RA always is reset back to %0000 after it reaches 15 (%1111). How do I create another array such as:

    RC = NOT DisplayExt( RA )

    to push data to the remaining·5 lines when RA gets reset back to 0 (%0000) after it reaches 15 ($1111).

    I tried modifying the code to use RB as a counter but it did not work correctly.

    Please Help if you can.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-25 15:53
    You don't have enough bits on the RA port for more than 16 lines (or 15 with blanking) without a whole lot of complicated trickery. Best to move your column select to RB.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-11-25 20:23
    I really beleive that this can not be easily solved unless an array can be used greater than 16. I am becoming clueless of what else to try.

    I have moved the RA lines over to RB and have the following Interupt code:

    '
    INTERRUPT
    '
    ISR_Start:

    RC = 0······ 'CLEAR DISPLAY OUT TO PREVENT GHOSTING
    ·' Inc RA······ 'INCREMENT COLUM ADDRESS (RA I/O PINS)
    Inc RB
    ·' RC = NOT Display( RA )···· 'LOAD NEW ROW DATA TO RC
    RC = NOT Display( RB )

    IF RB > 15 then
    RB = 0
    EndIf

    ISR_Exit:
    RETURNINT 63

    SEE ATTACHED MODIFICATION FILE...
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-25 21:13
    Here's what I would do to create a 20-byte column buffer:

    colBufLo·· VAR·· ·Byte (16)······· ' define 20-byte array
    colBufHi···VAR ·· Byte (4)

    I would also define a separate column and buffer index·pointers:

    colPntr··· VAR··· RB
    bufIdx···· VAR··· Byte

    Now the ISR is a can handle the code pretty cleanly:

    '
    · INTERRUPT
    '

    ISR_Start:
    · LEDs = %00000000················ ' blank outputs to prevent ghosting
    · INC colPntr····················· ' update column pointer
    · IF colPntr = 20 THEN············ ' roll-over if at end
    ··· colPntr = 0
    · ENDIF
    · IF colPntr.4 =·0 THEN············' in low portion of buffer?
    ··· idx = colPntr & %00001111····· '·calculate buffer index
    ··· LEDs = ~colBufLo(bufIdx)······ ' output current column data
    · ELSE
    ··· idx = colPntr & %00000011
    ··· LEDs = ~colBufHi(bufIdx)
    · ENDIF

    ISR_Exit:
    · RETURNINT 63

    Note that if you use a 32-byte buffer then you can simplify the buffer pointer manipulation (with roll-over) like this:

    · INC colPntr
    ··colPntr.5 = 0·


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 11/25/2005 10:00:46 PM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-11-25 21:45
    Jon,

    I don't know how it affects (RA or RB)·and RC especially with...

    INC RB

    RC = NOT Display ( RB ) ??

    or

    INC RA

    RC = NOT Display ( RA ) ??
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-25 21:56
    In my example code "colPntr" is an alias for RB (just as "LEDs" is an alias for RC). I don't think it's a good idea to embed the port name into the code like you're doing because it makes reassignment more work later. That's just a style choice. And, of course, I forget that your outputs a inverted so I've edited my example code accordingly.

    With the SX28 you can't have an array larger than 16 bytes, so this won't work in your program:

    · LEDs = colBuf(colPntr)

    The example shows how to use bit 4 of the pointer to detect which portion of the array to grab the current column data from.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 11/25/2005 10:02:33 PM GMT
Sign In or Register to comment.