Because of a few things I've found out since I got the pic32, I've decided to write the TLC control software from scratch, instead of trying to port the program I've already got straight in.
Now when I say "write it from scratch," I do mean of course copy it from other code I found
When I say "I found," I mean someone else found and told me about it, lol, thanks very much Jason!
Jason pointed me to this document
This document has been really great, if only it was around a year ago. I hope the guy puts some contact details so I can thank him. Also i'd like to ask him about licensing, since the BSD style license requires I leave his header on the file which pretty much attributes the software to him, but I didn't really even start with his file so i'm not really sure what happens now. I admit I've pretty much copied the process flow which he describes but the vast majority my code is different, so i'm not sure what that means. He uses the document to SHOW you how to get the code out of the process flow of the TLC so that's what I've done. I can understand if this was like a big program with lots of custom functions, but if I was to start from scratch now and write the program myself, i mean it's still a TLC chip so there's really only a couple of logical ways to implement control. If you got a few people to do this exercise, no doubt most would result in something pretty similar to the code in the document. At this step right now I probably wouldn't have a problem putting the author's name on it since this document has definitely helped me, but later as I build on it and I've added to it and copied some of my old code over, it won't make sense to keep attributing the original author,
Anyway, what he's got is for an AVR micro, so it has still taken considerable work to rejig it for PIC. So i'm just going to share my code. I'm not into "licenses" or anything yet so anyone can use this code for anything, i don't really care. If you do use it and find it useful it would be really nice if you could let me know, that's all.
This is really just "test" code. it isn't useful in it's current state as anything except to test that you have everything configured and plugged in correctly. If you are doing anything with the TLC I recommend you read the above document.
This is the end result of the code
Now I'm working on getting timers and interrupts configured. I'm actually finding it a bit confusing since there is a lot of compiler specific things going on which I have no idea about. For example, in the PIC32 reference manual for timers, they have an example of an ISR (interrupt service routine). Now NOT only is the document LOCKED so you can't even copy and paste, but they use a FONT where 0 and 0 and 1 (one) and l (lower case L) look almost identical! Now in a blog post you can probably guess the context and if you guess wrong, who cares, but in code, that you can't even copy and paste, it makes a BIG difference!!
Not only that! But even after working this out I still couldn't get the blasted code to work. It wasn't until I came across other code in another example that I got it to work. If you have this problem, look for a document called:
The problem was somewhere in the interrupt configuration, I haven't worked out exactly where yet because the 2 examples use different approaches in their configuration. This document has actually been a big help. It's supposed to be in the MPLAB docs directory but I have 2 MPLAB installs, one from pickit2 and one from pic32 starter kit and I do not have that document, it's not even on the microchip site from what I've found, I found it somewhere else. Anyway, it's good! And the code examples there actually worked for me!
Anyway, i'll post some more when i have the TLC working with my ISR code.
Also I don't think you can directly upload to blogger so i'll put the code up on my google site and link it here a bit later.