ColorRot: Objective is to place 12 individual colors across 12 RGB modules with smooth transitions in between them. Then move 12 colors to the left until entire rainbow is rotated across 12 RGB.
Hardware: We are multiplexing 12 x 3. Which is 12 Anodes x 3 colors (R,G,B) cathods.
Anodes are directly fed from 12 pins (A3-A0 and B7-B0), and Cathods are sunk by 3 NPN transistors (A4, A6, A7).
Software: 3 major colors are selected (R,G,B as an example). On the scale of 12 RGB these 3 primary colors are separated evenly with 3 steps in between them. So RGB1=Red, RGB5=Green, RGB9=Blue. Zooming in between R and G, your individual colors become Green , (Yel/Grn) , Yel , (Yel/Red) , Red. These depict colors for RGB5-RGB1
Remember your colors are placed in A7, A6, A4. And A5 is your MC so we do not mess with it. That leaves us with 12 free ports to modulate while we modulate RGB.
Main program calls Frame1. This frame has 3 components (Red, Green, Blue) which I call Sections. So each Frame scans Red, then scans Green, then scans Blue.
In each scan we have different intensity for anode ports (A3-A0 and B7-B0). Numbers below indicate intensity. I clarify how to get those numbers briefly.
Looking at color timeline and ignoring scales on right and bottom and focus on where triangles peak and drop, you get different intensities for each 12 pins.
Frame1
Sec1 (scan color Red, A4=1): PortA: 0001-3210 PortB: 0000-1234
Sec2 (scan color Green, A6=1): PortA: 0100-0000 PortB: 1234-3210
Sec3 (scan color Blue, A7=1): PortA: 1000-1234 PortB: 3210-0000
------
Now to produce intensity (0-4):
Sec1:
A: 0001-1110 B: 0000-1111 then call output
A: 0001-1100 B: 0000-0111 then call output
A: 0001-1000 B: 0000-0011 then call output
A: 0001-0000 B: 0000-0001 then call output
Do the same with all the other 2 sections. Call Frame1 and now you have 12 static colors on 12 RGB modules with smooth fade in between them.
To get movement of all colors across 12 channels and to loop around, you shift the above lines of the section to the left A3-B0. You save the 4 MSB of PortA which are your colors, do your rotation and then add those 4-bits back to each line.
The hard way you will have 12 Frames, each Frame calls 3 Sections, and you will have 36 Sections. But if you look at the code for Sections you will find that the Sections Lines Rotate up as you Rotate the bits left. So 24 Sections are actually duplicate of needed 12 sections. So overall you need 12 Frames, 12 Sections, with 4 sets of lines in each Section.
Your entire motion picture which is moving 12 colors across 12 RGB modules from RGB1 to RGB12 takes 12 Frames.