Shop OBEX P1 Docs P2 Docs Learn Events
Example code for 74hc595 — Parallax Forums

Example code for 74hc595

azmax100azmax100 Posts: 173
edited 2007-06-06 15:04 in BASIC Stamp
hi

Can sombody show me some example with shiftout from BS2 to 74hc595.

I want to use·2 of ·74hc595 to drive some relay (about 16 of them)·trough 2 of uln2803.

I've view the example in Stampworks manual but it's too brief for me to understand.

I dont need full code just some example so i can learn·from it.

Thanks & regards·

Comments

  • NewzedNewzed Posts: 2,503
    edited 2007-06-05 11:44
    Hereis a 595 Test Code.



    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Yesterday is history, tomorrow is a mystery, and today is a gift.

    That is why they call it the present.

    Don't have VGA?
    Newzed@aol.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-06-05 14:18
    Hello,

    The Stamp Works Manual has examples connecting one or more 74HC595 chips. You can find the manual and downloadable source code on the following page. Take care.

    http://www.parallax.com/detail.asp?product_id=27297

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • azmax100azmax100 Posts: 173
    edited 2007-06-06 01:40
    hi.

    Thanks Newzed for the example.

    [noparse][[/noparse]'Now suppose we want to make pins Qa, Qb, Qd and Qh all high to turn on 4 Darlingtons
    'at once.· We are using lsbfirst, so the first bit out goes to Qh and the last bit
    'out goes to Qa.· In binary, we would want to send %11010001.· However, you can use
    'either binary or decimal - it doesn't matter.· After all, the decimal gets converted
    'to binary by the Stamp before it is transmitted.· So %11010001 = 128+64+16+1=209


    LOW latch
    SHIFTOUT dat, clk, LSBFIRST, [noparse][[/noparse]209]
    PULSOUT latch, 5
    LOW latch
    'The four outputs pins will stay high until you turn them off or power down
    GOTO start]

    Now I understand better but how to make the pin low. let say i want to make pin Qb high for 100us can I do this?

    LOW latch
    SHIFTOUT dat, clk, LSBFIRST, % 01000000
    PULSOUT latch, 5
    PAUSE 100
    LOW latch

    Is it right? Sorry for dumb question. I'm a self learner.

    Chris thanks for the link. actually I already read it but not quite understand cause it's too brief.

    ·
  • NewzedNewzed Posts: 2,503
    edited 2007-06-06 11:53
    Asmax, in the shiftout 209 example the pins will be HIGH.· My error.· Your example to make Qb HIGH is correct.· To make any pin
    LOW, simply send a 0 to that pin.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Yesterday is history, tomorrow is a mystery, and today is a gift.

    That is why they call it the present.

    Don't have VGA?
    Newzed@aol.com
    ·
  • azmax100azmax100 Posts: 173
    edited 2007-06-06 15:04
    Hi all.

    Thanks newzed.

    To make the output high send %1

    to make the output low send %0

    That simple. How come I did't think of that.
Sign In or Register to comment.