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.

Enabling and initialising interrupts in msp430f5438

Status
Not open for further replies.

Jagadeesh.b324

Newbie level 5
Joined
Oct 19, 2011
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,352
Hello,

Can anyone help me..?? I want to know how to enable and initialize interrupts in msp430f5438??


Please reply me back as soon as possible...
 

Are you using C or Assembly language to program the device?

If C language, what compiler are you using?

What interrupts are you attempting to enable?

BigDog
 

Hi..

I am using thermal printer FTP644MCL001 and taking head up and paper sensor outputs(which are high) as interrupts and then i need to run the stepper motor.. if any 1 is not high, then it should enter LPM (low power mode) i am attaching the code.. the program is getting terminated without going into the function call.. mostly there might be a error in enabling/initializing interrupts.. please help in sorting out this problem..

Code:
#include"iomsp430.h"

#define headup P4OUT_bit.P4OUT_O

#define photoint P4OUT_bit.P4OUT_5

void main (void)

{

  WDTCTL = WDTPW + WDTHOLD;   // Stop watchdog timer

 P4DIR_bit.P4DIR_0 = 1;

 P4DIR_bit.P4DIR_5 = 1;


P1REN |= BIT2; // P1.2 Enable Pullup/Pulldown

P1OUT = BIT2;                                           // P1.2 pullup

P1IE |= BIT2;                                              // P1.2 interrupt enabled

 P1IES |= BIT2;                                          // P1.2 Hi/lo falling edge

P1IFG &= ~BIT2;                                       // P1.2 IFG cleared just in case

_EINT();

if (headup==1)

     {
        
                if (photoint ==1)
               
                    {
                        
                          steppermotor();

                     }


  else


    __bis_SR_register(LPM4_bits + GIE);     // LPM4 with interrupts enabled

    __no_operation();

   }


void steppermotor(void)

P4DIR |= 0x40; // Set P4.5 to output direction

 for (;;)
{
 P4OUT ^ = 0x40; // 

i = 500; // Delay

 do (i--);

 while (i ! = 0);
}

//
P1DIR |= 0x01; 		// Set P1.0 to output direction
P2IE |= 0x01; 		// P2.0 interrupt enabled
P2IES |= 0x01;		 // P2.0 Hi/lo edge
P2IFG &= ~0x01;		 // P2.0 IFG cleared

_BIS_SR(LPM4_bits + GIE);		 // Enter LPM4 w/interrupt
}

// Port 2 interrupt service routine
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{
P1OUT ^= 0x01; // P1.0 = toggle
P2IFG &= ~0x01; // P2.0 IFG clearedf
}

//
 
Last edited by a moderator:

hi,
please refer this new program also..

#include "io430.h"
#include "intrinsics.h"

#define headup P4OUT_bit.P4OUT_O

#define photoint P4OUT_bit.P4OUT_5

void steppermotor(void);
volatile unsigned int i;
void main (void)

{

WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

P4DIR_bit.P4DIR_0 = 1;

P4DIR_bit.P4DIR_5 = 1;

P4DIR |= 0x40; // Set P4.5 to output direction

P1REN |= BIT2; // P1.2 Enable Pullup/Pulldown

P1OUT = BIT2; // P1.2 pullup

P1IE |= BIT2; // P1.2 interrupt enabled

P1IES |= BIT2; // P1.2 Hi/lo falling edge

P1IFG &= ~BIT2; // P1.2 IFG cleared just in case

if (headup==1)

{

if (photoint ==1)

{

steppermotor();

}


else


_bis_SR_register(LPM4_bits + GIE); // LPM4 with interrupts enabled

_no_operation();

}

}
void steppermotor(void)
{

for (;;)
{
P4OUT^= 0x40; //

i = 500; // Delay

do (i--);

while (i!=0);
}
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top