DSPRelated.com
Forums

INTTERRUPT IN C ENVIRONMENT

Started by liang mar February 25, 2004
Hi:
I have a question to ask,that is how to enable and disable the interrupt in
C environment on the DSK(CCS DSK C5000 1.22).I did as follows:
#include <stdlib.h>
#include <type.h>
#include <board.h>
#include <flash1.h>
void main (void)
{ volatile unsigned int *ST1_REG1 = (volatile unsingned int *)0x07;
volatile unsigned int *IMR_REG = (volatile unsigned int *)0x00;
.
.
.
*ST1_REG1 &= 0xf7ff;
.
.
.
}
but the bit "INTM" could not be changed,while other registers could be changed
ideally(through the register window).Why ?
Please give me a answer as soon as possible ? Thank you very much !
---------------------------------




liang mar wrote:

> Hi:
> I have a question to ask,that is how to enable and disable the interrupt
in C environment on the DSK(CCS DSK C5000 1.22).I did as follows:
> #include <stdlib.h>
> #include <type.h>
> #include <board.h>
> #include <flash1.h>
> void main (void)
> { volatile unsigned int *ST1_REG1 = (volatile unsingned int *)0x07;
> volatile unsigned int *IMR_REG = (volatile unsigned int *)0x00;
> .
> .
> .
> *ST1_REG1 &= 0xf7ff;
> .
> .
> .
> }
> but the bit "INTM" could not be changed,while other registers could be changed
ideally(through the register window).Why ?
> Please give me a answer as soon as possible ? Thank you very much !

It may be that CCS generates the wrong code to make this work. I've
never manipulated ST1 directly, I always use the opcodes. I would use
the asm(); function from 'c' to set/clear the intm (and other) flags:

Clear flag:
asm(" RSBX INTM");

Set flag:
asm(" SSBX INTM");

Brian

--
-----------------
Brian C. Lane (W7BCL) Programmer
www.shinemicro.com RF, DSP & Microcontroller Design