Picaxes Latches, Clocked Serial and I need an Enabler

I am working with a ShiftBrite RGB led and I have it working nicely with an Arduino. The curse of course, is the fact that Arduinos have libraries and a lot of the "work" has been done for you. Now I want to get this guy working with a Picaxe and I am looking for a crash course on clocked serial, latching, enableing (sic) etc.

Learn me in my head with stuff you know good.

Looks like SPI comms

It looks like SPI communications in there.  Picaxe’s shiftout (spiout) commands (or hardware equivalents) should do the job if I’m correct. Those ShiftBrites seems to work like shift registers (hence the name?). Just keep on writing bits to Data In until SB “gets full”. Most significant bit goes first (31, then 30, 29 so on). Then hit the latch pin up for a while and those bits are “applied” as new led values. If you have multiple SB’s in series like in this then write the bits of the last SB (furthest away from Picaxe) first, then second to last and so on. The first SB in line gets its value last. After writing all those value hit the latch pin.

That enable is just like enable in L293D except it has “reverse” logic. Set it low and leds are lit. Set it high and leds are off.

This is how I understood those ■■■■■■■■■■■ but I could also be totally wrong :slight_smile:

 

No video

Better yet: The Picaxe Simulator - fully interactive!

Try this code for fun.

#picaxe28x2
# demonstrating the bit shift operators in X2 picaxes
# for use in simulator
# https://www.robotshop.com/letsmakerobots/node/22525
# by rik
symbol p = 300

b0 = 1
for b9 = 0 to 9
   b0 = b0 << 1
   pause p
next b9
for b9 = 0 to 9
   b0 = b0 >> 1
   pause p
next b9

pause p
w1 = 5
for b9 = 0 to 14
   w1 = w1 << 1
   pause p
next b9
for b9 = 0 to 14
   w1 = w1 >> 1
   pause p
next b9

You could open the arduino

You could open the arduino library and see how it does it.

or read the datasheet. :stuck_out_tongue:

Got a bit carried away

I got a bit carried away with this. Inspired by rik’s Picaxe bit shifting demo I decided to write little bit shifting applet. You can try it here (if it works): http://personal.inet.fi/private/nuumio/bitapplet/BitApplet.html

Took me the whole day (and a good part of the night) but it was fun to make. Source is available too here. Be warned: looking at the source will not help you understand bit shifting. It will probably mess up your head for good.

Those tiny little bits live in a cruel world!