[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Enabling and disabling interrutps best practice?
From: |
wbounce |
Subject: |
[avr-gcc-list] Enabling and disabling interrutps best practice? |
Date: |
Sat, 17 Sep 2005 11:14:20 -0400 |
I have been using the following code segment which according to my
understanding disables all interrupts. Would I be better off just
disabling only the interrupt that could be affected by the code? Most of
the time I am doing this because I need to read or update some variable
that also gets updated in a ISR. I have 2 timer interrupts and 4 uart
interrupts. The one timer interrupt is a straight ms timer that
manipulates 5 delay counters the other is the overflow on my PWM which
only works with 2 variables to set new PWM values. I do not seen any
harm in allowing the overflow to run if I am changing on of the delay
counters. For the 4 Uarts I have a receive and transmit on each of my 2
uarts. The receive and transmit for each uarts have their own set of
variables. It shouldn't hurt to allow uart1's interrupts to fire if I am
manipulating the variables for uart0. Right? Or Am I asking for trouble.
I am not talking about reentrant ISRs but invariable manipulation
outside of the ISRs
uint8_t Sregs;
Sregs =SREG; //save & clear ints
cli();
Some code
SREG =Sregs; //restore ints
- [avr-gcc-list] Enabling and disabling interrutps best practice?,
wbounce <=