spiout question

hippy

Technical Support
Staff member
Probably. SPI simply sends out data with no regard as to what that data is or where it is going.
 

srnet

Senior Member
Well, I have used SPI quite a bit on PICAXE, but I cant work out what you mean.

Can you describe in a lot more detail what it is you are actually trying to do ?
 

inglewoodpete

Senior Member
...output to 3 sets of registers from one processor?
1. If the registers are in the same slave chip, then yes.

2. If the registers are in different chips then you could choose to use one of the following methods, depending on the actual chips you are using.
  • Some SPI slaves can be daisy-chained so the excess input is simply shifted through consecutive chips.
  • Most SPI chips have an enable pin, which can be used to get each chip to accept or ignore incoming data.
 

m6cac

New Member
Im wanting to control 3 sets of 60 outputs. My thoughts so for are that i can chain all of the 595's together and switch the latch to give individual control. So there would be no latchout only a high low pin. Hope this is understandable.
 

westaust55

Moderator
3 set of 60 equates to 180 shift registers.
That will take some time and need a lot of data to reach to 180th 74hc595.
Maybe connecting them as three sets with common data and clock signals and three separate latch signals to transfer the data to the outputs.

Can you advise
-which PICAXE chip you are using,
- a bit about the project

I might suggest that an option may be to consider MCP23017 i2c port expanders which each give 16 IO points as two 8-bit ports
So each can be addressed more directly however that might need a few PICAXE parts.
I did an 8x8 RGB matrix (total of 172 LED) long ago with just two MCP23017 chips.
Details posted on the forum if this is akin to what you are trying to do.
 

inglewoodpete

Senior Member
I've done 64 bits (8 x 74HC595) on a 20X2 using hSPI. That's pretty quick.

You could connect 3 sets of 8 74HC595 with the clock signals gated via a quad AND or NOR gate.
 

m6cac

New Member
hello all
I'm back again. I have a ring of 60 rgb leds common cathode. I have 8 74hc595's and a RTC (zs-042). I want to learn how to make this into a working clock.
Could anyone point me in the right direction.
This is a personal project not something for collage or uni.
I just enjoy electronics an want to make this clock.
thanks Craig
 

westaust55

Moderator
Can you provide some further information that will help folks here to help you.

1. Which PICAXE chip are you using?
2. A schematic for how you have the 74HC595 chips and LEDs wired up/connected
3. Do you already have the RTC connected? How? (A schematic please)
4. A link to the data sheet for the ZS-042 RTC module you have -seems it is based on the DS3231 RTC chip.
5. What PICAXE program code have you developed to date (for either the LED driver or RTC).


Does this information on the DS3232 RTC that I posted a couple of years ago help with the RTC side of your project?
http://www.picaxeforum.co.uk/showthread.php?23739-Getting-Started-with-the-DS3232-RTC-and-a-brief-comparison-of-some-other-RTC-chips
 

BESQUEUT

Senior Member
I did an 8x8 RGB matrix (total of 172 LED) long ago with just two MCP23017 chips.
:confused: IHMO 8x8x3 is 192... So this is OK for this clock project.
I have a ring of 60 rgb leds common cathode. I have 8 74hc595's and a RTC (zs-042).
If I well understand, each RGD LED visualize a second, maybe another color for hours and mn...
So you need 3 sets of 8 74HC595 to address 3 LEDs for each second in parallele,
or you can address 3 LEDs for the same RGB serially. In that case, you need 23 74HC595.
 
Last edited:

AllyCat

Senior Member
Hi Craig,

It seems you've been "thinking" about this project for 9 months (since page 1) but at least we now know what you're trying to achieve.

With 240 connections (R, G, B and Cathode for each LED ?) just for the display, it's not going to be a small or easy project. You almost certainly should use a "multiplex", probably 8 x 24. So 4 x HC595 chips should be sufficient, but you need to decide whether to use 1 or 2 SPI busses. You haven't said which PICaxe you plan to use, the reference to SPIOUT implies an X2, but it might be done with an 08M2 (bit banging). ;)

Alternatively, a larger PICaxe might do it all (without 595s) using Charlieplexing, but the common cathodes could be a further complication to an already difficult concept. To see what hardware might be involved in your project, see this excellent finished project with the demo here. :rolleyes:

Cheers, Alan.
 

Buzby

Senior Member
Hi Alan,

Thankyou for your comment about my orrery, it's nice to know someone liked it !.

Regarding Charlieplexing 60 RGB CC LEDs, it can be done with 16 pins, so a 28X2 could do it easily.

The circuit is no more complex than a 'normal' multiplexed arrangement, it's just that there is no easy pattern, so it needs more care when wiring. That's why I wrote a VB prog to layout the LED positions, another to 'wire' the LEDs, and another to calculate the pin switching. It was a real 'labour of love', and I wouldn't do it again !.

Even so, for what the OP wants, I would say Charlieplexing is the best way. Much less wiring, no driver chips, and some clever code.

Happy New Year !
 

m6cac

New Member
thanks all for your replies.
its taken me so long so far because first I don't know how to do it. and I don't have much time. I just keep coming back to it.
I've connected 60 rgb's together. all red together all green and then blue.
first I don't know how to read from the clock module. Then I have to convert to bin then invert. I think this is right.
or do it individually. as in 1=127 255 255 255 255 255 255 255, 2=191 255 255 255 255 255 255 255 and so on.
not sure if I'm doing the right way.
I've not connected the RTC yet and haven't got a drawing just working from my head.
thanks Craig.
 

AllyCat

Senior Member
Hi,

I've connected 60 rgb's together. all red together all green and then blue.
That's not really the "best" way to do it, but if already done, then you could connect the 8 x 595s to make a 64-bit (SPI) Shift Register. The RGB lines could be connected to three "spare" output bits at either end of the SR, but it probably would be better to use three PICaxe pins. However, maybe it wouldn't be too difficult to cut the commoned RGB anodes back to groups of 24, to make a 24 x 8 array/multiplex?

There's no need for masses of "explicit" numerical commands. Just allocate 24 consecutive bytes (variables) and address the individual bits/bytes using PEEK/POKE commands or @BPTR or @PTR variables, together with a "bit-addressable" variable (b0 - b3) or a "bit mask" variable.

Sorry, I don't know about the RTC; it might be a matter of searching for the type number on this forum (or Google) to find relevant program code examples or a data sheet.

Cheers, Alan.
 

hippy

Technical Support
Staff member
The ZS-042 RTC seems to be a plug-in board with a DS3231 on-board including 2032 battery holder.

Should be easy enough to use with a PICAXE via I2C. There are some issues with using that at 5V with a CR2032 battery as the module charges the battery. Seems easy enough to mod the module to disconnect the charging; remove a diode or cut a rack.
 
Top