Once again I am at my wits end and need some help.
I'm trying to set up a PIC10F222 so that it will sleep and then wake up on a pin change at GPIO.3 or at GPIO.0. The datasheet says that wake-ups are possible using these two pins as well as GPIO.1. I have both GP3 and GP0 on pull-up resistors, and I bring the pins low to effect the wake-up. I can get the PIC to wake-up on with a change on GP3, but not on GP0. I have set these pins as input and I have the processor read them before going to sleep. I also have the WDT off and MCLR off (set in the INC file, not in the code). Here is the code I'm working with. Again, a low signal on GP3 (aliased as INT in the code below) wakes the PIC, but a low signal on GP0 (aliased as SDA) does nothing. Can anyone see what I have overlooked?
Code:'Alias pins INT VAR GPIO.3 'interupt (wake-up) pin (pin 6, input only) SDA VAR GPIO.0 'I2C DATA PIN (pin 1), SCL VAR GPIO.2 'I2C CLOCK PIN (pin 4) LIGHT Var GPIO.1 'INPUT FROM LIGHT SENSOR (pin 3) 'SET UP VARIABLES W0 VAR word 'GENERAL USE B0 VAR BYTE 'GENERAL USE B1 vAR BYTE 'GENERAL USE CNT VAR BYTE 'USED FOR COUNTING minutes (4 bits plus one other bit) 'set initial CNT and W0 CNT = 0 w0 = 32768 '%1000000000000000 'SETS FLAG TO 1 AND REST ZERO PAUSE 10000 logdata: 'Set up for sleep immediately OPTION_REG = %10010000 'SET OPTION REGISTER FOR WAKE ON CHANGE TRISIO = $00001001 'wake ups on GP3 and GP0 B0 = GPIO 'read pins to establish change state. @SLEEP 'Zzzzzzzzzzzzzzzzz 'Pic will sleep until an interrupt from the clock or I2C bus 'Data interface signal from 2nd PIC will pull both SDA and SCL low IF sDA = 0 tHEN 'if the data collector is plugged in then iF SCL = 0 THEN CNT = 0 'reset count TRISIO = $00001111 'all inputs, relinquish I2C bus REPEAT 'wait until data collection is done PAUSE 100 uNTIL LIGHT = 1 'light signal restarts logging cnT = 0 'reset count GOTO logdata eNDIF eNDIF




Bookmarks