Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Interupt and Reset vectors in 24F series

Status
Not open for further replies.

Diver300

Well-Known Member
Most Helpful Member
I'm programming 24F series PICs in assembly language and just thinking of getting into using interrupts.

The program in a 24F starts at 0x200, and the interrupt vectors are 0x04 - 0xfe. The alternative interrupt vectors are 0x100 - 0x1fe

Resets put the program counter to 0x00 so a GOTO 0x200 needs to be put into the first lines of code. The only way that I could get MPLAB to put that GOTO in was to modify the .gld file as follows:-

Code:
__CONFIG2 = 0xABFC;
__CONFIG1 = 0xABFE;
[COLOR="Red"]__reset = 0x200;	/* Added by Diver300 */[/COLOR]

__IVT_BASE  = 0x4;
__AIVT_BASE = 0x104;
__DATA_BASE = 0x800;
__CODE_BASE = 0x200;

I am sure that there should be a better way of doing this. If the .gld file needed that line, Microchip would have added it.

Now I want to know how to add the interrupt vectors into the code.

Can anyone tell me the right way to get the GOTO 0x200 to be inserted or how to add interrupt vectors?
 
I know that it's 2 years since I posed this question.

In the meantime I found the answer, lost the answer and found the answer again.

I'll add this so that I can always find it here if I ever forget how to do this again......

You put this at the start of the code.
Code:
.global __reset
__reset:

Obvious, if you know.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top