That's an easy way to check if the value is 0. It means if switch is not 1.....
Alternately, if switch means if switch =1 then. ....
That's an easy way to check if the value is 0. It means if switch is not 1.....
Alternately, if switch means if switch =1 then. ....
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Well guys, things are working great so i more than thank you all for your wonderful help. This has been an experience for me and will continue to be as I convert all the code for this 10f202 to a 16f684. I wanted the EEPROM to store the state of the color after every change of color (after 10 seconds of on the same color so as to prevent excessive writes), so when the circuit comes back on again, it will grab the value from EEPROM. I also wanted the hardware PWM to control the LED color.
I think for the most part i have been able to successfully port it, except that the SwitchPin does not work properly on the 16F684. My code is below:
I hope its something simple like my TRIS or PORT registers. Thanks much.Code:SwitchPin var PORTA.2 ' Active low RD CON %00010010 ' red GR CON %00110000 ' green BL CON %00100010 ' 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 ButtonCount = 0 PORTC = %00111010 ' LEDs off TRISC = %00000010 ' PC2: Input, other pin: Output MAIN: IF !SwitchPin THEN WHILE !SwitchPin pAUSE 200 wend ButtonCount = ButtonCount + 1 SELECT CASE ButtonCount CASE 1 PORTC = RD CASE 2 PORTC = GR CASE 3 PORTC = BL CASE 4 PORTC = YL case 5 PORTC = CY case 6 PORTC = PR case 7 PORTC = WT case IS > 7 PORTC = OF ButtonCount = 0 END SELECT ENDIF GOTO MAIN END
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks