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.

'org'? 'ISR_addr'? Getting interrupt working

Status
Not open for further replies.

Thorpydo

New Member
Hey,

I'm feeling guilty asking so many questions... but I am new to this and have been working on it for the majority of the last few days.

I've read most of the datasheet for the 12F629 and also section 8 of the mid-range MCU family, dealing specifically with interrupts.

The processor goes to sleep. When the edge interrupt is triggered, the processor needs to wake up, change some GPIO pins and then go back to sleep again, and wait for another interrupt to occur. Simple enough...

Looking at example programs, I see 'org ISR_ADDR'. My first question is if this is a macro? Where do I learn more about these type of commands? I presume 'org ISR_ADDR' tells the processor where to go after any interrupt is triggered. I get the following errors when using it:

Error[113] C:\PIC\GENERIC BOARD.ASM 93 : Symbol not previously defined (ISR_ADDR)
Error[118] C:\PIC\GENERIC BOARD.ASM 98 : Overwriting previous address contents (0000)

I was also wondering what kind of ram is in the 12F629(Common RAM/ without common RAM/General Purpose RAM only in bank0... so that I can follow the datasheet on how to push and pop found here.
https://www.electro-tech-online.com/custompdfs/2004/08/31008a.pdf

Thanks
 
Thorpydo said:
Looking at example programs, I see 'org ISR_ADDR'. My first question is if this is a macro? Where do I learn more about these type of commands? I presume 'org ISR_ADDR' tells the processor where to go after any interrupt is triggered. I get the following errors when using it:

Error[113] C:\PIC\GENERIC BOARD.ASM 93 : Symbol not previously defined (ISR_ADDR)
Error[118] C:\PIC\GENERIC BOARD.ASM 98 : Overwriting previous address contents (0000)

The ISR_ADDR you see in an example program is probably a constant.
MPASM allows you, just like most compilers, to give a constant number a name. You do this with an 'EQU'.

for example:
ISR_ADDR EQU 0x04

now, ISR_ADDR holds the value 4h (wich is the interrupt vector for your pic). It is NOT a variable, just a constant number with a name that makes sense in stead of beeing a 'magic number'

now 'ORG ISR_ADDR' means that the code you put below this line will start on address ISR_ADDR (wich we equ'd to 4h). you want to do this for your interrupt code because an interrupt will cause program execution to jump to address 0x04 (this also means that your program start at adress 0 should hold a jump to somewhere else within the first 3 instructions)

Thorpydo said:
I was also wondering what kind of ram is in the 12F629(Common RAM/ without common RAM/General Purpose RAM only in bank0... so that I can follow the datasheet on how to push and pop found here.

I'm not sure what you mean here. There's no software stack on a pic12, so you can't push and pop in the stack sense...
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top