I've got a Problem with my Port1 Interrupt.
In normal mode (Print supplied by power supply 3.3V) everything does work correct even
the Port1 ISR.
But in battery mode (Print supplied by battery 2.3V) there is a failure by not clearing
the P1IFG Bit in the ISR.
This means that I am debugging my circuit with the IAR tool till I reach the Port 1
ISR.
In this ISR, I first of all do clear the P1IFG Flag and the enable global interrupt (GIE)
because there could be another interrupt during this with higher priority.
An now the problem is, that in battery mode, this P1IFG Flag won't be cleared despite my
code line "P1IFG &= ~0x03;".
But in normale mode, the bit gets cleared without problem but soon I cut the power supply
(switch to battery) the Flag won't be cleared anymore.
Heres the C-Code of my ISR:
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
if (P1IFG & 0x04) // When SSI-Interrupt ...
{
TACTL |= TACLR; // Timer restart
TACCR0 = 0x140; // 20us Monoflop Timer restart
ssi_value = ssi_value << 1; // MT+ST value shift
while (!(P1IN & 0x04)); // Wait till SSI-CLK pos. edge
if (ssi_value & 0x80000000) // display Datanbit ...
{
P1OUT |= 0x08; // Datawire on High
} else
{
P1OUT &= ~0x08; // Datawire on Low
}
P1IFG &= ~0x04; // SSI Interrupt enable
} else
{
P1IFG &= ~0x03; // Here should the P1IFG be cleared
__bis_SR_register(GIE); // Interrupt on pos. edge
// Multiturn Position anpassen
par.reed1 = P1IN & 0x01; // read REED 1
par.reed2 = P1IN & 0x02; // read REED 2
Does anybody got an idea? Please help me?
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
You might be looking at a hardware issue, in that the port pin signal
isn't quite doing what you expect when you change to battery mode.
How are the two supplies fed to the reed switches and the MSP? Also
even though reeds are much better than buttons (I'm assuming you're
using reeds) they still bounce for 1 or 2 mSecs. At (say) 8MHz that
equates to something like 1,000,000 MSP430 instructions, plenty of
time to get multiple interrupts. Therefore some kind of de-bounce
handling in the software would seem to be a good idea.
Interestingly you therefore have the port interrupt re-enabled with
global interrupts enabled while still within the interrupt and with a
signal still transitioning on the port pin (due to the bounce). Now I
always make interrupt service routines so short that there is never
any point in re-enabling global interrupts, so I can't answer this
next question from experience for the MSP430. Are you getting
multiple nested port interrupts (nested in the sense that another
port interrupt occurs while still within the previous interrupt)? Are
you using a slower clock in battery mode compared to normal power
mode? Note that setting a breakpoint within your IDE in the interrupt
effectively does a reed debounce for you, which is thus affecting
observed behaviour. A stack trace would show up nested interrupts, by the way.
Finally - given that the reed is bouncing - reading the port pin to
see which reed is closed is unreliable, since you might just happen
to sample the reed as it has bounced open. A poor man's debounce
could be achieved with a small capacitor from the pull-up to ground,
but this will increase power dissipation with higher switching
speeds. Better to do the debounce in software. Reeds can also be
replaced by Hall's.
Hugh
At 10:36 PM 9/8/2008, you wrote:
I've got a Problem with my Port1 Interrupt.
In normal mode (Print supplied by power supply 3.3V) everything does
work correct even the Port1 ISR.
But in battery mode (Print supplied by battery 2.3V) there is a
failure by not clearing the P1IFG Bit in the ISR.
This means that I am debugging my circuit with the IAR tool till I
reach the Port 1 ISR.
In this ISR, I first of all do clear the P1IFG Flag and the enable
global interrupt (GIE) because there could be another interrupt
during this with higher priority.
An now the problem is, that in battery mode, this P1IFG Flag won't be
cleared despite my code line "P1IFG &= ~0x03;".
But in normale mode, the bit gets cleared without problem but soon I
cut the power supply (switch to battery) the Flag won't be cleared anymore.
Heres the C-Code of my ISR:
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
if (P1IFG & 0x04) // When SSI-Interrupt ...
{
TACTL |= TACLR; // Timer restart
TACCR0 = 0x140; // 20us Monoflop Timer restart
ssi_value = ssi_value << 1; // MT+ST value shift
while (!(P1IN & 0x04)); // Wait till SSI-CLK pos. edge
if (ssi_value & 0x80000000) // display Datanbit ...
{
P1OUT |= 0x08; // Datawire on High
} else
{
P1OUT &= ~0x08; // Datawire on Low
}
P1IFG &= ~0x04; // SSI Interrupt enable
} else
{
P1IFG &= ~0x03; // Here should the P1IFG be cleared
__bis_SR_register(GIE); // Interrupt on pos. edge
// Multiturn Position anpassen
par.reed1 = P1IN & 0x01; // read REED 1
par.reed2 = P1IN & 0x02; // read REED 2
Does anybody got an idea? Please help me?
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )