Go Down

Topic: ShiftPWM support topic. Latest update: Schematics, high power LED's, LED strips (Read 83 times) previous topic - next topic


There are more issues with using a 1280. Because the memory is 16 bit wide, extra instructions are added. I can only look at the assembly now, but I'll try to get my hands on a 1280.

Hum, I think you have a misconception about the 1280 Vs 328 chips. Both have the same number of instructions, same memory widths. 1280 just has more memory size in length, not width for flash, sram, eeprom, more I/O pins, more timers, more serial ports, etc. But both use the same AVR 8 bit instruction set.


You are right. The addresses can be 16 bit, because the memory is longer. I was confusing the data and the addresses.


Hi Hernandi, I don't  understand. the result of xor get false with RGB == PWM, other is true.

00001000 rgb
01000000 pwm
01001000 result rgb < pwm

01000000 pwm
00000000 result rgb == pwm

01100000 rgb
01000000 pwm
00100000 result rgb > pwm


I got it working with SPI today and got it twice as fast.
I will do some more testing en code cleanup before I upload it here.

I took steene's advice and used rotation over carry (ror) to calculate the output byte in 32 cycles (4 per pin).

Adding a shift register now costs 43 interrupt clock cycles, which is about 5.4 clock cycles per pin   8)


Thanks for all your input. You can check out the new version at www.elcojacobs.com/shiftpwm.

You can still ask support questions in this thread though.


Jul 25, 2011, 08:01 pm Last Edit: Jul 27, 2011, 01:19 am by salsaman Reason: 1
This is fantastic-- thank you Elco!

I spent a while yesterday trying to interface with a PCA9685 to get reliable PWM output and was getting nowhere, but your library is just what I need!  It's also easier to manage 8-channel output boards for my project since I need 24 channels and want to use pretty big MOSFETs.

I wonder: is there a magic multiplier (or divisor) for the PWM frequency?  I'd like to go faster than 75Hz to avoid artifacting when in motion, but tried 150Hz in the test sketch and had odd flickering, not fading.
My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

Go Up