Shop OBEX P1 Docs P2 Docs Learn Events
3.3V kindof 74LS166? (Parallel-In Serial-Out shift-register) — Parallax Forums

3.3V kindof 74LS166? (Parallel-In Serial-Out shift-register)

jmspaggijmspaggi Posts: 629
edited 2010-09-17 16:11 in Propeller 1
Hi,

I want to reduce the number of used pins for the switchs I have (5 pos switch and rotary switch). I looked at a 74LS166 register which seems to do the job, but it's a 5V component. Is there any component like this one, but working at 3.3V? Or can I plug it at 5V, and add few diodes at the output to get the voltage down to 3.3V?

Thanks,

JM

Comments

  • LawsonLawson Posts: 870
    edited 2010-08-04 18:01
    Try searching for a 74HC166 chip. "74" is the series of chips, "HC" is the manufacturing process code and sets operating voltages speeds etc, and "166" specifies what function the chip does within the 74 series of chips.

    Lawson

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-04 18:03
    The 74HC166 (and other 74HC family parts) are designed for use from about 2V to 5.5V. They work fine at 3.3V and can be directly connected to a Propeller I/O pin. Make sure to change the switch circuitry so it also runs off 3.3V.
  • jmspaggijmspaggi Posts: 629
    edited 2010-08-04 18:06
    Hi Lawson,

    Thanks for your prompt reply.

    I looked on internet and found the datasheet for this one, but it says 5V on the first page http://www.datasheetcatalog.org/datasheet/philips/74HC_HCT166_CNV_2.pdf . Does it mean it can take up to 5V but will work with 3.3V too? Or it's because it's not the right one?

    Thanks,

    JM

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Linux? There is worst, but it's more expensive.
  • jmspaggijmspaggi Posts: 629
    edited 2010-08-04 18:09
    Hi Mike,

    Thanks for the confirmation regarding the 3.3V.

    The switch are already all connected to the 3.3V so I will "just" have to add the 74HC166 between the two.

    Now I know that I will always have to look at HC instead of LS (Which was working fine with the Javelin).

    Thanks,

    JM

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Linux? There is worst, but it's more expensive.
  • LeonLeon Posts: 7,620
    edited 2010-08-04 18:23
    LS isn't used much these days. HC is much better, even at 5V.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • hairymnstrhairymnstr Posts: 107
    edited 2010-08-04 18:33
    Make sure it's an HC not an HCT chip. The HCT chips don't like being run at less than about 4.5V in general.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nathan

    "Free as in freedom, beer gratefully accepted though."
  • jmspaggijmspaggi Posts: 629
    edited 2010-08-04 18:45
    Ok. Thanks for the hint. I will be cautious when I will buy the component. And also, I will try HCs on the Javelin next time too.

    JM

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Linux? There is worst, but it's more expensive.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-08-04 22:43
    Just be aware that the quoted speed ratings will drop with the lower voltage, not too much, but don't push it to the limit or beyond (without experimentation)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Why did I think a new, more challenging, job was a good idea ??
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-08 12:10
    Hi all,

    So I bought some SN74HC166N... But I'm having troubles with them.

    I connected D0, D1, D2, D3 to 3.3V, D4, D5, D6 and D7 to 0V that way I should get something like 00001111 or 11110000.

    __
    PE is connected to 3.3V with a 220Ohm resistor, and to a switch to connect it to gnd when I press it.
    Q7 is connected to a LED to a 220Ohm resistor to gnd, so I can see when the output is 1 or 0.
    __
    MR is connected to 3.3V with a 220Ohm resistor.
    Ds is connected to 3.3V.
    CP is connected to GND with a 220Ohm resistor, and to a switch to connect it to 3.3V when I press it.
    __
    MR is connected to gnd.

    So I have one switch connected to PE, and one to CP. If I put the power on, press PE, release it, then each time I press CP I should see the next bit. However, what I get is 11111111. Like if nothing is happening. I can press the switch 20 times, I will always get 1.

    Any idea what's wrong?

    Where should I connect Ds if I don't use it? I will chain the HC166 later, but so far, should it be to gnd? Or 3.3V? I don't think this should change anything for the 8 first bits.

    I can send a picture of my demo board if it helps.

    Thanks,

    JM
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-08 12:30
    CP is edge-triggered. That means that you will get a shift for each switch bounce from your push button (i.e. too fast to see). Use a Propeller pin to trigger CP instead. Also, you've got contradictory statements about how /MR is connected. (It should be pulled high.)

    -Phil
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-08 12:54
    Hi Phil,

    Thanks for helping!

    /MR (Or /CLR) is now connected to +3.3V.

    I have also connected CP to the prop (P17) and a LED to P18 to see if it's working.

    Here is the code
      dira[18..19]~~
      repeat
        !outa[18..19]
        waitcnt(cnt + clkfreq)
    

    Seems that code is working fine since I can see my control led blinking, but the output of the HC166 stay always high :(

    What's about pin6? It's CLK INH in the datasheet. Should I connect it to 3.3? Or gnd? So far it's to gnd.

    I also tried fews differents HC166 just in case, same result.

    Thanks,

    JM
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-08 13:20
    Ok. I think I found something.

    Look like it's not
    Set PE Low
    Set PE High
    Clock

    But
    Set PE Low
    Clock
    Set PE High
    Continue to clock.

    I will continue to investigate.
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-08 13:32
    Ok. I confirm. So I put what I found here just in case someone will face the same issue.

    What should be done is:
    Set clock low
    Set PE low
    Set clock high
    Set clock low => Q receive the first bit
    Set PE high
    repeat 7
    Set clock high
    Set clock low => Q receive the next bit

    This process can be interrupted and restarted from the beginning at any time.

    JM
  • obrienmobrienm Posts: 65
    edited 2010-09-08 13:59
    Hi,
    Do you need the reset on the 166?
    Try using a 165, Parallax sells the 165, I use these exclusively with their SIPO HC595 chip to expand I/O indefinitely on the propeller and isolate the pins. With 2 x 3 = 6 pins you can send/recieve an unlimited number of signals.

    http://www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/catpageindex/2/Level/a/ProductID/230/Default.aspx


    I also sadly no longer use my collection of LS chips anymore in favor of HC which also uses a lot less power.
    74165
    8-bit parallel-in serial-out shift register with asynchronous parallel load and two OR gated clock inputs. 
           +---+--+---+
    SH//LD |1  +--+ 16| VCC
      CLK1 |2       15| CLK2
        P4 |3       14| P3
        P5 |4   74  13| P2
        P6 |5  165  12| P1
        P7 |6       11| P0
       /Q7 |7       10| D
       GND |8        9| Q7
           +----------+
    
    
    74166
    8-bit parallel-in serial-out shift register with asynchronous reset and two OR gated clock inputs. 
    
         +---+--+---+
       D |1  +--+ 16| VCC
      P0 |2       15| SH//LD
      P1 |3       14| P7
      P2 |4   74  13| Q7
      P3 |5  166  12| P6
    CLK1 |6       11| P5
    CLK2 |7       10| P4
     GND |8        9| /RST
         +----------+
    


    thank you
    /michael
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-09-08 14:53
    You wrote that you connected Ds to 3.3V.

    serial Data-input Ds = high
    this means every time you switch the clock with PE high,
    a high-bit is shifted in into the shiftregister. So you will get
    all bits high.

    Ds has to be tied to 0V.

    You have to put the PE-input to low to load the parallel 8 bitpattern
    into the shiftregister. Then switch PE to high to keep the loaded bitpattern
    consistant.

    Then start to clock out the bitpattern. As PE is high and Ds is low
    while clocking out the bitpattern low-bits are shifted in into the shiftregister as Ds is tied to low.

    You have to repeat this for continuosly reading in the inputs.


    Me personally I prefer the 74HC597-chip because this chip has a an inputlatch.

    This means you can send a pulse to transfer the bit-states of the parallel-input into the input-stage of the chip. You make a snapshot of all 8 pin-states. After the snapshot is done the input-pins can toggle-around in any manner it will no longer disturb the bitpattern present
    at the time the snapshot has been taken. The bitpattern will stay consistant.

    After that the pin-states can be transferred into the shiftregister

    Then you clock-out the bits to the serial output.

    best regards

    Stefan
  • obrienmobrienm Posts: 65
    edited 2010-09-08 16:07
    Stefan,
    All this time I didn't know about the 597 PISO complement to the latched 595 - thank you very much I will switch to 595/597 pairs.
    /michael
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-08 18:21
    Hi Stefan,

    Can we chain the HC597 the same way we are chaining the HC166? Between the 3 (165, 166, 597), which one should I prefer?

    Thanks,

    JM
  • dr hydradr hydra Posts: 212
    edited 2010-09-17 13:47
    On the 74HC family. What happens on like a 74HC244 buffer if you hookup the VCC to 3.3V and drive an input pin at 5V? Is the voltage 3.3V or 5 volts on the related output pin?
  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2010-09-17 14:00
    I was under the impression that 74LS chips work ok at 3.3V. Isn't that true?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-17 14:04
    Dr. Hydra, you don't want to do that. Anyway, assuming you don't destroy the chip in the process, you will get 3.3V on the output. To accommodate 5V inputs with a 3.3V Vdd, take a look at the 74LVC family of logic chips.

    -Phil
  • dr hydradr hydra Posts: 212
    edited 2010-09-17 14:42
    On the 74LVC244 would the output still be 3.3V

    Vcc=3.3 input pin 5V related output pin 3.3V or 5V
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-17 16:11
    Yes, the output would be 3.3V.
Sign In or Register to comment.