Code posted below. I dont get whats going on now. When i power the circuit on, it blinks red, pauses, then blinks green, pauses and goes back to red. I am not pressing the switch at all. And i turned off MCLRE in the INC file like you suggested. I see nothing in the code saying to blink. When i press the button, it stops doing everything until i power cycle the circuit.
Code:
OPTION_REG.5 = 0
Red var GPIO.0
Green var GPIO.1
Blue var GPIO.2
SwitchPin var GPIO.3
ButtonCount VAR BYTE
ButtonCount = 1
HIGH Red
HIGH Green
HIGH Blue
MAIN:
IF SwitchPin = 1 THEN
If ButtonCount = 1 THEN
PWM Red,127,100
ENDIF
If ButtonCount = 2 THEN
PWM Green,127,100
ENDIF
If ButtonCount = 3 THEN
PWM Blue,127,100
ENDIF
If ButtonCount = 4 THEN
ButtonCount = 1
else
ButtonCount = ButtonCount + 1
endif
endif
GOTO MAIN
Bookmarks