Decoding the Program for 15 RGB
The program creates it's own PWM without use of internal PWM of the PIC.
There are 15 RGB or total of 45 bits that needs to be addressed at each pass thru.
A) PWM and color coding is sulmultaneously achieved by creating 15 "Groups" (15 main subroutines). Each "Group" creates one frame of motion picture. Each Group is looped 15 times for motion smoothness. With 15 Frames you can make the movie. Each Frame places one specific color set across all 15 RGB. Next frame moves the same color set over one RGB and so on until the 15th RGB on the 15th frame will have same color as the 1st RGB on the 1st Frame.
B) Each Group calls 5 "Sections" (multiplex 5 you see in schematics) to set the colors on 15 RGB. There are 15 x 5 = 75 Sections called in the program for the entire movie.
Eah section loops 100 times to refresh the color and to prevent flickering. Each section has 3 pair sets of color command. PortB1, PortA1...PortB2, PortA2,...PortB3, PortA3 (Resolution 3) setting and maintaining colors.
C) At the same time that colors are called (8 bits of PortB, plus bits A0 of PortA), bits of A1, A2, A3, A6, A7 are set one at a time to indicate which of 5 sections are addressed completing the multiplexing.
Section 1 sets colors for RGB1, RGB6, RGB11, Section 2 sets colors for RGB2, RGB7, RGB12.......and Section 5 sets the colors for RGB5, RGB10, RGB15.
D) After one entire frame is completed, 5 sections are called and 15 LED's have been addressed. Next frame will change the color code in PortB+A0 and calls 5 more sections and so on...
I did try the system with 4 bit resolution (Calling 4 pair sets of color commands) and I simply ran out code space. (Addtional 6 lines per section x 75 sections) But that does not make a difference as the resolution sets the color and not the transitions between frames.