Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MSP430 Port Interrupt Problem

Status
Not open for further replies.

rahulr30

Newbie level 2
Joined
Apr 9, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,298
Hi everyone,

I am doing some motor control project in msp430g2553. I need to configure P1.2 as an interrupt. I looked up a few examples and wrote the following code. I have left certain other irrelevant parts of the code for brevity. I am using ccp for capture as well as compare. I am using adc as well. All of this are in ISRs. The clock is at 16 Mhz, the max possible from DCO. The code is below. While testing, I can see the P1.2 pin going high and low while I make it high and low. But the P1IFG flag just does not get set, due to which it is not going to the ISR. Any help will be appreciated. Thanks in advance.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
void main(void)
{
    ConfigWDT();
    ConfigClocks();
    ConfigCcp();
    ConfigAdc();
 
    P1DIR = BIT0 + BIT6;                             // P1.6 and P1.0 outputs
    P1SEL = BIT1 + BIT2;
    P1OUT = 0x00;
    P2DIR = 0xFF;
    P2OUT = 0x00;
 
    P1IE = BIT2;                    // BIT 2 USED FOR CORRECTOR PULSE
    //P1IES &= ~BIT2;                   // LOW TO HIGH TRANSITION
    P1IFG = 0x00;
 
    __enable_interrupt();
    _BIS_SR(GIE);
 
    while(1)
    {
        //for (i = 1000; i > 0; i--);
    }
}
 
#pragma vector=PORT1_VECTOR
__interrupt void count_reset (void)
    {
        count=0;
        P1IFG &= ~BIT2;
    }

 
Last edited by a moderator:

Hello!

I don't know which one you are using, but in case it's the one that goes with the LaunchPad,
doing P1SEL = BIT1 + BIT2 selects the uart. Therefore, the port function is disabled for these
2 pins and you cannot receive a port interrupt.

Dora.
 

Hello!

I don't know which one you are using, but in case it's the one that goes with the LaunchPad,
doing P1SEL = BIT1 + BIT2 selects the uart. Therefore, the port function is disabled for these
2 pins and you cannot receive a port interrupt.

Dora.

Dear Dora,
Yes, I am using lauch pad. I have removed the jumpers which connect it to the UART port. Anyway I am using Port1.1 for capture and it is working fine.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top