Shop OBEX P1 Docs P2 Docs Learn Events
shift registers & the javelin — Parallax Forums

shift registers & the javelin

SkankPileSkankPile Posts: 15
edited 2005-01-26 15:24 in General Discussion
I'm looking for some documentation on using the javelin with the 595 chips. I've read the manual and it has a simple example.. but its confusing for me.

I'd like to see how to code it so I'd know how to make.. say the 2nd pin of the 2nd 595 light a led. Most of what I've found has been examples showing counters and I cant understand how to relate the counter to make a certain pin on a certain 595 chip have an output.. what am I missing? I'm hoping to get this working and then run it through some optocouplers.. as I'd like to free up some pins.

Anybody have any examples?

Skankroll.gif·yeah.gif

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-24 23:18
    Perhaps this will help: http://www.parallax.com/dl/appnt/jav/class/apsr74xx595.java

    I've attached a demo that shows how to use the '595 class.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA


    Post Edited (Jon Williams) : 1/25/2005 5:22:32 PM GMT
  • SkankPileSkankPile Posts: 15
    edited 2005-01-25 16:43
    Please forgive my naivete’
    I’m a little confused..

    here is what I'v come up with:

    import stamp.core.*;
    public class lightleds {

    //map javelin to the 595chip pins
    final static int DATA = CPU.pin0;
    final static int CLOCK = CPU.pin1;
    final static int LATCH = CPU.pin2;

    public static void main() {
    CPU.writePin(LATCH,false);
    CPU.writePin(CLOCK,false);
    CPU.writePin(DATA=,false);


    while(true){
    write595(1); //I'm guessing this will turn on a LED attached to Qa
    CPU.delay(7500); //a little dalay
    write595(17) //turns on LEDs attached to Qa & Qe?

    } // end while


    static void write595(int LEDpin){
    CPU.shiftOut(DATA, CLOCK, 8, CPU.SHIFT_MSB, LEDpin <<8 );
    CPU.pulseOut(32767, LATCH);
    } // end write595

    }


    What if I want QA to remain on for longer than the pulseout limit of (32767 * 8.68us) units?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-25 17:24
    I attached a very small demo for the class that was pointed to earlier. The whole point of the class is that you don't have to modify it, you just instatiate an instance and call its methods.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • SkankPileSkankPile Posts: 15
    edited 2005-01-25 19:00
    sweet.. I did not see the attachment.. idea.gif


    thanks Jon.. thats most helpful.
  • SkankPileSkankPile Posts: 15
    edited 2005-01-26 03:09
    I was so excited about getting this working and having the ability to add so many more pins I had to post a pic.. now I just need to figure out how to daisy chain the 595's

    I started running out of pins on the breadboard so I could only hook up 4 LED's.. but if anybody else wants to get this working quickly maybe my picture will help..
    640 x 480 - 230K
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-26 15:24
    If you look at the class module it is built to let you chain devices (see StampWorks book for schematic).

    Let's say you have two 595s, connected like this: Javelin --> A ---> B

    What you do is output the value for unit B with the outNoLatch() method. This will actually put them into A and push what was in a into B. Now you output the value for unit A with the out() method. This pushes the values intended for B into in, moves the value for A into it, then latches the outputs of both units.

    Trust me, it's more complicated to explain than it is to work with.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA


    Post Edited (Jon Williams) : 1/26/2005 3:28:24 PM GMT
    800 x 1430 - 61K
Sign In or Register to comment.