Lembit, Sorry if I was too harsh, I did not meant to be. It is no problem if you do not know what to look at in the map file, if you ask people here they help -- that's why is this mailing list for. I think it worth to read through the reset section of the datasheet. All PIC uses the 0 address as reset address (well, as far as I concern the real reset address is 0xFFFF, however, it is a special area for storing oscal values and it happens that the PC overflows to 0x0000, but I am not entirely sure ablut this detail). Anyway, you have to put the reset (startup) code into 0x0000. There is another special code area, the interrupt vector, which is at 0x0004 in older PICs, and there are two level of interrupts on 0x08 and 0x18 addresses -- all documented in the datasheet as well. That's why normally all codes goes after the address 0x2C You can check all default register settings on different conditions -- like on all reset situations the PCL, PCLATH and PCLATU are at 0x0000, so that's how you could think that the reset address (the real PC) is 0. Normally if you deal with different reset situations you have to check those registers to figure out what happened (in detail described in the datasheet). So you can check whenever the reset is due to your device switched on (Power On Reset), somebody pressed the reset button (MCLR) or a watchdog timer out happened (WDT). There are some more of course. The same is with interrupts, if you later on deal with interrupts as well. Your best friend is the datasheet, the second one is this list :-) I hope now it works fine! Regards, Tamas On 11/09/06, Lembit Soobik wrote: > > First of all, let me thank you all sincerely for the help. > Now, not as excuse, but to explain that I did not ignore the advices: > > - I did NOT know beforehand that the STARTUP MUST be on 0000. I have > learned > this now and also I understand now WHY it has to be so. > > not knowing that (probably it is somewhere in the manuals - sorry), I > interpreted Tamas' msg > -------------------- > "I am not sure what kind of linker script you have, but I had a problem > with > having the STARTUP code in the 0x0000 address. I had to say: > > STARTUP CODE 0x0000 > > to do the trick. Could you check in the MAP file that the STARTUP is at > the > address 0x0000?" > -------------------- > wrongly as "I don't know where your linker script puts the STARTUP, so I > tried 0000" > > > and on a side note, I am a bit surprised that Microchip publishes the > PICDEM > 2 PLUS demo program with the STARUP without 0000. but then the positive > side > is that I did not just learn "how", but more important "why". > > - And I did check the MAP file, but again, I did not know to look for the > STARTUP had to be on 0000. > > Only after I opened the Program Memory window and stepped through that, I > saw what happened. > > so please forgive an old man :) > > Lembit > > ----- Original Message ----- > From: "Tamas Rudnai" > To: "Microcontroller discussion list - Public." > Sent: Sunday, September 10, 2006 11:07 PM > Subject: Re: [PIC] defining data in Program Memory > > > > Jan-Erik, > > > > It was you who first mentioned to check the MAP file if I remember well. > > Then yesterday I have mentioned exactly what to do but the OP did not > read > > the reply carefully (if did at all). I would not mind to tell the same > > twice, but Lembit, next time please read what others reply -- if you do > > not > > understand what they are talk about just yell, and I am sure you will > get > > a > > better explanation. > > > > Tamas > > > > > > > > > > On 10/09/06, Jan-Erik Soderholm wrote: > >> > >> Now, you have not been reading the replies in this thread. > >> > >> Someone else told you to add address '0000' to your > >> STARTUP CODE directive several days ago. > >> > >> Best Regards, > >> Jan-Erik. > >> > >> > >> Lembit Soobik wrote : > >> > >> > Thank you! > >> > that's what I was looking for, after finding out what > >> > it does after reset. :) > >> > > >> > Lembit > >> > >> > >> > ----- Original Message ----- > >> > From: "Tamas Rudnai" > >> > To: "Microcontroller discussion list - Public." > >> > Sent: Sunday, September 10, 2006 12:55 PM > >> > Subject: Re: [PIC] defining data in Program Memory > >> > > >> > > >> > > That's the problem then! > >> > > > >> > > Replace this > >> > > STARTUP CODE > >> > > > >> > > to this > >> > > STARTUP CODE 0x0000 > >> > > > >> > > Tamas > >> > > > >> > >> > >> > >> -- > >> http://www.piclist.com PIC/SX FAQ & list archive > >> View/change your membership options at > >> http://mailman.mit.edu/mailman/listinfo/piclist > >> > > > > > > > > -- > > unPIC -- The PIC Disassembler > > http://unpic.sourceforge.net > > -- > > http://www.piclist.com PIC/SX FAQ & list archive > > View/change your membership options at > > http://mailman.mit.edu/mailman/listinfo/piclist > > > > > > -- > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.1.405 / Virus Database: 268.12.2/442 - Release Date: > 08.09.2006 > > > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- unPIC -- The PIC Disassembler http://unpic.sourceforge.net -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist