Ibrahim Saidi wrote:

Yah i might just have to do it by hand... its a little easier The reason why i need it is to synchornize access to global mem. Semaphore issues. I dont want my ADC ISR to alter the global mem, while the forground is accessing/checking it, usualy you woul just generate a trap from the forground, so that your are in interrupt space while u access globals...

a simple event handler may be useful too. i often use use that one. a short
variable keeps 16 bits, each bit coresponds to a function. after one
bits/function is handled, the bits are scanned again. that way an interrupt
can trigger a foreground function. that way you dont need to read out the
values in the interrupt and you keep the interrupts as short as possible.

the uart_test in the examples (in the mspgcc CVS) uses such a taskhandler (wrong name, i know, it's more like an event handler as it does not support context switches, only one handler after an other)

But i think i can just use dint() and eint()...

to be sure, use "dint(); nop();" as interrupts get locked one cycle after the instruction.

if i use dint(), and an ADC interrupt occurs, would it just queue up untill i re-enable interrupts with eint() ? I would think it should just queue up any interrupts in vector order of priority...

yes, that's correct.

On November 23, 2003 05:58 pm, Chris Liechti wrote:

Ibrahim Saidi wrote:

How can i implement Software Interrupts in msp430-gcc, (Traps) ?

sort of. there is not a single instruction that genreates an interrupt,
but there are workarounds, like generating a port P1 or P2 interrupt by
toggling a pins output (the unbonded two pins on F11x and F12x devices
can be used for that), the timer can be used in capture mode or you can
generate flash or watchdog access violations (altough those are mapped
to the reset vector, so that needs a special startup sequence, not
recomended ;-)


for example, Borland provides a func  geninterupt(Vector)   which
generates an interrupt on a given vector number.... and you can assign
your software interrupt routine to a vector number using
set_vect(pointer_isr,vector_num).

you can implement interrupts with the intterupt keyword, like its
described in the manual, or look at some of the example programs.


is there an equivelant in msp430-gcc for generating and implementing
traps?

not something like you mentioned above, but there may be other solutions
for you.

is a normal function call not enough? there is no multitasking unless
you implement it yourself on the MSP430. that means that the special
properties of an interrupt are not needed in most cases, where you want
to have a "trap".
the difference of an interrupt function to a normal function is verry
small anyway. (SR and PC is pushed on the stack instead of PC only, and
DINT is called) you can do that "by hand" if you want.

chris



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users





Reply via email to