Answers for C18 and CCS follows: First C18: ----------- Generated C18 code: 00000 EF27 GOTO 0x1784e 00002 F0BC NOP 00004 0012 RETURN 0 1784E EE1D LFSR 0x1, 0xd00 17850 F000 NOP 17852 EE2D LFSR 0x2, 0xd00 17854 F000 NOP 17856 6AF8 CLRF 0xff8, ACCESS 17858 9C01 BCF 0x1, 0x6, ACCESS 1785A ECE9 CALL 0x175d2, 0 1785C F0BA NOP (and the relevant section:) 1785E EC03 CALL 0x6, 0 17860 F000 NOP 17862 EC63 CALL 0x170c6, 0 17864 F0B8 NOP 17866 D7FB BRA 0x1785e --- C:\MCC18\v3_39\src\traditional\stdclib\__init.c =20 -------------------------------------------- 00006 0012 RETURN 0 So the answer for C18 is: The program calls the __init.c function (0x6), then calls the main=20 function (170c6). If it exits (returns), then the _init.c function gets=20 called again, then the main() function. On CCS: void main() ..................... { 0004: CLRF 04 0005: BCF 03.7 0006: MOVLW 1F 0007: ANDWF 03,F 0008: BSF 03.5 0009: BSF 1F.0 000A: BSF 1F.1 000B: BSF 1F.2 000C: BCF 1F.3 000D: MOVLW 07 000E: MOVWF 1C ..................... ..................... ..................... ..................... } 000F: SLEEP So the answer is for CCS, it calls SLEEP, with nothing after it.... =20 Which seems kinda dangerous to me since there is a chance that it could=20 wake from SLEEP. This has been verified with a PIC18 and a PIC16 target= .. Personally I'd much rather see a BRA 0x000F after that SLEEP call.... -forrest --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .