No need to clear the shadow variable when you're shifting 8 new bits into it each interrupt, yes, no?
No need to clear the shadow variable when you're shifting 8 new bits into it each interrupt, yes, no?
Last edited by Mike, K8LH; 25th March 2009 at 04:50 PM.
Hi Mike I studied your program its very clever.I have a problem.I'm using 4Mhz not 8Mhz.
I adjusted your program Is this settings ok?
XT = 4Mhz
Interrupts = 100uS
Levels = 100
Frame Rate = 10000uS = 10mS
PWM Frequency = 100Mhz
Whats the advantage using higher PWM frequency Mike? Is 60 PWM frequency do you recommend?
Hi Suraj,
Those settings look fine and a 100 Hz refresh rate should be fine.
The only advantage for using a higher refresh rate is that you would be able to update the LED array at shorter intervals. You can update the array at 5 msec intervals with the 200 Hz rate or update the array at 10 msec intervals with the 100 Hz rate.
Did you test your modified program?
Mike
Last edited by Mike, K8LH; 26th March 2009 at 03:50 AM.
Hi Mike, K8LH I've completed the code now I have to make it & see.I'll tell you the progress.
When I extend the pwm levels like (200 levels) the PWM frequency drops down like 50Hz.Is this good?Will it get unsmoother?
Last edited by Suraj143; 26th March 2009 at 03:55 AM.
Hi Mike, K8LH last night I checked on a real hardware your code worked perfectly.You need to uncomment that (xorlw 0ffh) after that it worked.I'm really really happy now.Thanks again for the support.
Can I use the maximum brightness value 100 instead of 99?
Now everything is ok reloading the LED variables I'm doing with a lengthy way.I like to use your method using a macro.
Can I use "Setled 00,00,99,66,20,12,04,01" to load the brightnesses?Or do I have to write a macro to load them?(I never used macros)
Hi Suraj,
Happy to hear your software/hardware is working.
Yes, you can use pwm values of 100.
You need to create a macro for that "Setled 00,00,99,66,20,12,04,01" functionality. The macro needs to be placed ahead of the code that uses it within the source file. Many people place it ahead of the code section.
Code:setled macro p0,p1,p2,p3,p4,p5,p6,p7 movlw p0 ; pwm value 0..99 movwf led+0 ; led[0] = p0 movlw p1 ; pwm value 0..99 movwf led+1 ; led[1] = p1 movlw p2 ; pwm value 0..99 movwf led+2 ; led[2] = p2 movlw p3 ; pwm value 0..99 movwf led+3 ; led[3] = p3 movlw p4 ; pwm value 0..99 movwf led+4 ; led[4] = p4 movlw p5 ; pwm value 0..99 movwf led+5 ; led[5] = p5 movlw p6 ; pwm value 0..99 movwf led+6 ; led[6] = p6 movlw p7 ; pwm value 0..99 movwf led+7 ; led[7] = p7 endm
Last edited by Mike, K8LH; 27th March 2009 at 10:23 AM.