16x32 RGB Matrix - the beginnings of a pic32 lib
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

16x32 RGB Matrix - the beginnings of a pic32 lib

by avriot on Sat Nov 26, 2011 7:53 pm

Hi all,

Here are the beginnings of a RGB Matrix library for the adafruit-sold pic32, aka the pinguino. As the current standard dictates, this has almost the same pin structure as the main library and the alt-library, but not quite :) See the .pde for details. Admittedly, I moved things for my own project, so one can probably move the A2 and A3 pins back without any issues (if you're willing to change the code).

This is also for a very specific configuration of panels. I've got 3 of them stacked on top of each other making a 32x48 matrix. The "index" loops around, meaning, if one was to flip the panels over, the arrows would look like this:

<----------------- attached to pinguino
<----------------- (0,0)

with ribbons from the top of the arrow of one panel attaching to the bottom of the arrow of the next. The (0,0) marks the origin, with y increasing vertically and x increasing to the *left*.

About the code:

First, my apologies to the CS/CE folks out there - this is my first time ever doing anything directly with the hardware, so I've probably done many many horrible things. May I suggest a beer or a glass of wine before taking a look at the code? However, the fact is, it works, which is all you should really expect when you have a physicist doing a programmer's job :) Second, I'm sure there are many ways to make this faster and more portable to other matrix configurations. For example, there are a lot of LATxSET and LATxCLR commands where there should probably be a LATxINV, but it made it more readable for me, so there you go.

I haven't put this into a nice #include file because its still a work in progress, and it would be nice to add the text functions as well. Since at the moment I'm working on something that won't use them I'm not going to bother till later, but I figured someone might get some use out of what I have so far.

The following line needs to be added to the ISRwrapper.S file:
ISR_wrapper 12,MyTmr3Interrupt
I found that sometimes my other programs don't compile with this in the wrapper file, but I think that's just because the compiler keeps looking for MyTmr3Interrupt... but who knows. See this post for more info: http://forum.pinguino.cc/showthread.php ... =interrupt

Getting the display time right seems to be a bit of a black art. I found using the max system freq with a peripheral divider of 2 (PBDIV2) and a period register of about PR3=0x0AFF to PR3=0x0DFF seems to work ok, but feel free to mess with this. I haven't tried doing much else besides plotting these few things up, so maybe those timer results will change when I've got the pic32 doing more complex stuff.

For some reason, I can't attach a pde file, so here it is in txt form. Just change the extension and you should be good to go!
(11.61 KiB) Downloaded 433 times

Posts: 15
Joined: Tue Nov 15, 2011 4:55 pm

Please be positive and constructive with your questions and comments.