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.

For LCD_C blink function of MSP430FR6989IPZ

Other Parts Discussed in Thread: MSP-EXP430FR6989

I am using the MSP430FR5xx_6xx_DriverLib.

Setting the LCD memory of LCD controller "Static and 2-Muxto4-Mux Mode".

Only one segment that segment trying to blink has become to do a segment ON the blink setting in LCD_C_setBlinkingMemory function there and will be blinking.

If you use the LCD_C of MSP430 in "Static and 2-Muxto4-Mux Mode".

Is there such considerations that make the blink specified individual segment?

  • Hi kozo kitada,

    I'm trying to understand your question. Are you asking if it is possible to blink an individual segment on the FR6989 in static/2-mux/4-mux mode? This is true, you can do this - you need to set the bit in the blinking memory for the bit that you want to toggle. It also sounds like you want to know if the driverlib LCD_C_setBlinkingMemory will allow you to blink a single segment - this is also true, but you have to have the LCD_C_setBlinkingControl set to the right mode.

    So basically your driverlib code will look something like this:

        LCD_C_setBlinkingControl(LCD_C_BASE, LCD_C_BLINK_FREQ_CLOCK_DIVIDER_1,
        		LCD_C_BLINK_FREQ_CLOCK_PRESCALAR_32768,
    			LCD_C_BLINK_MODE_INDIVIDUAL_SEGMENTS);
    
        LCD_C_clearBlinkingMemory(LCD_C_BASE);
        LCD_C_setBlinkingMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_8, 0x1);

    You set the blinking frequency and blinking mode using LCD_C_setBlinkingControl. The blinking frequency is based off of the frequency of the clock sourcing the LCD - in my case, the XT1 clock at 32768Hz, so I set my Prescalar to blink at once per second (1Hz). Then you also need to set LCD_C_BLINK_MODE_INDIVIDUAL_SEGMENTS if you want to toggle individual segments instead of the entire screen. Please note there's also a mode for toggling between the image in the LCD memory and the one in the Blink memory - that's another option depending on what you want to do.

    Finally, In LCD_C_setBlinkingMemory, set the segments that you want to blink. First, set the line that is connected to the segment you want to blink (this will depend on your LCD). Then, you need to provide a value - this value is which segments on your LCD connected to that segment line, you want to blink. This is arranged just like LCD memory, so it depends on your Muxing mode. If you open up lcd_c.c from driverlib, you can see that inside this LCD_C_setBlinkingMemory function, it is taking into account whether you have set your muxing mode to static/2/4mux, or one of the higher muxing modes:

    void LCD_C_setBlinkingMemory(uint16_t baseAddress,
                                 uint8_t pin,
                                 uint8_t value)
    {
        uint8_t muxRate = HWREG16(baseAddress + OFS_LCDCCTL0)
                          & (LCDMX2 | LCDMX1 | LCDMX0);
    
        // static, 2-mux, 3-mux, 4-mux
        if(muxRate <= (LCDMX1 | LCDMX0))
        {
            if(pin & 1)
            {
                HWREG8(baseAddress + OFS_LCDBM1 + pin / 2) &= 0x0F;
                HWREG8(baseAddress + OFS_LCDBM1 + pin / 2) |= (value & 0xF) << 4;
            }
            else
            {
                HWREG8(baseAddress + OFS_LCDBM1 + pin / 2) &= 0xF0;
                HWREG8(baseAddress + OFS_LCDBM1 + pin / 2) |= (value & 0xF);
            }
        }
        else
        {
            //5-mux, 6-mux, 7-mux, 8-mux
            HWREG8(baseAddress + OFS_LCDBM1 + pin) = value;
        }
    }

    Regards,

    Katie

  • Dear Katie Pier -sanThank you very much.I understand.Best RegardsKozo Kitada
  • LCD_C power supply OFF of (LCDCCTL0 register: bitLCDON (0)) to be have been trying to lower the power consumption, a result that power consumption in reverse increases.

    Migrating to LPM3 remains of LCD_C of LCDCCTL0 register (bitLCDON (1)).
    → LCD module also including board all of the current consumption: Low
    Migrating to LPM3 remains of LCD_C of LCDCCTL0 register (bitLCDON (0)).
    → LCD module also including board all of the current consumption: High

    Turn the LCD_C to OFF in LPM3 to suppress power consumption. What you will need to perform in addition to the LCDCCTL0 register (bitLCDON)?

  • Hi kitada-san,

    I did some testing on the MSP-EXP430FR6989 Launchpad that has an LCD on it. I used the attached code:

    msp430fr69xx_lcdc_01.c
    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2014, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     *******************************************************************************
     *
     *                       MSP430 CODE EXAMPLE DISCLAIMER
     *
     * MSP430 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
     * for an API functional library-approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //  MSP430FR69x Demo - LCD_C, 4-Mux example, display "430" string on the LCD.
    //
    //  Description: This examples configures the LCD in 4-Mux mode and displays
    //  "430" on a TI LCD. This example was tested on EVM430-EXPFR6989.
    //  This example would need to be modified based on the final LCD and GPIO
    //  routing where lcd_num[] would need to be modified.
    //  The internal voltage is sourced to v2 through v4 and v5 is connected to
    //  ground. Charge pump is enabled.
    //
    //  It uses LCD pin L0~L21 and L26~L43 as segment pins.
    //  f(LCD) = 32768Hz/((1+1)*2^4) = 1024Hz, ACLK = ~32768Hz,
    //  MCLK = SMCLK = default DCODIV ~1MHz.
    //
    //                 MSP430FR6989 / EVM430-EXPFR6989
    //              -----------------
    //          /|\|                 |
    //           | |              XIN|--
    //  GND      --|RST              |  ~32768Hz
    //   |         |             XOUT|--
    //   |         |                 |
    //   |         |             COM3|----------------|
    //   |         |             COM2|---------------||
    //   |--4.7uF -|LCDCAP       COM1|--------------|||
    //             |             COM0|-------------||||
    //             |                 |    -------------
    //             |           L0~L21|---| 1 2 3 4 5 6 |
    //             |          L26~L43|    -------------
    //             |                 |       TI LCD
    //
    //   William Goh
    //   Texas Instruments Inc.
    //   August 2014
    //   Built with IAR Embedded Workbench V5.60 & Code Composer Studio V6.0
    //*****************************************************************************
    #include "msp430.h"
    
    const unsigned char lcd_num[10] = {
        0xFC,        // 0
        0x60,        // 1
        0xDB,        // 2
        0xF3,        // 3
        0x67,        // 4
        0xB7,        // 5
        0xBF,        // 6
        0xE0,        // 7
        0xFF,        // 8
        0xF7,        // 9
    };
    
    int main(void)
    {
        WDTCTL = WDTPW | WDTHOLD;               // Stop WDT
    
        PJSEL0 = BIT4 | BIT5;                   // For LFXT
    
        //set all pins output low for low power
        P1OUT = 0;
        P1DIR = 0xFF;
        P2OUT = 0;
        P2DIR = 0xFF;
        P3OUT = 0;
        P3DIR = 0xFF;
        P4OUT = 0;
        P4DIR = 0xFF;
        P5OUT = 0;
        P5DIR = 0xFF;
        P6OUT = 0;
        P6DIR = 0xFF;
        P7OUT = 0;
        P7DIR = 0xFF;
        P8OUT = 0;
        P8DIR = 0xFF;
        P9OUT = 0;
        P9DIR = 0xFF;
        P10OUT = 0;
        P10DIR = 0x03;
    
        //Initialize LCD segments 0 - 21; 26 - 43
        //this will override the GPIO DIR and OUT setting for these pins (see datasheet)
        LCDCPCTL0 = 0xFFFF;
        LCDCPCTL1 = 0xFC3F;
        LCDCPCTL2 = 0x0FFF;
    
        // Disable the GPIO power-on default high-impedance mode
        // to activate previously configured port settings
        PM5CTL0 &= ~LOCKLPM5;
    
        // Configure LFXT 32kHz crystal
        CSCTL0_H = CSKEY >> 8;                  // Unlock CS registers
        CSCTL4 &= ~LFXTOFF;                     // Enable LFXT
        do
        {
          CSCTL5 &= ~LFXTOFFG;                  // Clear LFXT fault flag
          SFRIFG1 &= ~OFIFG;
        }while (SFRIFG1 & OFIFG);               // Test oscillator fault flag
        CSCTL0_H = 0;                           // Lock CS registers
    
        // Initialize LCD_C
        // ACLK, Divider = 1, Pre-divider = 16; 4-pin MUX
        LCDCCTL0 = LCDDIV__1 | LCDPRE__16 | LCD4MUX | LCDLP;
    
        // VLCD generated internally,
        // V2-V4 generated internally, v5 to ground
        // Set VLCD voltage to 2.60v
        // Enable charge pump and select internal reference for it
        LCDCVCTL = VLCD_1 | VLCDREF_0 | LCDCPEN;
    
        LCDCCPCTL = LCDCPCLKSYNC;               // Clock synchronization enabled
    
        LCDCMEMCTL = LCDCLRM;                   // Clear LCD memory
    
        // Display "4" on Segment 8,9
        LCDM5 = lcd_num[4];
    
        // Display "3" on " on Segment 12,13
        LCDM7 = lcd_num[3];
    
        // Display "0" on " on Segment 16,17
        LCDM9 = lcd_num[0];
    
        //Turn LCD on
        LCDCCTL0 |= LCDON;
    
        __delay_cycles(10000);
    
        //uncomment to test with LCD off!
    /*    LCDCCTL0 &= ~LCDON; //turn off LCD
        // disable all LCD segments
        //when you do this, GPIO DIR and OUT settings will then take effect instead
        LCDCPCTL0 = 0;
        LCDCPCTL1 = 0;
        LCDCPCTL2 = 0;*/
    
        __bis_SR_register(LPM3_bits | GIE);
        __no_operation();
    
        return 0;
    }
    

    This is modified from our msp430fr69xx_lcdc_01.c example. First, run it with the LCD on (leave the sections in the code commented out), then I uncomment the commented-out marked sections and run with LCD off. I see better current consumption with the LCD off in this case.

    Here's what I had to do in addition to setting LCDON bit to 0: I had to take the pins for the LCD and set them back to GPIO mode (do this by setting LCDCPCTLx registers all to 0). At this point the GPIO port settings in the PxDIR and PxOUT registers will take effect on these pins. In both the commented/uncommented code, I set all pins to output low for low power. So when I clear the LCDCPCTLx registers after turning off the LCD, the GPIO for the LCD pins revert to output low as set by the PxDIR and PxOUT registers.

    I think that the reason you were seeing higher current before was due to not terminating the LCD pins when the LCD was turned off. Hopefully this helps.

    Regards,

    Katie

  • Hi Katie-san

    Thank you very much.I understand.

    Best Regards,

    Kozo

**Attention** This is a public forum