Hi Languer- Thanks for trying, but no cigar! Adding the line you suggested resulted in a syntax error, so I added INTCON.0 = 0 instead (To clear GPIF). I get the same result. Strange.
Hi Languer- Thanks for trying, but no cigar! Adding the line you suggested resulted in a syntax error, so I added INTCON.0 = 0 instead (To clear GPIF). I get the same result. Strange.
Place GOTO Main after your last PAUSE 1000. You should see a quick 100mS pulse on the
LED after the 1st wake-up, and a 2 second LED on time after the 2nd wake-up.
Using the internal oscillator you might also want to include DEFINE OSCCAL_1K 1 to make
sure it's calibrated.
Sorry Bruce, I made both changes, and the results are the same. I get one long pulse on the LED, LED goes off until button is pressed, then short pulse and then off again. Next press of button does nothing.
Strange. This works precisely as expected. No matter how many times I press/release the
switch.
10K pull-down to ground on GPIO.2 with switch pulling it to Vcc on press.Code:@ DEVICE MCLR_OFF, INTRC_OSC_NOCLKOUT, WDT_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF DEFINE OSCCAL_1K 1 CMCON = 7 TRISIO = %001100 OPTION_REG = %01000000 GPIO = 0 T1CON = 0 'GPIO.0 = 'GPIO.1 = LED HIGH OUT 'GPIO.2 = SWITCH HIGH INPUT 'GPIO.3 = MCLR TIED HIGH 'GPIO.4 = 'GPIO.5 = Main: HIGH GPIO.1 PAUSE 1000 LOW GPIO.1 INTCON.1 = 0 INTCON.4 = 1 FLAGS = 0 @ SLEEP @ NOP INTCON.1 = 0 HIGH GPIO.1 PAUSE 100 LOW GPIO.1 INTCON.1 = 0 INTCON.4 = 1 FLAGS = 0 @ SLEEP @ NOP HIGH GPIO.1 PAUSE 1000 GOTO Main END
Strange indeed. I programmed my part with your program using cut & paste, and my results are the same as they were, no second operation! It must be some sort of hardware anomaly. I will chase it with my scope later.
Bookmarks