I am trying, so far in vain, to write some code for a 12C509 device which has to do the following (shown in pseudo C code): Power on Device Reset; main{ TRISB(0b11111100); CLEAR GPWU; CLEAR GPPU; switch (RESET_CAUSE()) { case NORMAL_POWER_UP: GP0=0, GP1-1; case MCLR_FROM_SLEEP: GP0=1, GP1-0; case default: error_handle(); } for(;;){ if (INPUT(GP3) is TRUE){ READ PORT_B; // 12C509 note, page 35 SLEEP(); } } Although the example is not complete the basic code outline should work, I think ???... CCS Version 2.464 operating under MPLAB V4.00... Any suggestions appreciated... Nino... -- ****************************************************** * Antonio (Nino) Benci * * Electronic Services Manager * * Monash University - Dept of Physics * * Wellington Rd, Clayton. 3168 * * Victoria, Australia. * * TEL - 61 3 9905 3649, FAX - 61 3 9905 3637 * * Mobile - 0414 764 763 (private and ah only) * * EMAIL - nino.benci@sci.monash.edu.au (work) * * - fleatech@excite.com (private) * * WWW - www.physics.monash.edu.au/ * ******************************************************