Hi
May I know if we can write a shift register program without using a 74HC595 in Arduino Uno when using with Mamba
Thanks
Can you please explain what you want to do ?
It sounds like you want to put a bit pattern out on 8 Arduino pins. Is that it ?
I need a Serial In Serial Out Shift register. So the output appears only in one pin.
A serial in, serial out shift register sounds like an odd beast. Won't the state of the output pin simply be the same as the input pin ?
shanu:
I need a Serial In Serial Out Shift register. So the output appears only in one pin.
The 595 has a cascade output that does that. Assuming that you want an 8 stage shift register. But I'm catching a whiff of an XY problem here.
This is (probably) an XY problem
What are you trying to do?
I need it to create an 8 bit SISO shift register so as to make an 8 bit waiting period, and I would like to know about a method without using additional IC(74HC595).
shanu:
I need it to create an 8 bit SISO shift register so as to make an 8 bit waiting period, and I would like to know about a method without using additional IC(74HC595).
You can easily do that in software.
I am a beginner, please help.
shanu:
I am a beginner, please help.
You could start by telling us what "Mamba" is. Not the music style, I assume. Also what you are trying to do with it, as requested in reply #5. The entire thing, not just the part of it that you think you need.
I need it to create an 8 bit SISO shift register so as to make an 8 bit waiting period, and I would like to know about a method without using additional IC(74HC595).
There's a built-in peripheral called SPI which is really a SISO shift register.
References:
http://forum.arduino.cc/index.php?topic=184527.0
Bitbanged SPI
ATmega328P Datasheet
Using an Arduino to do this is very "sledgehammer o crack a walnut", and it won't run as fast as a chip. Why not just spend five bucks and get yourself a 74HC595?
Anyway. I just had a look at the datasheet. You probably want something like this:
const byte DSpin = 14;
const byte SHCPpin = 11;
const byte notMRpin = 10;
const byte Q7Spin = 9;
byte DS;
byte SHCP;
byte notMR;
byte state;
void setup() {
pinMode(DSpin, INPUT);
pinMode(SHCPpin, INPUT);
pinMode(notMRpin, INPUT);
pinMode(Q7Spin, OUTPUT);
}
void loop() {
byte SHCPprev = SHCP;
DS = digitalRead(DSpin);
SHCP = digitalRead(SHCPpin);
notMR = digitalRead(notMRpin);
if (!notMR) {
state = 0;
}
else {
if (!SHCPprev && SHCP) {
state = (state << 1) | (DS ? 1 : 0);
}
}
digitalWrite(Q7Spin, state & 0x80 ? HIGH : LOW);
}
May I know if we can write a shift register program without using a 74HC595 in Arduino Uno when using with Mamba
Mamba Shield uses SPI and has an Arduino driver. Is this what you're referring to?
I'll bet it is. I'll also bet that we can't be helpful without getting feedback from the OP.