• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » MSP430™ Microcontrollers » MSP430 Ultra-Low Power 16-bit Microcontroller Forum » IR signal read from the remote using msp430g2553 launchpad
Share
MSP430™ Microcontrollers
  • Forum
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
MSP430 Resources
  • MSP430 Product Folder
  • MSP-EXP430G2 - MSP430 LaunchPad Value Line Development kit
  • MSP430 Getting Started Guide
  • MSP430 Microcontroller Projects
  • More Resources >
  • Forums

    IR signal read from the remote using msp430g2553 launchpad

    This question is answered
    Jimit Shah98102
    Posted by Jimit Shah98102
    on Apr 08 2012 07:12 AM
    Prodigy60 points

    Hi,I having problem with decoding the received IR signal from the normal 38 Khz remote and I am using the 38Khz receiver from the vishay. I am using the capture & compare timer of the msp430g2253.but the problem I am facing is in my code below is it can capture the falling edge and produce the interrupt but when I change capture mode to capture rising edge it doesnt detect the rising edge and remains in the low power mode.another problem with this code is that after getting the first falling edge interrupt it remains in the sleep mode only though I am clearing the cpuoff bit in the ISR. Please help me I have hit the wall and provide any code which can caputure both rising edge and falling edge and at the same time it should save the CCR value so that I can have the timing between falling and rising edge. please it is for the project.Your help is appreciated.

    my code is as below.it doesnt execute the colored part and remains in the sleep mode. 


    #include "io430.h"

    unsigned int rxdata = 0; // received data: A4-A0 and C6-C0 0000 AAAA ACCC CCCC
    unsigned int bitCounter = 0;

    void main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // stop WDT
    BCSCTL1 = CALBC1_1MHZ; // load calibrated data
    DCOCTL = CALDCO_1MHZ;

    P1DIR &= ~BIT1; // P1.1 input
    P1SEL = BIT1; // P1.1 Timer_A CCI0A

    P1OUT &= ~(BIT0 + BIT6 + BIT5); // P1.3-1.5 out
    P1DIR |= (BIT0 + BIT6 + BIT5);

    TACTL = TASSEL_2 | MC_2; // SMCLK, continuous mode

    CCTL0 = CM_2 | CCIS_0 | CAP | CCIE; // falling edge capture mode, CCI0A, enable IE

    __bis_SR_register(CPUOFF + GIE);

    rxdata = CCR0;
    CCTL0 = CM_1 | CCIS_0 | CAP | CCIE;
    __bis_SR_register(CPUOFF + GIE);
    bitCounter = CCR0;

    }

    #pragma vector = TIMER0_A0_VECTOR
    __interrupt void Timer_A (void)
    {
    __bic_SR_register(GIE);
    P1OUT = P1OUT ^ BIT0;
    TACCTL0 &= ~CCIFG;
    __bic_SR_register(CPUOFF);

    }



    IR launchpad MSP430g2553
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • old_cow_yellow
      Posted by old_cow_yellow
      on Apr 08 2012 09:52 AM
      Verified Answer
      Verified by Jimit Shah98102
      Guru26575 points

      The reason that the CPU does not wake up after your ISR exits is because you did not clear the CPUOFF bit of SR in the saved copy in the stack. Thus when the ISR exits, the SR is restored by the interrupt hardware with CPUOFF bit still set.

      You use __bic_SR_register(CPUOFF); in your ISR. This will clear CPUOFF bit in SR, which is already 0 (otherwise the CPU is asleep and will not execute this statement). You should have cleared that bit of the save copy on the stack instead.

      You also use __bic_SR_register(GIE); in your ISR. This will clear GIE bit in SR, which is already cleared by the interrupt hardware. You do not need this statement.

      The rest is not "in the history" yet -- your main() need to do more before it exits.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Jimit Shah98102
      Posted by Jimit Shah98102
      on Apr 08 2012 11:47 AM
      Prodigy60 points

      Now my question is how to change the content of the SR in the stack in C because the instruction in assembly for changing the SR in the stack is known to me but I dont know how to do that in C.So please help. and I have cleared GIE to check if another interrupt is causing this issue (or) not. Thank You for attention and help. 

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • old_cow_yellow
      Posted by old_cow_yellow
      on Apr 08 2012 12:18 PM
      Guru26575 points

      It depends on which c-compiler you are using.  Something like: __bic_SR_register_on_exit ( CPUOFF );

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use