Hello Steve,

It looks like the problem was not in the code itself oir not only in code. I do not know for sure where are my mistakes and where are software glitches. Some time ago I contacted Melabs support that my USB programmer programs something wrong and one of the ports I use do not work. (I programmed a batch of chips, soldered and sealed them and they all were bad. Same code programmed by ICD3 was good. I was advised to reset the programmer to factory defaults which I did and it helped. This time I am suffering from unstabile results and really started nervous because I could make a change in a good code, then reverce the change and the code no longer worked. Finally I read my just programmed MCU (programmed using Melabs USB programmer) then read it using Picstart plus and learnt that instead of INTOSCIO it was configured for external clock! (Although it was for sure IUNTOSCIO at the time of programming) Chnging the setting and rerecording the code back into the same MCU (now using Picstart plus) gave a working MCU. Resetting programmer into defaults fixed the problem, but I know for sure that it was in the defaults before. Also I have some screenshots where Melabs programmer says verification ok, then I read the MCU (with same Melabs programmer) and it is empty. Resetting to defaults (which was already reset some time ago change fixed the problem). I have a styrong feeling that I am not going to use that programmer any more as I do not want to reset it every time before programming...

Now I hope that if I change programmer (both hardware and software to Microchip ones) I will have to fight only my mistakes, and all glitches I had were related only to the programmer, not to compiler or assembler...

regards,

Alexey