Great Testimonial Kurt!
Mind if I use it on my website?
<br>
Thanks Kurt!
Ioannis,
I've mentioned it a couple times here in the forum, but I just spent about an hour trying to find them, and failed.
I really should write some more pages for the website.
Anyone got a Cloning Machine? I need another Me.![]()
DT
Hay Darrel,
In the DT_INTS-14 (SPWM_INT - Multiple Software PWM) It says:
I do not know how to use arrays or how it can benefit in loops. The way I am doing it now is very cumbersome and code intensive. I have searched the forum and RTFM but I can't get my head around how this concept. Can anyone point me in the correct direction.Code:DutyVars VAR BYTE[3] ; DutyCycle Variables DutyVar1 VAR DutyVars[0] ; group them in an array for easy access DutyVar2 VAR DutyVars[1] ; with FOR loops etc. DutyVar3 VAR DutyVars[2]
Best Regards,
Kurt A. Kroh
KrohTech
“Goodbye and thanks for all the fish”
If you wanted to set all LED's to the same brightness, you could ...
<br>Code:LoopCount VAR BYTE FOR LoopCount = 0 to 15 ; 16 channels DutyVars(LoopCount) = 50 ; 50% (0-100) NEXT LoopCount
DT
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi Derrel,
Thanks for the code, Unfortunately I was hoping for something that would allow me to set different values to the duty cycle of each channel. The way I have it configured I use CH# as the var name:
and change the duty in this manor:Code:DEFINE SPWM_FREQ 100 ; SPWM Frequency DEFINE SPWM_RES 101 ; SPWM Resolution DutyVars VAR BYTE[16] ; DutyCycle Variables CH1 VAR DutyVars[0] ; group them in an array for easy access CH2 VAR DutyVars[1] ; with FOR loops etc. CH3 VAR DutyVars[2] CH4 VAR DutyVars[3] CH5 VAR DutyVars[4] CH6 VAR DutyVars[5] CH7 VAR DutyVars[6] CH8 VAR DutyVars[7] CH9 VAR DutyVars[8] CH10 VAR DutyVars[9] CH11 VAR DutyVars[10] CH12 VAR DutyVars[11] CH13 VAR DutyVars[12] CH14 VAR DutyVars[13] CH15 VAR DutyVars[14] CH16 VAR DutyVars[15]
and so on... If anyone can suggest a better method I would be very interested in learning better ways to program.Code:Main: gosub CKINPUT CH1 = 100 CH2 = 0 CH3 = 0 CH4 = 0 CH5 = 0 CH6 = 0 CH7 = 0 CH8 = 0 CH9 = 0 CH10 = 0 CH11 = 0 CH12 = 0 CH13 = 0 CH14 = 0 CH15 = 0 CH16 = 0 gosub CKINPUT PAUSE T5 CH1 = 100 CH2 = 100 CH3 = 0 CH4 = 0 CH5 = 0 CH6 = 0 CH7 = 0 CH8 = 0 CH9 = 0 CH10 = 0 CH11 = 0 CH12 = 0 CH13 = 0 CH14 = 0 CH15 = 0 CH16 = 0 gosub CKINPUT PAUSE T5
Best Regards,
Kurt A. Kroh
KrohTech
“Goodbye and thanks for all the fish”
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks