simple little xmas lights project which i posted several weeks ago... RGB LEDs ramping up and down with software PWM...
The same program compiled for the 18F4550 works correctly, however, when compiled for the 16F610 as soon as PORTC.1 goes high it makes PORTC.0 low even though i've set it high...
For the fun of it, i've included the source code below... Can anyone see any problems with it? Have i missed something?
Thanks
Code:Define OSC 8 ' Set clock speed TRISA = %00000000 PORTA = %00000000 TRISC = %00000000 PORTC = %00000000 RED VAR PORTC.0 GREEN VAR PORTC.1 BLUE VAR PORTC.2 REDSCALE VAR WORD GREENSCALE VAR WORD BLUESCALE VAR WORD Aloop VAR byte Bloop VAR BYTE DUTY var BYTE clear REDSCALE = 1 BLUESCALE = 1 GREENSCALE = 1 DUTY = 100 gosub powerupred MAIN: gosub powerupgreen gosub powerdownred gosub powerupblue gosub powerdowngreen gosub powerupred gosub powerdownblue GOTO MAIN POWERUPRED: for Aloop = 1 to DUTY FOR Bloop = 1 to REDSCALE HIGH RED pause Aloop LOW RED pause (duty-Aloop) NEXT Bloop NEXT Aloop HIGH RED return POWERDOWNRED: for Aloop = 1 to duty FOR Bloop = 1 to REDSCALE HIGH RED pause (duty-Aloop) LOW RED pause Aloop NEXT Bloop NEXT Aloop return POWERUPGREEN: for Aloop = 1 to duty FOR Bloop = 1 to GREENSCALE HIGH GREEN pause Aloop LOW GREEN pause (duty-Aloop) NEXT Bloop NEXT Aloop HIGH GREEN return POWERDOWNGREEN: for Aloop = 1 to duty FOR Bloop = 1 to GREENSCALE HIGH GREEN pause (duty-Aloop) LOW GREEN pause Aloop NEXT Bloop NEXT Aloop return POWERUPBLUE: for Aloop = 1 to duty FOR Bloop = 1 to BLUESCALE HIGH BLUE pause Aloop LOW BLUE pause (duty-Aloop) NEXT Bloop NEXT Aloop HIGH BLUE return POWERDOWNBLUE: for Aloop = 1 to duty FOR Bloop = 1 to BLUESCALE HIGH BLUE pause (duty-Aloop) LOW BLUE pause Aloop NEXT Bloop NEXT Aloop return




Bookmarks