The 10F202 doesn't have a CMCON0 register so leave that out.
See if this works;
The PWM command returns the output pin to an input after it finishes so that might be causing some funkiness. Try just placing color values on the port and see if this helps.Code:@ __config _WDT_OFF & _MCLRE_OFF & _CP_OFF Red var GPIO.0 Green var GPIO.1 Blue var GPIO.2 SwitchPin var GPIO.3 ' Active low RD CON %11111110 ' red GR CON %11111101 ' green BL CON %11111011 ' blue YL CON GR & RD ' green + red = yellow CY CON GR & BL ' green + blue = cyan PR CON BL & RD ' blue + red = purple WT CON GR & BL & RD ' green + blue + red = white OF con %11111111 ' all LEDs off ButtonCount VAR BYTE OPTION_REG = %00000000 ' GPIO.2 for GP use TRISIO = %00001000 ' GP3: Input, other pin: Output GPIO = %00000111 ' LEDs off ButtonCount = 0 MAIN: IF !SwitchPin THEN ' Switch down? WHILE !SwitchPin : wend ' - Spin 'till button is released PAUSE 50 ' - arbitrary debouince delay ButtonCount = ButtonCount + 1 SELECT CASE ButtonCount CASE 1 GPIO = RD CASE 2 GPIO = GR CASE 3 GPIO = BL CASE 4 GPIO = YL case 5 GPIO = CY case 6 GPIO = PR case 7 GPIO = WT case IS > 7 GPIO = OF ButtonCount = 0 END SELECT ENDIF GOTO MAIN END




Bookmarks