Shop OBEX P1 Docs P2 Docs Learn Events
Problems with the 74HC595 and 74HC165 — Parallax Forums

Problems with the 74HC595 and 74HC165

jcoloniasjcolonias Posts: 31
edited 2012-10-25 06:50 in BASIC Stamp
Hi,
I am trying to utilize the expander circuit shown the Stampworks (p.143) which is a combination of a
74HC595 and a 74HC165. I intend to use it as shown in the attached picture, but for purposes of learning how it works; I use only one IR circuit.

The circuit is simple enough to wire on my Parallax professional board; therefore, I feel that the errors that I get are my programming which is also attached.

The programming is also the example given at Stampworks, plus the additional programming needed to
address the one input IR detector and the one output t IR Led.

Why do I get some times all ones, or all zeros in the DEBUG statement, and my IR test in the program never works!

I hope it is something I do not understand in the way the expanders work, and I would appreciate very much if any of you could help me to overcome this problem and go ahead in implementing the circuit with more IRs.

Thanks, John
374 x 420 - 36K

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-09-10 14:23
    John,

    The I/O expanders make it easy to add Input/Output pins to your BASIC Stamp Microcontroller, however the inputs/outputs cannot take on the special functions available to the pins on the BASIC Stamp Module itself. For IR detection the BASIC Stamp Module generates a 38.5kHz pulse on the output pin to the IR LED. The IR detector is designed to operate and decode data at that frequency, however it is not possible in this configuration to generate the 38.5kHz you're expecting.

    I/O expanders on the BASIC Stamp Microcontroller are better suited to high/low input/output functions such as controlling LEDs or drivers for relays. Likewise the inputs are great for scanning large numbers of buttons or DIP switches. However you have to remember that it takes time to shift the data out and then latch it to the pin in the case of the 74HC595 and time to latch and shift in the data from the 74HC165. You would need a high-spped microcontroller to do this in that manner using shift registers. If you have further questions please reply and I will do my best to help.
  • jcoloniasjcolonias Posts: 31
    edited 2012-09-10 18:49
    Chris,

    Thank you so much for clearing this point! I was sure that there was something that I did not understand
    about the function of these chips, and your comments made everything clear.

    Now I got to think of another way to run 4 IRs. Maybe I can use two BS2 (since I have about 5 of them)
    and put 2 IRs on each BS2.

    Would that work?

    Thanks again,

    John
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-10 20:42
    If you don't mind having the IR LEDs operate at the same time (identically), you can put two LEDs in series with an appropriate resistor for the amount of current you want (2 LEDs = 1.7V + 1.7V = 3.4V; a Stamp I/O pin produces about 4.7V. The resistor has to drop 4.7V - 3.4V = 1.3V. For 10mA LED current, you'd need R = 1.3V / 10mA = 130 Ohms). A Stamp I/O pin can handle 20mA and you could have two of these strings (2 LEDs and 1 resistor) in parallel.

    The sensors would have to be separate, on separate I/O pins. If you'd only use one sensor at a time, you could use a multiplexor like this one.
  • jcoloniasjcolonias Posts: 31
    edited 2012-09-11 07:11
    Mike,

    Thanks for the suggestion. I will try it.

    John
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-09-12 11:31
    jcolonias wrote: »
    Chris,
    Now I got to think of another way to run 4 IRs. Maybe I can use two BS2 (since I have about 5 of them)
    and put 2 IRs on each BS2.
    Would that work?

    Thanks again,

    John

    If you're just trying to save I/O pins then use the pins on the BS2 to handle the IR stuff directly, that will consume several I/O pins, but you can still use shift registers to offload output only and/or input only high/low functions to devices that don't need to use special commands and will always just be a 0 or 1. You have to use the pins on the BS2 when you're using commands like FREQOUT, PULSIN, PULSOUT, RCTIME, SERIN, SEROUT, etc. Basically any command that does anything but read an input high/low or send one out. If you have several of those that's when the shift registers really become useful. Driving an array of LEDs, relays, etc. I hope this helps.
  • edited 2012-10-25 05:39
    Dear John,


    im have a projetc with hc595, but my problem is a noise in circuit.

    Some times the number changes. Ex:

    I send: 11001100

    and the result is: 11011100.

    Can you help me?

    Rodrigo Ribas
  • Mike GreenMike Green Posts: 23,101
    edited 2012-10-25 06:50
    There are so many possible causes of dropped bits that you really need to provide a schematic of your circuit including power connections and a listing of your program for us to help you. You need to include a description of how you have things connected and the distances involved.
Sign In or Register to comment.