Are 74HC595 with ULN2803 enough to run stepper motors?

If I'm using the stepper motors with those chips: ULN2804 and 74HC595; then, is the 74HC595 enough or do I need TPIC6C595 without ULN280x?
To run two stepper motor with 4 pin, is that enough with each ULN280x with 8 of elements per chip ?

I will soon shop in RS-Online to buying a lot of 74HC '165 (10p) for input and '595 (200p) for output.

Regards from Begraphics.

You can only drive unipolar stepping motors with a ULN280x, not a bi polar stepping motor.

The problem is that the ULN2803 it that it is from an older era of electronics and does a poor job of switching loads, especially at 5 V.

if you want to control it with a shift register, it makes no sense to do the job poorly using two chips when the TPIC6C595 alone will do it properly.

Hmm... See that TPIC6C595 is cheaper than ULN2804 and 74HC combined.

I have another question, is that possible to have an special configuration which are:
For example
PORTA to send which byte of latch shall be in use with 8 to 256 demultiplier to make direction
PORTB to write an value to store for use such with stepper motors. It is similar to 74HC164, not '165. Not using shift register because it takes maybe 25 instruction per bits to write each bit. So 25*8 = 200 instruction in register each shift register to write; then multiply shift registers with 200. Then it takes 40.000 bytes of instruction cycle. So, I want to discover quicker in improvement in later revision of home cockpit which I shall build to play simulator just for fun.But the first revision, I guessing will be something like a toy to just play with experiment. With Arduino MEGA2560 that can read 128 kB each second with 16 MHz speed... So maybe that is not enough speed to calculate other functions such as between mach and knots and atmosphere to detect real mach speed and such degrees between magnetic and north pole while I am flying.
Is that possible?

It is not clear what your proposed circuit is doing. However, i suspect your concerns over the number of instructions are not important. If you need to input or output data to many shift registers (74hc595 or tpic6x595 for example) you can use the Arduino's hardware SPI interface, which can run at up to 8MHz on Uno/Mega.

To demonstrate how fast this technique is, see this video. Here, and Arduino Pro Micro (same speed as Uno/Mega) is sending 128x8 bytes to the oled display for each video frame, at around 50 frames per second, usung SPI. At the same time, the Arduino is performing calculations for Conway's Game Of Life on a 128x64 grid, also at 50 frames per second.

PaulRB:
It is not clear what your proposed circuit is doing. However, i suspect your concerns over the number of instructions are not important. If you need to input or output data to many shift registers (74hc595 or tpic6x595 for example) you can use the Arduino's hardware SPI interface, which can run at up to 8MHz on Uno/Mega.

To demonstrate how fast this technique is, see this video. Here, and Arduino Pro Micro (same speed as Uno/Mega) is sending 128x8 bytes to the oled display for each video frame, at around 50 frames per second, usung SPI. At the same time, the Arduino is performing calculations for Conway's Game Of Life on a 128x64 grid, also at 50 frames per second.

You said that it produce 128x8x50, that's 50 kB and 128x64x60 that is 400 kB; thus, the whole is 450 kB without calculation.

But isn't that any solution to access direct bits in bytes with PORT function to make it faster?
The CPU has certainly direct access to bytes that is the fastest method with least as possible instructions.
Look at RAM, I want that the bits in bytes using as pins.

I'm still not clear what you want to do. But it is clear that you want to find a way to do it with direct PORT manipulation. So I wish you good luck with that.

Imagine a 74hc164, not '165 with write possible with a noter port to selet which byte shall be written to.
Or using 10 bits that eight pins are using to write to eight piece of TPIC6C595, 16, or 32 piece of that with daisy chain. One pin is shared with latch to all chips. The last pin is clock cycles.
Is that better solution than using bytes in flip flip and selet which byte write to?

Can you try again with that, I could not make any sense out of it.

What is a flip flip?
The 595 is a serial in parallel out shift register so you can't write to it in parallel.

On the Uno there is no port that has 8 usable output bits, to get a free port you have to use the mega.

Such as SN74LVC574AN Texas Instruments | Integrated Circuits (ICs) | DigiKey Marketplace and 74HC154PW,118 Nexperia USA Inc. | Integrated Circuits (ICs) | DigiKey to select which logic flip flop shall be enabled to write signal while other logic flip flops cannot be written to.
Do you understood now ?

Shift register is a great idea too; but I don't want to update the whole shift register often while; let us say half of them are updating often. Such as LED diodes and some inputs, and some stepper motor do updating sometimes.

Do you understood now ?

Well those links used the correct words "flip flops" where as you were talking about "flip flips".

Begraphics:
Imagine a 74hc164, not '165 with write possible with a noter port to selet which byte shall be written to.
Or using 10 bits that eight pins are using to write to eight piece of TPIC6C595, 16, or 32 piece of that with daisy chain. One pin is shared with latch to all chips. The last pin is clock cycles.
Is that better solution than using bytes in flip flip and selet which byte write to?

Also those chips you linked to are not the chips you were talking about before. They are not shift registers at all which is what the 74xx164 and 74xx165 and TPIC6C595 are.

It is amazing how using the right words and the right chip numbers change the meaning of what you write.

but I don't want to update the whole shift register

There you go again. If it is a shift register you have no choice but to update it all, so that statement is a nonsense.

I would suggest what you want is an 75HC259 addressable latch.

Grumpy_Mike:
Well those links used the correct words "flip flops" where as you were talking about "flip flips".

Also those chips you linked to are not the chips you were talking about before. They are not shift registers at all which is what the 74xx164 and 74xx165 and TPIC6C595 are.

