Shop OBEX P1 Docs P2 Docs Learn Events
SX/B SHIFTOUT for multiple cascaded SPI type chips (A6821 or 74HC595, etc.) que — Parallax Forums

SX/B SHIFTOUT for multiple cascaded SPI type chips (A6821 or 74HC595, etc.) que

T&E EngineerT&E Engineer Posts: 1,396
edited 2007-10-15 10:17 in General Discussion
I tried looking but did not see anything relating (for SX/B) on how to cascade SPI chips that work like a 74HC595. I see in the Stampworks for BS2 that a 10K resistor is sinked between LOAD (pin 12 I believe)·and Ground. Is this still needed for cascading SPI chips on the SX-28?

The BS2 PBASIC SHIFTOUT command appears to allow for long strings of data from 1 SHIFTOUT command. It looks like SX/B only allows for 8 bits (default) to up to 16 bits.

I have (5) A6821 chips (for LED Matrix modules) which are cascaded (DO --> DI, etc.). These·SPI type chips work very much like 74HC595's. Since I have 5 of these, I would need to send·40 bits out. How can this be done? Currently I have to use (5) (8 bits at a time),·SHIFTOUT statments. Is there anyway to make it simpler to send the·40 bits·out without having to break them up into 5 separate bytes?

Hopefully I am being clear. But I will post the working 5 SHIFTOUT statement version.

Thanks.

Post Edited (T&E Engineer) : 10/14/2007 2:09:28 PM GMT

Comments

  • Bill HenningBill Henning Posts: 6,445
    edited 2007-10-14 18:36
    As long as you have all five CLK, STROBE and -OE 's tied togeather, you can just use five separate SHIFTOUT commands (8 bits at a time), then pulse the STROBE pin. I suspect you have -OE permanently tied low.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com - a new blog about microcontrollers
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-10-14 19:09
    Bill,

    What you said is what I have currently running.

    SUB OUT
    · SHIFTOUT DataIn, Clock, MSBFIRST, pattern(5) ' send the bits
    · SHIFTOUT DataIn, Clock, MSBFIRST, pattern(4) ' send the bits
    · SHIFTOUT DataIn, Clock, MSBFIRST, pattern(3) ' send the bits
    · SHIFTOUT DataIn, Clock, MSBFIRST, pattern(2) ' send the bits
    · SHIFTOUT DataIn, Clock, MSBFIRST, pattern(1) ' send the bits
    · PULSOUT Strobe, 1···························· ' transfer to outputs
    ENDSUB

    Yes I also have the /OE lines tied low too.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-10-14 21:20
    ·
    SUB OUT
     FOR pat_idx = 5 TO 1 STEP -1
       LOOKUP pat_idx pat(1), pat(2), pat(3), pat(4), pat(5), pat_xmt
       SHIFTOUT DataIn, Clock, MSBFIRST, pat_xmt
       NEXT pat_idx
       PULSOUT Strobe, 1
     
    *** pat_xmt, pat_idx  new VARs
    **  pat(x) instead of pattern(x)
    

    ???
    Update:· 6 of one and a half-dozen of the other?· I guess your end-game is a 40-bit stream?


    Post Edited (PJ Allen) : 10/15/2007 12:24:09 AM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-10-15 10:17
    Thanks PJ. It worked well for the first phase in this application.

    I did not have enough current using·my Parallax Professional Development Board (PDB) so this is why I was not seeing the correct output. /OE on each of the (10) A6821 is used to control the color (red, green or yellow) of each of the (5) 8x8 LED Matrix Modules. When I wired the SX-28 on a separate solderless breadboard and connected the external display board with A6821s to the solderless breadboard, I used my big 5vdc 20A power supply and then saw the LEDs come on correctly. I wrote a change to turn all the LEDs on and measured 2.3 Amps of current draw (then changed it back to the normal program). Before on the PDB, the power supply is only 1 Amp I beleive, and the LEDs were either the wrong color or not on at all on some of the LED Matrix Modules. The lack of current was affecting the /OE lines and probably more.

    Since the (40) columns are controlled by Clock, DataIn and Latch to the (10) A6821s, this is where I thought the scanning routine should be for marquee scrolling (right to left). The (8) rows (up·to down) would then have the data message characters READ in. I am concerned about the duty cycle of 40 columns being scanned within an Interrupt routine (end concept). If I scan the 8 rows instead of the 40 columns, then would I not be able to shift marquee scrolling in (right to left) - if the rows are being used for scanning? Perhaps I am misunderstanding the process because I usually would scan the columns for data character·messages to be sent in from the rows (right to left). Is this right?

    Anyway, I'm sure I'll have more questions...

    Thanks again.


    Post Edited (T&E Engineer) : 10/15/2007 11:17:16 AM GMT
Sign In or Register to comment.