I have daisy chained 25 74hc5 95 each has its own 5 volt Power Supply. I would like some help with the shift out commands. I have been having some undesired results. Ie the last 3 or 4 registers stay latched and lit...so that's happening.
Thanks
I have daisy chained 25 74hc5 95 each has its own 5 volt Power Supply. I would like some help with the shift out commands. I have been having some undesired results. Ie the last 3 or 4 registers stay latched and lit...so that's happening.
Thanks
This is a H/W & S/W issue. Post your schematic , or a short version of it. If you don't have a CAD schematic you can post as a PDF file then take a photo of the schematic with your cell phone and post that. Also post your code and identify the source of the code.
I am using this as a template as it "CLAIMS" that this will run 40+ ShiftRegisters
So you are wired up like this, with a decoupling cap on Each device, and sending data out thusly:
digitalWrite (ssPin, LOW); // use D10
for (x=0; x<24; x=x+1){
SPI.transfer(dataArray[x]);
}
digitalWrite (ssPin, HIGH);
#include <SPI.h> at the top of your sketch
SPI.begin(); in setup, commits D13 to SCK, and D11 to MOSI
Decoupling cap ? (maybe you better explain what that is to him.and why he needs it...and what value to use.( I'm thinking at least 0.1uF on EACH chip and 1uF every 5th chip.)
I see where you have in the schematic controlling the ground side. I currently have it reversed. If that changes anything. I am a novice, so where in my code should I place your code?
Thanks guys!
I see where you have in the schematic controlling the ground side. I currently have it reversed.
What does this mean ?
Can you rephase it using pin names to describe what you are talking about ?
In the schematic provided by crossroads the Leds in the top right corner are reversed from how I have mine wired up. Ie the shift register provides power not ground.
Which way matches the datasheet and arduino tutorial?
Either LED configuration works. I drew them that way because I use TPIC6B595 instead to sink full 20mA from each LED, while 74HC595 is limited to 8mA to meet the 70mA total current limit on the VCC & GND pin.
Put it in your code when you decide you want the outputs updated.
Or make it a function and call it when needed.
Or ...
Ok...Rewritten code like this:
(code tags added by moderator)
#include <SPI.h>
int SER_Pin = 8; //pin 14 on the 75HC595
int RCLK_Pin = 9; //pin 12 on the 75HC595
int ssPin = 10; //pin 11 on the 75HC595
//How many of the shift registers - change this
#define number_of_74hc595s 1
//do not touch
#define numOfRegisterPins number_of_74hc595s * 8
boolean registers[numOfRegisterPins];
void setup() {
pinMode(SER_Pin, OUTPUT);
pinMode(RCLK_Pin, OUTPUT);
pinMode(ssPin, OUTPUT);
SPI.begin();
//reset all register pins
clearRegisters();
writeRegisters();
}
//set all register pins to LOW
void clearRegisters() {
for (int i = numOfRegisterPins - 1; i >= 0; i--) {
registers[i] = LOW;
}
}
//Set and display registers
//Only call AFTER all values are set how you would like (slow otherwise)
void writeRegisters() {
digitalWrite(RCLK_Pin, LOW);
for (int i = numOfRegisterPins - 1; i >= 0; i--) {
digitalWrite(ssPin, LOW);
int val = registers[i];
digitalWrite(SER_Pin, val);
digitalWrite(ssPin, HIGH);
}
digitalWrite(RCLK_Pin, HIGH);
}
//set an individual pin HIGH or LOW
void setRegisterPin(int index, int value) {
registers[index] = value;
}
void loop() {
digitalWrite (ssPin, LOW); // use D10
for (int x = 0; x < 24; x = x + 1) {
SPI.transfer(dataArray[x]);
}
digitalWrite (ssPin, HIGH);
}
but have a brain ache How should i define the dataArray?
byte dataArray[0] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};