shift registers & the javelin
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?
Skank
·
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?
Skank


Comments
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
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 Williams
Applications Engineer, Parallax
Dallas, TX· USA
thanks Jon.. thats most helpful.
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..
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