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/MSP430FR5969: Function call

Part Number: MSP430FR5969
Other Parts Discussed in Thread: TPS60120

Tool/software: Code Composer Studio

Hi,

I want to know is there any compiler restrictive when assigning a return value of function to a variable.

Eg,. int variable = get_port_status()

int get_port_status()

{

int port_A = 0x80; //PORT A has Bit7 enabled

return port_A;

}

During Debugging, When I step into this kind of statement, Debugger has to go and execute the function statements. But, instead of the function is not stepped into this. So, i am getting error data at after step into. 

  • Hi sadasivam,

    I don't found there are any problem, could you provide more details about this issue?

    Thanks!

    Best Regards

    Johnson

  • Yeah. I have questioned with same logic. So, I will clearly send the actual process.

    MSP430FR5969 Soc.

    In our custom design, we are using TPS60120 with LIPO battery(4.2) supplied. So, after voltage divided with 820K and 576K, we will receive the LBI input as 1.032(2.5 i.p) to 1.732v(4.2v i.p). 

    So, when the battery input is below 1.21v reference, LBO output will be triggered LOW.

    This LBO output is given into ADC module and reading the adc status of battery. 

    Above are the construction f our design.

    My question is, 

    I am trying to read the battery status to check if it reaching 20%.

    My logic is,

    /*********************************************************************

    *Defines

    */

    #define BATTERY_LOW                                     0xCC /* 

    if(batt_adc_value<=1400)
    {
    batt_adc_value = BATTERY_LOW;
    }

    */

    /*********************************************************************

    * Declarations

    */

    unsigned int low_power_mode_check = 0;

    /*********************************************************************

    * PORT CONFIG

    */

    P3DIR &= ~BIT7;
    P3REN |= BIT7;
    P3OUT |= BIT7;
    P3IE |= BIT7;
    P3IES |= BIT7;
    P3IFG &= ~BIT7;

    PORT3ISR: if low interrupt occurs, BIT7 flag set. So, onBatteryLow = 1;

    // Checking Low battery / good battery output from regulator

    /********************************************************************************

    *Main Loop

    */
    while(onBatteryLow)
    {
    onBatteryLow = 0;                                      // Reset the Battery Low flag

    //qualifying the condition based on power modes


    while(!(P3IN & BIT7))                                  // led high while bit7 is low
    {


    //getting the battery status
    disable_temp_sensor();                              // disable the temperature sensor (A11) when using analog pin 13


    low_power_mode_check = battMeasure(); // reading the battery status using ADC module Analog pin 13.


    disable_temp_sensor();


    switch(low_power_mode_check)
    {
    case BATTERY_LOW:
    {
        while(!(P3IN & BIT7))
        {
                GPIO_setOutputHighOnPin( GPIO_PORT_P4, GPIO_PIN6 ); // for low battery indication. Always in loop.
         } // and changed only after P3IN & BIT7 = 0x01
    }
    break;
    default: break;
    }
    }
    clear_battbuffer();
    P3IE |= BIT7;
    }

  • Hi sadasivam,

    You initialize P3.7 pin to input interrupt mode via high-to-low,  Why not use interrupt service routine?

    Best Regards

    Johnson

  • yes, I have configured in ISR. But, when I stepped into battmeasure() function, debugger doesnt enter into function. Instead, it stepped into next statement and return 0 value. So, I am unable to get exact battery level.

  • Hi sadasivam,

    There are two mode for step debug, first is execute a minimal statement, and another is to execute a line of program.

    I think you can add breakpoint to debug your code.

    And it is difficult to diagnose problems without a complete code.

    Best Regards

    Johnson

**Attention** This is a public forum