The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
Ahhhhhh..... Can someone lend me a hand before I go nuts?
I am trying to setup two 74HC595 chips to control 16 LED's - and am using the wiring here: http://arduino.cc/en/Tutorial/ShiftOut
(I hooked up the reset pin 10 to ground it out for clearing, as seen in code)
I am trying to run this using my code, posted below.
Here are two video's of my results, almost on.
(LED1 to the left, then up towards right)
Any kind words / advise on how to fix this up?
Thanks,
Andrew
public class Program
{
static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
static OutputPort led0 = new OutputPort(Pins.GPIO_PIN_D0, false);
static OutputPort SRreset = new OutputPort(Pins.GPIO_PIN_D1, false);
static Cpu.Pin Data = Pins.GPIO_PIN_D11;
static Cpu.Pin Clock = Pins.GPIO_PIN_D12;
static Cpu.Pin Latch = Pins.GPIO_PIN_D8;
public static void Main()
{
// Reset registars (pin 10 on 595)
SRreset.Write(false);
SRreset.Write(true);
display(new bool[] { true, true, true, true, true, true, false, false, true, true, true, true, true, true, false, false });
Thread.Sleep(1000);
display(new bool[] { false, false, true, true, true, true, true, true, false, false, true, true, true, true, true, true });
Thread.Sleep(1000);
display(new bool[] { false, false, true, true, false, false, true, true, false, false, true, true, false, false, true, true });
for (int i = 0; i < 16; i++) {
bool[] tmp = new bool[] { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false };
tmp[i] = true;
display(tmp);
Thread.Sleep(1000);
}
Thread.Sleep(1000); //keep debug window up for a sec.
}
private static void display(bool[] vars) {
// ouput data from array of bool values
// Outputs
OutputPort LatchO = new OutputPort(Latch, false);
OutputPort ClockO = new OutputPort(Clock, false);
OutputPort DataO = new OutputPort(Data, false);
for (int i = 0; i < vars.Length; i++)
{
// pulse / data
Debug.Print("Working with: " + i + " set to: " + vars[i]);
DataO.Write(vars[i]);
ClockO.Write(true);
ClockO.Write(false);
DataO.Write(false);
//Pz();
/*if (i % 8 == 0) {
// Send the data pulsed to output?
Debug.Print("Latch");
LatchO.Write(true);
LatchO.Write(false);
//next chip from here?
}*/
}
LatchO.Write(true);
LatchO.Write(false);
LatchO.Dispose();
ClockO.Dispose();
DataO.Dispose();
}
private static void Pz(){
// pause w\ some hardware feedback that things are happening
led.Write(true);
Thread.Sleep(1);
led.Write(false);
}
}
I've done this (i.e. several '595's) with both the ezExpander and 'from scratch' on a breadboard.
Are you more interested in the code or the circuit? I can post the code tonight, but it may take a few days to transcribe the circuit to something that is postable...
In the meantime, have you read this? http://forums.netdui...ch__1#entry6593
and just the first 595 wireup - should be all off / on cycle....
I would like to see the code you used, may save my sanity.
Thanks, Andrew
Edit, Added video
Wow - I'll check my wiring 4 times before posting, seeing that 3 times was one time too little for things to work.
Now works w\ code from other thread, thanks!
I would still be interested in your code however.
Andrew.
Glad you got it working. I'll post my code tonight. Getting these to work in series is mostly in the circuit. The code does not change when using two '595's, I just pass a 16-bit value.
Your code is so nice ! It works perfecty with 8 leds. I'm waiting for my 4 shift register OUT (shit ! i've bought some but for input not output lol (i'll make a keyboard so ... ^^)
I'll take a picture of mine for you (i've made something very beautifull with the wires hahaha)
Now i need to make it work with SPI. It didn't perfecty until now ... Have you already try ?
Thank a lot by the way
Now i need to make it work with SPI. It didn't perfecty until now ... Have you already try ?
Thank a lot by the way
Funny, never seen this thread, but I made a library (including schematics) with those IC's over SPI.
See http://forums.netdui...h-the-netduino/ for more details.
Haha i've already download your code.
I've a question, should i use the same pin on my netduino in order to use spi ? I'm using pin 1, 2 ,3
static Cpu.Pin Data = Pins.GPIO_PIN_D2;
static Cpu.Pin Clock = Pins.GPIO_PIN_D3;
static Cpu.Pin Latch = Pins.GPIO_PIN_D1;
your code is very good. But i've not understand everything.
Outputportshift
Multispi
ic...595
ic...595chain
I'm not getting everything. I'll try tomorow or in 2 days to make it work with it.
That's not so much complex but i'm a noob with netduino stuff.
Thanks
Nope. Managed SPI on Netduino is only possible on pins 11 to 13. See also http://sandbox.netduino.com/SPI.ashx
It's the only managed SPI bus the Netduino has. You could connect the IC's like this schematic:
You could discard the left part if it's only for 595's
THank you so much for your fast answer !
I was using pin 1 2 3. That could be a reason why it doesn't work ... ^^
I'm going to have a deeper look to your code right now. I'll give you feedback.
Good night Stefan and thank for helping !
Netduino got a little community. But a very nice one