I don't know why it wouldn't, except maybe for the PAUSEs.
The last code posted would take over 42 minutes to dim from 1023 to 0 with the included pauses.
Can you post your code again the way it is now?
 
 
		I don't know why it wouldn't, except maybe for the PAUSEs.
The last code posted would take over 42 minutes to dim from 1023 to 0 with the included pauses.
Can you post your code again the way it is now?
DT
 
 
		BVar = 1023
blue:
shiftout d2pin, c2pin,1 [funct\1,Rvar\10,Gvar\10,Bvar\10]
gosub latch
gosub BringUpPWM
pause 100
Bvar = Bvar - 2
if bvar < 3 then goto end
gosub blue
end
I was expecting gradual dimming of the LED, but it pulsates and intensity seems the same.
 
 
		END is a reserved word and can't be used as a label.
The blue loop is GOSUBing back to itself. It should be GOTO.
And, it needs to turn off the CCP module before shifting any data.
Make sure the PAUSE 500 is NOT in the latching: subroutine anymore.
Code:BVar = 1023 blue: CCP1CON = 0 shiftout d2pin, c2pin,1 [funct\1,Rvar\10,Gvar\10,Bvar\10] gosub latch gosub BringUpPWM pause 100 Bvar = Bvar - 2 if bvar < 3 then goto BlueDone GOTO blue BlueDone:
DT
 
 
		Ok, I'll try the code tomorrow morning as it is too late now. Hope it works, thanks and I'll let you know the result by tomorrow. Thanks
 
 
		BINGO! Darrel, you're the best! Thank you again for the code, now I can dim the LED. Now, the only think in my concern is that when I control too many clusters, the PIC might not be able to store that much of data isn't it? Do you have any recommendation? Hehehe, sorry if I ask too much but really appreciate your help. God bless. Thanks again.
 
 
		Awesome!
Not bad for someone that's never seen that chip before. eh
Well, as far as the memory requirements go. At 6 bytes per cluster (PWM only), you can run an awful lot of clusters with just about any chip. But if it gets to be too many, just throw on a serial FRAM, and you could light up several hundred or thousand clusters, easily.
Well, assuming you had that may pins on your PIC.
Since each cluster needs it's own Latch line, it's kind of limiting.
Of course you could always run the devices in series with a common latch, or add some shift registers to increase the Latch count, but now I'm getting into a whole different area.
DT
 Help
 Help
		Dear Darrel, I still need some help here. Can you kindly give me your email address? I need to send some attachment to you. Thanks & have a great weekend.
Warmest Regards,
Kevin Loh
Bookmarks