Shop OBEX P1 Docs P2 Docs Learn Events
74HC165 Cascade of 3 Chips — Parallax Forums

74HC165 Cascade of 3 Chips

Michael @ AfineolMichael @ Afineol Posts: 33
edited 2007-12-24 00:29 in BASIC Stamp
I would like to cascade 3 74HC165 IC's. I have read the StampWorks·section on how to setup the circuit, but the programming is what has me baffled. The documentation talks about cascading 2 chips and gives example code. It references a "word" sized variable which is 16 bits or 65535.·I will need to address 24 bits or 16777215. Does anyone have example code for a BS2 to address all·3 chips.

Mike S.

Comments

  • D FaustD Faust Posts: 608
    edited 2007-12-21 02:34
    Try making a 3 byte array and storing the 24 bits to that. (it might work, I don't remember the syntax for it.) Next I would try putting 2 shiftin commands back to back. Check the syntax guide to see if there is anything about putting multiple variables. Hope This Helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --DFaust
  • willy1067willy1067 Posts: 107
    edited 2007-12-21 14:59
    I have the same setup in

    http://forums.parallax.com/forums/default.aspx?f=5&m=181646

    and I thought in the same way you are now, but it works out that you only have to send one word at a time (8 bits, 255) to each 74HC165 and keep shifting to the next chip.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fernando Gomez


    Never compare yourself with anyone else, there will always be someone bigger·or·smaller·than you.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-21 15:30
    Hello,

    From the Stamp Works manual, the following code shifts in 16 bits into a word variable. But that doesn’t mean you have to deal with a word at a time.
    SHIFTIN SerData, Clock, MSBPRE, [noparse][[/noparse]xInputs\16]  ' shift them in 
    


    Any number of byte values can be shifted in with a single instruction as follows.· I hope this helps.· Take care.

    SHIFTIN SerData, Clock, MSBPRE, [noparse][[/noparse]value1, value2, value3, value4, value5]
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-21 18:49
    In my example each value is a byte value. You should have one variable (byte) for each 74HC165 in the chain. I should have mentioned that before. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • willy1067willy1067 Posts: 107
    edited 2007-12-21 22:43
    I WAS ABLE TO GET IT WORKING LIKE THIS;

    '{$STAMP BS2}
    '{$PBASIC 2.5}

    dat PIN 1
    clk PIN 0
    latch PIN 2
    start:
    LOW latch
    SHIFTOUT dat, clk, LSBFIRST, [noparse][[/noparse]1]: SHIFTOUT dat, clk, LSBFIRST, [noparse][[/noparse]3]:· SHIFTOUT dat, clk, LSBFIRST,[noparse][[/noparse]7]:· SHIFTOUT dat, clk, LSBFIRST,[noparse][[/noparse]15]:· SHIFTOUT dat, clk, LSBFIRST,[noparse][[/noparse]31]:· SHIFTOUT dat, clk, LSBFIRST,[noparse][[/noparse]63]
    PULSOUT latch, 5
    LOW latch

    Post Edited (willy1067) : 12/21/2007 11:02:48 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-23 16:43
    Willy,

    I wonder if you’re not using the 74HC165, but rather the 74HC595? The SHIFTOUT command is not used with the 74HC165. It is, however, used with the 74HC595, and to SHIFTOUT the values from your example you could have used:
    SHIFTOUT dat, clk, LSBFIRST, [noparse][[/noparse]1, 3, 7, 15, 31, 63]
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • willy1067willy1067 Posts: 107
    edited 2007-12-24 00:29
    Yes Chris, right now I am working on the output 595 of my circuit, I will use the 165 later for input.

    Can you help with this code?·· I am attaching a stepper motor to the 5th 595, I would like to move foward if pin3 is set high with a push button.· this is what I have so far,· (as I said before, I suck·as a programmer)

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    DO
    Steps DATA 3, 6, 12, 9
    dat PIN 1
    clk PIN 0
    latch PIN 2
    start:
    LOW latch
    SHIFTOUT dat, clk, LSBFIRST, [noparse][[/noparse]0, 0, 0, 0, Steps, 0]
    PULSOUT latch, 5
    LOW latch
    DEBUG ?IN3
    IF (IN3 = 1) THEN Steps
    PAUSE 1000
    ELSE PAUSE 100
    LOOP


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fernando Gomez


    Never compare yourself with anyone else, there will always be someone bigger·or·smaller·than you.

    Post Edited (willy1067) : 12/29/2007 6:12:27 AM GMT
Sign In or Register to comment.