Hi VG Nice one! The next instruction in 'NULL' program memory is prob filled with NOP, but it might be a XORLW ff or even remnant of the last program if it was longer. My asm files dont have a main and top of code has a jump back to somewhere. I have a suspicion that C code may run up memory doing NOPs until PC wrap around to 0. I guess my question should have been is there something put by the compiler= ? Say, a loop to self or some cunning plan or ascii text to say "Dont be stupid Mr. Programmer!" As I say, idle curiosity! Dave On 11 December 2011 21:50, V G wrote: > On Sun, Dec 11, 2011 at 4:43 PM, Dave Harris wrote: > >> Hi All. >> >> I know I should not let it happen, but I'm curious... >> In Hitech C code on a PIC (or others) what happens if main() exits? >> >> > To extend that question, what happens when your assembler program finishe= s > execution? What is the next instruction? > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .