This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430FR6972: msp430fr6972

Part Number: MSP430FR6972

Tool/software: Code Composer Studio

Hi,

I am using MSP430FR6972.

I am transmitting one data ( let us say : 'A').

I want to transmit the data to every 2 hours.

For this : Can I use RTC  interrupt?

(I want to used the inbuild RTC only, in MSP430FR6972)

I know that through RTC.. Date, Time is possible.

IS it possible to use RTC for continuously transmitting data after certain interval.

Can you please tell me.. how to do that.

(In the program, the given C Code, the data is transmitting ..only every 1 sec...I want long duration )

Please tell me.

regards,

Srijit

  • What do you have so far? Example msp430fr6x7x_rtc_02.c gives the overall setup:

    https://dev.ti.com/tirex/explore/node?node=AMqRzK8tUCmNb7bzAweYxg__IOGqZri__LATEST

    That uses RTCTEV=0 which triggers RTCTEVIFG every minute, on the minute. [Ref User Guide (SLAU367P) Table 29-7]. You could use RTCTEV=1 to trigger every hour on the hour (and count to 2). 

    To trigger every 2 hours starting now (not on the hour) don't use RTCEVIFG, rather RTCAIFG (Alarm).

    1) To start, add 2 (hours) to the current contents of RTCHOUR, set the AE bit (0x80) and store it in RTCAHOUR.[Ref UG Table 29-30]. Then take the contents of RTCMIN, set the AE bit, and store it in RTCAMIN. Then enable RTCAIE.

    2) Each time you interrupt (RTCIV_RTCAIFG), add 2 (hours) to RTCAHOUR (modulo 24), set the AE bit and put it back into RTCAHOUR.

    System reset doesn't (in general) clean up the RTC registers, so you should fill in most things. Some of the considerations are given in UG Sec 29.2.3

    [Edit: Added setting RTCAMIN as well]

  • Hi,

    Thank you very much for your reply.

    I am now making one program for only 5 minutes.

    Can you check it please.

    RTC INTERRUPT :
    
    #pragma vector=RTC_VECTOR
    __interrupt void RTC_ISR(void)
    {
        switch(__even_in_range(RTCIV, RTCIV_RT1PSIFG))
        {
            case RTCIV_NONE:      break;        // No interrupts
            case RTCIV_RTCOFIFG:  break;        // RTCOFIFG
            case RTCIV_RTCRDYIFG:               // RTCRDYIFG
          //      putchar('R');
          //      LPM3_EXIT;
                break;
            case RTCIV_RTCTEVIFG:               // RTCEVIFG
    //            __no_operation();               // Interrupts every minute
    
         //       putchar('R');
         //       LPM3_EXIT;
                break;
            case RTCIV_RTCAIFG:
                putchar('R');
                LPM3_EXIT;
                 break;                         // RTCAIFG
    
            case RTCIV_RT0PSIFG:  break;        // RT0PSIFG
            case RTCIV_RT1PSIFG:  break;        // RT1PSIFG
            default: break;
        }
    }
    
    
    MAIN PROGRAM  :
    
    int main(void)
    {
       WDTCTL = WDTPW | WDTHOLD;   // stop watchdog timer
    
    
         PJSEL0 = BIT4 | BIT5 ;                   // For LFXT
           //     PJSEL0 |= BIT6 | BIT7;                   // For LFXT
    
          //===================interrupt touch key======================================
    
         //          P1IES = BIT1;                             // P1.2 Hi/Lo edge
         //          P1IFG = 0;                                // Clear all P1 interrupt flags
         //          P1IE = BIT1;                              // P1.2 interrupt enabled
        //========================================================================
    
    
                PM5CTL0 &= ~LOCKLPM5;
    
                 // XT1 Setup
                 CSCTL0_H = CSKEY >> 8;                    // Unlock CS registers
                 CSCTL1 = DCOFSEL_0;                       // Set DCO to 1MHz
                 CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
                 CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;     // Set all dividers to 1
                 CSCTL4 &= ~LFXTOFF;                       // Enable LFXT1
                 do
                 {
                   CSCTL5 &= ~LFXTOFFG;                    // Clear XT1 fault flag
                   SFRIFG1 &= ~OFIFG;
                 }while (SFRIFG1&OFIFG);                   // Test oscillator fault flag
                 CSCTL0_H = 0;                             // Lock CS registers
    
      //=====================================
                 GPIO_init();
                 LCD_init();
                 UART_init();
                 lcd_display_buf();
    
     //============================Interrupt==============
                 P1IES |= 0x02;                            // P1.1
                 P1IFG &= ~0x02;                           // P1.1
                 P1IE |= 0x02;                             // P1.1
    
     //====================TIMER==========================
                 TA0CCTL0 |= CCIE;
                 TA0CCR0 = 32768;
                 TA0CTL |= TASSEL_1 | MC_1 ;
    
    //===================RTC===============================
    
                     RTCCTL0_H = RTCKEY_H;                              // Unlock RTC
         //            RTCCTL0_L = RTCOFIE | RTCAIE | RTCRDYIE | RTCTEVIE;        // enable RTC read ready interrupt
                                                             // enable RTC time event interrupt
                     RTCCTL0_L = RTCAIE;
    
                   //  RTCCTL1 = RTCBCD | RTCHOLD | RTCMODE;   // RTC enable, BCD mode, RTC hold
                     RTCCTL1 = RTCBCD | RTCHOLD | RTCMODE | RTCTEV_0;                   ////Now trying for minutes (5 minutes)
    
                         RTCYEAR = 0x2010;                       // Year = 0x2010
                         RTCMON = 0x4;                           // Month = 0x04 = April
                         RTCDAY = 0x05;                          // Day = 0x05 = 5th
                         RTCDOW = 0x01;                          // Day of week = 0x01 = Monday
                         RTCHOUR = 0x10;                         // Hour = 0x10
                         RTCMIN = 0x32;                          // Minute = 0x32
                         RTCSEC = 0x45;                          // Seconds = 0x45
    
                         RTCAHOUR = 0x12;                       //0b10000010
                         RTCAMIN =  0x15;                      //0b10000101
    
                        RTCCTL1 &= ~(RTCHOLD);                  // Start RTC
    
                          putchar('5');
                             
    
                             while(1)
                         {
                              __bis_SR_register(LPM3_bits | GIE);
    
                 }
    //  return 0;
    }
         
    NOTE  : I am using UART, PORT interrupt, Timer,LCD also.(These are working fine)  

    I AM TRYING FOR  MINUTES, BUT IT IS NOT WORKING.(In 'RTCIV_RTCTEVIFG' : working for only 1 minutes)

    Regards,

    Srijit

  • >                    RTCAMIN =  0x15;                      //0b10000101

    This doesn't set the AE bit. It also is (in BCD) (15+60-32)=43 minutes from RTCMIN, not 5 minutes. Try something like:

    >                    RTCAMIN =  0x37 | MINAE; // 5 minutes from xx:32:00, Alarm set

     

     

  • Hi,

    >>RTCAMIN =  0x15;

    This doesn't set the AE bit. It also is (in BCD) (15+60-32)=43 minutes from RTCMIN, not 5 minutes.  :

       Can you plase explain it ?

    >> "RTCAMIN =  0x37 | MINAE;"  : Please explain this one also!!

    Waiting for your reply.

    Regards,

    Srijit

  • >> "RTCAMIN =  0x37 | MINAE;"  :

                             MINAE is showing error in compilation.

    Result is  : "MINAE" is Undefined. 

  • Try adding:

    > #define MINAE 0x80   // Alarm enable

    [Edit: Apparently I picked out the wrong header file. Try instead:

    > RTCAMIN =  0x37 | RTCAE;

    Either way will work.]

  • hello,

    1)

    "> RTCAMIN =  0x37 | RTCAE;" 

    I have changed the RTCAMIN values.

    2) In ISR PART :

             case RTCIV_RTCAIFG:

             putchar('R');

            LPM3_EXIT;
            break;

    THIS time the Data is not transmitting.

  • When I ran this I observed that RTCADAY and RTCADOW had the AE (0x80) bit set, so the Alarm never matched. This is what I mentioned before about filling in all the fields. [Ref UG Sec 29.2.3] It ran fine when I added:

    >RTCADAY = RTCDAY;
    >RTCADOW = RTCDOW;