chelmuth wrote:That would require a re-write of the code that I'm not quite up to that skill level yet. It needs to have some sort of software PWM implemented and I have yet to find a good example that I've been able to hack apart and put into that and I'm not completely comfortable with the interrupt routines which would be required. Which is why i was hoping someone with a little more coding experience could help with. I was just laying the ground work and idea for innexpensive tubes. Currently they should be less than 10$ per tube.. yes they require some work but that's the fun part.
Corey:
I understand your motivation for the tubes -- I agree; it's an element I'd be interesting in adding to my show if it only cost about $10 per tube and I could control each tube individually. I don't mind the hand-work ... I hand-wired more than 3000 individual LEDs last year 😉 ...
The one thing I don't understand is why you decided to write this in assembly ... if it were in C, you'd have folks falling all over themselves to help you. But hardly anyone here writes in assy ...
My guess is that you're seeking to improve your skills, which is cool, but I just don't think there are many here who can help you ...
Maybe you could restart the project in C, get it working and then port it to assy?
\dmc
LOL. I've never written anything in C before. so I wouldn't really know where to begin. but with that said I had never written anything in assembly before this either.. I think from the .ASM file someone could identify with what I did and port it to C. I commented it pretty well and like I mentioned earlier the LEDs fire in the order they are wired. I'm sure someone with more experience in C could whip it out in about 10 minutes. It's not really that complicated of a program. And if not I might get around to trying to port it myself eventually..
You can try Great Cow Basic also - it's free and is made for the PIC and can be more readable/easier to follow than C code. Then again - if you're happy with what you have - then that's good enough really!
It might be possible to write it in C if you don't need the dimming (e.g. tails). I don't think that it would be possible to do that if you want dimming ... remember, the processor is only 2 MIPs without an external crystal. I haven't assimilated Cory's firmware yet, so I'm not sure how hard it would be (or if it is even possible) to do dimming even in assembly language without bumping the clock rate. Since I have in mind driving 7 LEDs at once, I may be making it more difficult than it really is, though.
The PIC16F506 might be an alternative to the PIC16F688. It is a lower cost part, and you give up the UART, the EEPROM, two timers and some instructions, but it can source/sink more current than the PIC16F688. It also has less memory (instruction and RAM), which may not matter in this application.
I've been playing around with some PIC16F506 code to try and get some dimming capability. What I've come up with is something that will drive 8 outputs at a time (seven anodes and one common cathode), for a total of 56 LEDs, refreshing to 32 levels of dimming at about 110Hz. Internally the code has 56 locations that each holds the dimming level for one LED, which can be independently set in some 'background' code. The code is completely based around a couple of loops, without any use of timers or interrupts.
Unfortunately, the algorithmic nature of my coding led to a somewhat different mapping between the pins and the LEDs from what chelmuth has done, as follows:
;; Hardware mapping (somewhat similar to Renard)
;;
;; Output 1 = Pin 3 (RA4)
;; Output 2 = Pin 13 (RA0)
;; Output 3 = Pin 12 (RA1)
;; Output 4 = Pin 11 (RA2)
;; Output 5 = Pin 10 (RC0)
;; Output 6 = Pin 9 (RC1)
;; Output 7 = Pin 8 (RC2)
;; Output 8 = Pin 7 (RC3)
;; LEDs are assumed to be connected as follows:
;; Top seven LEDs
;; Cathodes (all seven) - output 1
;; Anodes (top to bottom) outputs 2,3,4,5,6,7,8
;; Next seven LEDs (from top) (set 2)
;; Cathodes (all seven) - output 2
;; Anodes (top to bottom) outputs 1,3,4,5,6,7,8
;; Next seven LEDs (from top) (set 3)
;; Cathodes (all seven) - output 3
;; Anodes (top to bottom) outputs 1,2,4,5,6,7,8
;; Next seven LEDs (from top) (set 4)
;; Cathodes (all seven) - output 4
;; Anodes (top to bottom) outputs 1,2,3,5,6,7,8
;; Next seven LEDs (from top) (set 5)
;; Cathodes (all seven) - output 5
;; Anodes (top to bottom) outputs 1,2,3,4,6,7,8
;; Next seven LEDs (from top) (set 6)
;; Cathodes (all seven) - output 6
;; Anodes (top to bottom) outputs 1,2,3,4,5,7,8
;; Next seven LEDs (from top) (set 7)
;; Cathodes (all seven) - output 7
;; Anodes (top to bottom) outputs 1,2,3,4,5,6,8
;; Last seven LEDs (from top) (set 8)
;; Cathodes (all seven) - output 8
;; Anodes (top to bottom) outputs 1,2,3,4,5,6,7
One potential advantage of this mapping is that it would be easy (easier???) to divide the 56 LEDs up into smaller 7- or 14-LED strips if you don't want to have one long 56-LED strip.
At the moment the code is untested, since I don't have the hardware for testing it (nor the intention of building it at the moment). However, I think that it would only take me a day or so to bring it up if I had hardware.
Further note - since this firmware drives seven LED cathodes from one output pin at a time, it needs to have booster transistors added outside the PIC similar to what someone else (djulien) has done.
Further note - I wonder if this largely duplicates his work.
