cmcon0 = 0
cmcon0 = 0
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Error[113] c:\pbp\pbppic12.lib 423 : Symbol not previously defined (CMCON0). A have a whole bunch of these.
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
Last edited by Bruce; - 15th August 2011 at 00:12.
Switch works. Just not following the colors you have in each of the case statements. In order of presses in goes: Red, Green,Blue, Yellow for a split second, White, Cyan, Red, No White then cycles over again as it should.
We are getting closer though and very much appreciate this. This is my first project with any of PIC MCUs as well as my first with PICBASIC Pro.
My bad. Change the + to & in the color mix constants...;o)
YL CON GR & RD, etc,,
Bookmarks