I want to use interrupt wtihout library. I want to change register directly to enable interrrupts of user switch buttons on tiva c TMC123G launchpad. I wan to change the value of a variable in the interrupt function.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I want to use interrupt wtihout library. I want to change register directly to enable interrrupts of user switch buttons on tiva c TMC123G launchpad. I wan to change the value of a variable in the interrupt function.
Hi Arden,
There are C API's already for enabling gpio interrupts, see, GPIOIntEnable().
But, if you want to use direct register read/write, see how direct register read/write is done within C API's such as GPIOIntEnable and others.
-kel
Hello Arden
Some of the Interrupt API use assembly. You may end up in a code which has a mix of C and inline assembly. Becomes tough as the code matures
Regards
Amit
In my university course we are taught to program motorola 6800 with assembly because of basicness but since I got the tiva c my lecturer wanted me to do the things with tiva c, thus I don't want to use Api for this reason.
So directyl adrssing the register with the c pointers and assigning the required values just for a user switch interrupt will be fine for me.
I am able to use clock gating setting GPIODIR GPIODEN and changing the data I am able to blink the leds. But I don't udnerstand which registers should be used for interupt.
If it is possible I want to use timer for squintial blibkyng for four LED.
Hello Arden,
To use the Interrupt from the GPIO, you would need to use the following 3 registers for configuring what type of interrupt is needed (rising edge, falling edge, both edge, high level and low level)
GPIOIS
GPIOIBE
GPIOIEV
Once done the following register is used to enable the Interrupt propagation to the CM4 CPU
GPIOIM
To clear the interrupt in the Interrupt handler you would need to use GPIOICR
Regards
Amit
Hi Amit. Thanks for your responses.
I don't knwo what do these means (rising edge, falling edge, both edge, high level and low level) which one of shpuld be used for button click.
As I understand I need to do msater enable for interupts. What is the register for doing this.
Hello Arden,
It means whether the interrupt from the GPIO will be triggered on Rising Signal on GPIO, Falling Signal on GPIO, and so on.
If the button is connected to a Pull Up and when pressed it will make the GPIO as 0V then it would be a falling edge that has to be detected. If the interrupt is to be detected on button de-press then a rising edge interrupt has to be configured.
Yes there is a master enable and an enable in the NVIC controller. While the NVIC can be enabled by writing to the NVIC_EN register, for the master enable you would need to do a inline assembly.
//
// Read PRIMASK and enable interrupts.
//
__asm(" mrs r0, PRIMASK\n"
" cpsie i\n"
" bx lr\n"
: "=r" (ui32Ret));
Regards
Amit
Arden Kuyumcu said:If it is possible I want to use timer for squintial blibkyng for four LED.
Will be useful to pay bit more "attention to detail" when managing GPIO & Interrupt. Each/every character entered in your code must be precise - to specification (i.e. devoid of any "uniqueness"...)