It is amazing how using the right words and the right chip numbers change the meaning of what you write.
There you go again. If it is a shift register you have no choice but to update it all, so that statement is a nonsense.

I would suggest what you want is an 75HC259 addressable latch.

Yes, 74HC259 is this what I am looking; that to combine with logic flip flop which is for select which flip flop shall be written to.
But maybe better with 1x4:16 in another PORT at the MEGA2560 that have 16 select as option?

Now I am thinking a bit.
The CPU can select which 8 bits write to with another port with 1x7:128 two pieces of that leads to 16384 pins; so, I can have huge LED and buttons, mechanical parts, and put the digital to analog function to move the gauges absolutely smooth, and control panel. And, for fun with huge pins to have a big playground for me as an adult male!

I have been thinkered more about '165 and '595.
To read '165 serially with daisy chained then convert to byte adress takes many instruction cycle which is not a good idea for me who is building simpit; so, I will using the logic flip flop because it takes just one time to pointer to the selected logic fifo with PORTA. Then, send or receive the byte value through PORTB which can also be used with both ADC and DAC with parallell interface.
I thinking in conclusion, the logic flip flop is the fastest method because not necessary to convert serial to paralell and with priority order in the logic flip flop with for example some output need fastest updating rate will be placed in first order and the input such as toggle switches for instruments can have lower updating rate; this method is same with output. Therefore, with programming technicque in for loop to select how many logic flip flop will be read and write.
For example:
a is dynamic
b is also dynamic
for (byte x = a; x <= b; x-- (decrement is faster in cpu) )
{
read or write after the priority order dynamically after each void loop.
Such as with first loop, it read all inputs then second void loop it read just 80%, then third loop, it read some areas such as 0 to 3, then 7 to 100, then 102 to 103 then 200 then 245 to 255 in select logic flip flops with array to put the value to a and b and determine priority order so it don't read until 255nd logic flip flop. Or it can be done without for loop so it replaced with array with every if control structures in every logic flip flop.
}

Now I am a better programmer than before :slight_smile: I give credit to my "wage".

"To read '165 serially with daisy chained then convert to byte adress takes many instruction cycle "
No, with SPI it does not. Example:

digitalWrite (latch165, LOW);  // can use direct port manipulation to increase speed of this also
digitalWrite (latch165, HIGH); // rising edge captures the data
byte0 = SPI.transfer(0); // ~ 17 clock cycles for this to happen at 8 MHz
byte1 = SPI.transfer(0);
byte2 = SPI.transfer(0);
byte3 = SPI.transfer(0);
// do whatever with the 4 bytes
// can capture the data into an array instead:
byteArray[0] = SPI.transfer(0);
byteArray[1] = SPI.transfer(0);
byteArray[2] = SPI.transfer(0);
byteArray[3] = SPI.transfer(0);

What does the SPI.transfer(0) exactly does?
From byte to byte or byte to serial to byte?

SPI stands for Serial Peripheral Interface. Why not Parallell Peripheral Interface (PPI)? The issue with SPI and equiments that is possible with daisy chained, they MUST! be updated whole even you want to change only one bit if no else shall be changed each time.
I want to update when it is necessary.
That's why I want to use array with start and stop.
That way:
// start array[0] = 0;
// stop array[1] = 3;
// start array[2] = 5;
// stop array[3] = 5;
// start array[4] = 250;
// stop array[5] = 255;
With stop to start to determine where the pointer shall go to with for loop to determine the value in arrays. with pointer to jump from 3 to 5 then when it is finished to jump, the pointer in array[1] = 3 change to no operation instruction. That saving time than to updating whole with 74HC595 in eight lanes or SPI that I need maybe 500 items of SPI chips that makes not ideal for my project. With 74HC595, that might causing the LED diodes flashing because it doing updating.

It transfers a byte from the register in the attached device through a serial link to a char (byte) variable. But it is performed using the high speed serial hardware of the two devices.

After checking more fact about SPI; yes, it is correct.
Maybe Parallell Peripheral Interface will come in future from companies.
But first now I focusing to choose SPI, 74HC595, or 8-bit flip flop.
I saw in the internet that it is possible to have more SPI in same SPI port in MEGA2560 if I using digital pins with demultiplexer.
So, I have option SPI or flip flop. 74HC595 is slow.
Which is better?

What does the SPI.transfer(0) exactly does?

Clocks out 1 byte on the MOSI pin accompanied by a clock pulse with each bit on the CLK pin.

Why not Parallell Peripheral Interface (PPI)?

Because the interface is serial and not parallel, the fact you are feeding it into a shift register to generate a parallel output is just one use of this interface protocol.

I want to update when it is necessary.

Tough titty, you can't.

You can cascade multiplexers and latches if you want but it is a lot more hardware.

This is a circuit I published in 1985 showing how to cascade multiplexers to get 32 inputs and 32 outputs from a few digital outputs. It was designed for the BBC Micro computer's 8 bit user ports but can be attached to an Arduino. You can also add another level of multiplexers and more latches to have as many bits of input and output as you want.

Down load the image for better resolution.

Grumpy_Mike:
This is a circuit I published in 1985 showing how to cascade multiplexers to get 32 inputs and 32 outputs from a few digital outputs. It was designed for the BBC Micro computer's 8 bit user ports but can be attached to an Arduino. You can also add another level of multiplexers and more latches to have as many bits of input and output as you want.

Down load the image for better resolution.

Your idea are good. But I need far more inputs and outputs.
So, now my option are:
demultiplexer with logic flip flop to select the 8-bit flip flop to write to.
demultiplexer with SPI that I can select the SPI chip to read I/O.