djulien wrote:Depending on how the code is written, I think you could get 10-bit or higher raw resolution as long as the next closest used dimming level is several steps below the previous one.
don
Restrictions may not be needed for 10-bit resolution. With 10-bit resolution the updates should occur 8us apart. With the PIC16F1824 clocked at 32 MHz (internal oscillator), the instruction period is 0.125uS. The sample below shows that the update can take about 24 instructions, or 3 uS. This is less than the 8 uS that I mentioned above, so no special precautions need be taken even when two dimming levels are only one step apart.
Int
BANKSEL PORTA
bcf PIR1,TMR1IF
swapf INDF0,w
addlw 0
btfsc STATUS,Z
goto end_of_update_table
movwf PORTC
moviw FSR0++
andlw 0x0F
addlw 0x01
movwf PORTA
bcf T1CON, T1ON ; disable timer while updating the two halves
moviw FSR0+
addwf TMR1L,f
moviw FSR0+
btfsc STATUS,C
addlw 1
addwf TMR1H,f
bsf T1CON,T1ON
retfie FAST
EDIT - there are a few instructions missing for copying FSR0L into the shadow register at the end of the ISR, but the main point here stands.
You are correct Phil, at least based on the MSIL. Vixen will send values 255 through 0 to a controller during a fade. To prove this create a sequence 256 cells wide and fade the whole range, switch to value mode (instead of % mode) and you will see all values from 255 down to 0. -- John
P. Short wrote:Dirk - there is a vixen setting that causes the intensities to be displayed (and entered) as integers between 0 and 255, rather than between 0 and 100. And I think (but am not sure) that when you specify a ramp, that the intermediate interpolated values are actually integers between 0 and 255.
Let me throw my two cents into this.
The Renard protocol as I understand it syncs the PIC controller to zero crossings once every 120 Hz. Divide that by the timer interrupt of roughly 30 uS yields 256 time slots within any one half of an AC cycle of 60 Hz. Thus for a byte value of 255 ($FF), the duty cycle of the 60HZ is 100%. With a value of 0 ($00), the duty cycle is 50%. In other words the byte sent for each channel determines the range of the duty cycle from 50% to 100% in 256 steps. This is the resolution of the PWM. Going to 10 bits or even 16 bits only increases the step resolution of the PWM. The problem as I see it the dimming of a LED is not a linear function, instead a square law function. The current through a diode is not linear from off to full on. It follows a square law or near square law path. Intensity is dependent on current through the diode and not so much voltage. If you want to get a linear dimming of a diode you do not change the RMS voltage across the diode linearly. Your voltage steps needs to be logarithmic function instead of linear. Resolution steps alone will not do it. Now a logarithmic curve can easliy be stored in a table and addressed in 256 steps/512 steps/etc. This takes ROM space depending on how many bits needed to best fit the curve.
Adding RGB blending throws in another can of worms. As I see it you need three curves. One for each color.
Let me propose this:
Much of the issues with processor power and bandwidth can be solved by implementing much of the work in hardware. I bring to this discussion 23 yrs of hardware design experience. Nearly all of the controller can be done in hardware. Event he state machine. Most can be done in a FPGA. The UART/ LUTs/ state machine and even the PWM. Costs will more than likely be slightly more than say a controller with four or less PICs. Then the heart of this thread was to propose a differnt approach. Especially for large Renard controllers. ie 48/64. In the Ren46 and Ren64 you need 6 and 8 PIC 16F688s. Well the cost of them alone equals that of a Xilinx XC3S50A in a 100 pin QFP. The FPGA could do at least a REN32 in one chip without the SSRs, Uart, PWM, state machine and decoding of the Renard Protocol. The UART would easily be capable of 1 megabit per second speed. The state machine can be PicoBlaze. Runs at 75 MHz and takes two cycles to do a function. The PWM is nothing more than a free running counter synced to the zero crossing pulse along with a register and a comparator and a RS FF. Internally the Spartan 3A has 8 clock buses. So generating different clocks from one clock is not a problem. External to the FPGA would be just the zero crossing, the RS485/RS232 level shifters, IO buffer and level shifters and configuration PROM.
I have started looking into a feasibility study of such a project. Not sure how much cost increase it would take from say a Ren64 XCI know that it would take a 144 pin QFP for the FPGA. A 100 pin QFP will not have enough outputs. The real disadvantage of this direction is that all the components are surface mounted. That in itself will be a barrier for most DIYers. Soldering SMDs are not for the faint at heart. While I may be new to this group I would not be offended if few if any were interested in it. I too like the original poster was considering a way to reduce the number of 16F688s used on the Ren64XC. Also in possibly reducing the size of the board. I have already done a four channel SSR board that is all surface mounted parts. IT is limited primarily to switching and dimming LED strings. You can get two maybe three lamp strings max per channel. LED strings upwards to ten. The current through the SMD Triacs would be limited to around 400 to 500mA.
One other beauty of the FPGA is that both the Renard and DMX protocol decoding can very well be implemented within the fabric of the FPGA. Thus a jumper can be moved to do either protocol without having to reload software. That alone may very well be a bonus feature.
Oh well just my thoughts and two cents worth.
have a Happy New Year
james
It's been quite a few years since I've done any FPGA design, so I'm not sure where things are now. At the time that I started the Renard project I had an Xilinx XC2S project with an Ethernet MAC designed in, and it would have been a trivial task to add dimming to the design. Even at that time the only reasonably modern FPGAs had a .65 or .50 mm pitch (i.e. .026" or .020"), which are fairly difficult to deal with on a DIY basis for almost everyone. They required multiple power supplies (3.3V and 2.5V at the time). At that time the 5V or 5V-tolerant parts were no longer being manufactured, so the design would have needed off-chip buffers to generate 5V signals for other parts on the board. In addition, the need for clean power and ground requires very careful routing of those signals, usually with a ground plane, and careful placement of bypass caps.
I was able to deal with these issues, but everything adds up and that would be an order of magnitude more difficult for the DIY'r to deal with than a through-hole design or a course-pitch SMT design. The only alternative that I see would be use an FPGA development board, which at the time would have resulted in a far more expensive solution than a typical uP approach using a dual-inline package. As I see it, the FPGA approach would be quite feasible if you are planning on manufacturing and selling the boards, not so much so for the case where a DIY'r assembles the boards.
And this ignores the design issues - a lot fewer people have the skills for design an FPGA solution. The techniques are not known to as many people, nor are VHDL/Verilog language skills.
P. Short wrote:It's been quite a few years since I've done any FPGA design, so I'm not sure where things are now. At the time that I started the Renard project I had an Xilinx XC2S project with an Ethernet MAC designed in, and it would have been a trivial task to add dimming to the design. Even at that time the only reasonably modern FPGAs had a .65 or .50 mm pitch (i.e. .026" or .020"), which are fairly difficult to deal with on a DIY basis for almost everyone. They required multiple power supplies (3.3V and 2.5V at the time). At that time the 5V or 5V-tolerant parts were no longer being manufactured, so the design would have needed off-chip buffers to generate 5V signals for other parts on the board. In addition, the need for clean power and ground requires very careful routing of those signals, usually with a ground plane, and careful placement of bypass caps.I was able to deal with these issues, but everything adds up and that would be an order of magnitude more difficult for the DIY'r to deal with than a through-hole design or a course-pitch SMT design. The only alternative that I see would be use an FPGA development board, which at the time would have resulted in a far more expensive solution than a typical uP approach using a dual-inline package. As I see it, the FPGA approach would be quite feasible if you are planning on manufacturing and selling the boards, not so much so for the case where a DIY'r assembles the boards.
And this ignores the design issues - a lot fewer people have the skills for design an FPGA solution. The techniques are not known to as many people, nor are VHDL/Verilog language skills.
I agree with you 100%
Again I reiterate, an FPGA project is not for everyone. In fact I would suspect that few would even begin to take on such a venture. I have 23 years experience working with SMD technology and even with soldering BGAs. So that part does not scare me. I am proficient with PCB layout. I through this part of the thread out to really see what kind of response it will get.
The advancement of FPGAs and the shrink of silicon today makes them an interesting possibility. The fabrication of the silicon today has now passed 45nM technology. FPGAs today have hardware multipliers, a lot more ram and even DSP blocks. They are faster now and cost has come way down on the medium to low density parts. A Spartan 3A with the equivalent of 200,000 gates in a 100 pin QFP is under $15. Ten years ago that functionality would have cost closer to $1000 per unit. Besides there are a lot of open source cores that are available for communications, soft processors and the likes available today. Several have done AVR cores as well as some PIC CPU cores are available. WIth the base CPU guts that is software compatible you can design roll your own AVR or PIC with just the peripherals you want.
Higher density FPGAs are definitely out of the reach of DIYers. Fine Pitch BGA packages require 8 layer PCBs minimum. That alone is out of the range of low cost small lot fabrication in itself. Most of the PCB houses for DIY users are two layer and four layer and 6 mil trace/spacing is the smallest. Fine Pitch BGAs will require 4 or even 3 mill width/spacing. That drives laminate costs way up.
As for Verilog, if you can program in C, you can pick up Verilog rather easy. IF you happen to be familiar with ADA and to some extent Pascal, then VHDL is easy to pickup. Some of the constructs of VHDL is similar to ADA and Pascal.
You don't have to worry if my ideas are shot down. I learned a long time ago never to fall so in love with your own designs as somebody may do it better, faster or cheaper than you. As the quote from one of the members of this forum has by Edison. I have not failed 10,000 times, I have found 10,000 ways it does not work. That is engineering
just my thoughts
james
