![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
I have a port that when any of its pin causes an interrupt, it vectors the MCU to address 0x7B. I would like to create a new file, and write inside it a function, and have the function's address to be 0x7B. I'd mention that i write the code in C language, not in assembly language. How can i do that? Thanks! | |
| |
| | #2 |
|
At least for PICs, there is a preset function name of some sorts that is at that memory address and gets called whenever the interrupt is triggered. You just declare the function using that name and type out your routine and it just runs whenever the interrupt fires. Check your compiler user manual about interrupts.
Last edited by dknguyen; 11th February 2009 at 08:58 PM. | |
| |
| | #3 |
|
Thanks for the answer. You suggest a nice way how to bypass the setting of a function in a ceratin address. I'd still like to know how you do that, becuase i assume its possible. By the way, i use the CC2430 MCU. | |
| |
| | #4 |
|
I don't know anything about that processor.
| |
| |
| | #5 |
|
Alirght, I know that if i used assembly language, i could use the command ' DSEG AT 0x7B ' and their i would be calling my function that serves interrupts. I just dont know how to write it in C language. | |
| |
| | #6 |
|
YOu can write sections of assembly in C you know. I think you use asm{...} or something like that. | |
| |
| | #7 |
|
Yes but the whole other code is written in C, so implementing single asm file in the code wouldn't be a good idea.
| |
| |
| | #8 |
|
You don't need asm. What compiler and have you read the manual.?
| |
| |
| | #9 |
|
The IAR Compiler for the 8051 has an interrupt keyword that is used to bind a function to an interrupt vector. Code: interrupt [0x0023] using [SP_BANK] void SERIALISR(void)
{
...SERIALISR Code
}
__________________ We never have time to do it right; but we always have time to do it over. | |
| |
|
| Tags |
| address, function, set |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Incrementing Register Address?? | Suraj143 | Micro Controllers | 2 | 8th December 2008 02:30 AM |
| want an address sequence file | srujan | Electronic Projects Design/Ideas/Reviews | 4 | 10th March 2008 11:59 AM |
| address 0x000 | aljamri | Micro Controllers | 0 | 25th May 2007 10:19 AM |
| MAC address problem | tkvenki | Micro Controllers | 4 | 22nd March 2007 09:25 AM |
| Function Generator question: What is GATE function? | Cifrocco | General Electronics Chat | 8 | 14th April 2005 04:11 AM |