As I want to build a qlocktwo ( http://qlocktwo.com/ ) I try to use a 74HC595,
chain a lot of them, and solder my leds to them.
What approach in development would you prefer?
Using pins or using SPI ?
Which would you prefer and why?
I personally prefer the pin solution as I dont know anything about SPI
I browsed through some older posts discussing the 74HC595 some where using Pins others SPI.
What is the common and best solution for this?
SPI is more optimised. That’s it’s plus. For a 74HC595 it’s not deemed an SPI device though, even though it’s timing is exactly SPI-compatible. Bit-banging this device is easy, and as you say its more flexible since you don’t need to tie up SPI unnecessarily (but that’s not really a big issue unless you want to use those pins for other things).
after two days of very frustrating work with my breadboard everything is wired up and seems to be running
with my arduino.
with the spider its not working.
maybe i mixed up the pins…
I think i tried every combination of my pins 3,4 and 5 with the latch clock and data in the code snippet from dobova.
but its totally frustrating me…
can anyone tell me which pin in the provided code is what?
SI should be data
CK should be latch
and RK is the clock
In the code above, pin 3 (PIN_RK) is LATCH, pin 4 (PIN_SI) is DATA and pin 5 (PIN_CK) is CLOCK, and the whole thing assumes your extender module is in socket 6, despite asking for ‘numsocket’ on initialising. The pseudocode for the shift register would be:
Set the latch off at the start, ready to program in the next set of bits
for each one of the eight data bits to set, do this:
set the clock off
set the data pin on or off depending on data 1 or 0
set the clock on again - this is the point the shift register notices the value of the data bit
end loop
set the latch on - this is the point at which the shift register sends all eight bits of data out to its output pins.
If you’ve got a breadboard working with Arduino, the only difference needed to get it working with Gadgeteer too would be get an extender module with breadboard headers soldered on connected to socket 6 on the mainboard and plugged into the breadboard, then get GND, 5V and pins 3, 4 and 5 hooked up.
The code above is working fine in a an application driving relays since one month.
Pay attention, because some brend of 595 are different in the latch sequence needed.