Bert
As an aside to the problem, earlier on in the program we have:
Does this mean that using a WDT and a SLEEP command to save power are kind of mutually exclusive? The SLEEP command turns the PIC off (saving power) then the WDT turns the PIC back on again 4.6seconds later in our case? The above code would keep looping on and off until a button is pressed or the 3v cell goes flat?Code:Main: ' Read port to clear missmatch, if with no buttons pressed, then ' clear int-on-change flag & snooze until wake up on change. This ' conserves battery power on the demo board with 3V coin cell. IF GPIO.3= 1 AND GPIO.4= 1 THEN ' Nothing has happened so SLEEP E_OUT=0 ' Disable transmitter INTCON.0 = 0 ' No Inputs detected or it's still light so clear int on change flag @ SLEEP ' and start snoozin..zzzzzzzzzzz indefinatly @ NOP ' Do nothing for 1st instruction on wake-up ELSE 'IF GPIO.3=0 THEN GOSUB COUNTS 'Bird detected at box - GOTO LABEL COUNTS IF GPIO.4=0 THEN DARK 'It's got dark? or just cloudy - GOTO LABEL DARK ENDIF GOTO MAIN 'Back to sleep / continue counting
Dave




Bookmarks