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/MSP430F4152: Segment LCD Interface Example Program

Part Number: MSP430F4152
Other Parts Discussed in Thread: MSP-EXP430FR4133

Tool/software: Code Composer Studio

Hi,

I want to interface MSP430F4152 with Segment LCD.Segment LCD is New for me .

I have seen below Application Note and Code from MSP430 Book.

http://www.ti.com/lit/an/slaa654a/slaa654a.pdf?&ts=1590147546767


// Reference from BOOK // MSP430 Microcontroller Basics // John H. Davies // //---------------------------------------------------------------------- #include <io430xG46x.h> // Specific device #include <intrinsics.h> // Intrinsic functions #include <stdint.h> // Integers of defined sizes //---------------------------------------------------------------------- #define LCDMEMS 11 // LCD memories used (3-13) // Pointer to LCD memory used: allows use of array LCDMem[] uint8_t * const LCDMem = (uint8_t *) &LCDM3; //---------------------------------------------------------------------- // Function prototypes void InitLCD (void); //---------------------------------------------------------------------- void main (void) { int i, j; // Loop counters enum {up, down} direction; // Direction of Johnson counter WDTCTL = WDTPW|WDTHOLD; // Stop watchdog timer P2OUT = BIT2; // LED1 (P2.2) on, LED2 (P2.1) off P2DIR = BIT1|BIT2; // Set pins with LEDs to output InitLCD(); // Initialize SBLCDA4 TACCR0 = 0x1000; // Upper limit of count for TAR TACCTL0 = CCIE; // Enable Compare 0 interrupts TACTL = MC_1| TASSEL_1 | TACLR; // Set up and start Timer A // "Up to CCR0" mode, no clock division, clock from ACLK, clear timer direction = up; // Start Johnson counter up for (;;) { // Loop forever for (i = 0; i < LCDMEMS; ++i) { // Count through LCD memories for (j = 0; j < 8; ++j) { // Count through bits __low_power_mode_3(); // LPM3 provides delay if (direction == up) { // Shift left, insert 1 on right LCDMem[i] = (LCDMem[i] << 1) | BIT0; } else { // Shift left, insert 0 (default) LCDMem[i] = (LCDMem[i] << 1); } } __low_power_mode_3(); // extra delays after each character __low_power_mode_3(); } if (direction == up) { // Reverse direction after all chars direction = down; } else { direction = up; } } } //---------------------------------------------------------------------- // Initialize SBLCDA4 //---------------------------------------------------------------------- void InitLCD (void) { int i; for(i = 0; i < LCDMEMS; ++i) { // Clear LCD memory used LCDMem[i] = 0; } P5SEL = BIT4 | BIT3 | BIT2; // Select COM[3:1] function LCDAPCTL0 = LCDS4|LCDS8|LCDS12|LCDS16|LCDS20|LCDS24; // Enable LCD segs 4-27 (4-25 used) LCDAVCTL0 = 0; // No charge pump, everything internal LCDACTL = LCDFREQ_128 | LCD4MUX | LCDSON | LCDON; } // ACLK/128, 4mux, segments on, LCD_A on //---------------------------------------------------------------------- // Interrupt service routine for Timer A channel 0 // Processor returns to "calling routine" in active mode //---------------------------------------------------------------------- #pragma vector = TIMERA0_VECTOR __interrupt void TIMERA0_ISR (void) { P2OUT ^= BIT1|BIT2; // Toggle LEDs __low_power_mode_off_on_exit(); // Restore Active Mode on return }

From where i can download Segmented LCD Demo code like for below application with Digits , Symbols , Up an Down  etc.?

How do I write the waveform pattern in code/program  to display on Segmented LCD?

Thankyou 

--

Karan

  • Is that photo your LCD? Do you have a data sheet for it and/or for the board it's mounted on?

    Generally, you drive the LCD by writing into LCDM1-LCDM20 (since they're consecutive, you can treat them as an array). But the bytes aren't ASCII, rather each bit corresponds to a segment. To know which one, you need a segment map, something like appnote (SLAA654A) Fig 13 (only larger). That would be in the LCD data sheet.

    The board data sheet would show how the COM pins are wired, and (implicitly) how the multiplexing works. I think there are a few conventions, but you need to figure out the particular one you have.

  • Thanks for update....

    Yes, This is photo of my LCD. But I don't have datsheet right now.

    I think you mean to say that the  data can be sent it to like traditional multiplxed seven segment .

    But How to do configuration for that lcd?

    Which mcu "register" should I right?

    Is there any demo program in 'C' in CCS for that?

    As In figure 13 of suggested application note, how only for

    4 Segment are used... COM1-COM4?

    In this some are highlight as Red, Some are blue while

    other are blank?

    Or as In figure 18 of datasheet , Display "2" In Segment LCD Just writing corresponding #define in LCM5 mcu register.

    ? How Segment recognise that with particular location and data?

    Thanks

    --

    Karan

  • What code did you use to generate the display in the photo? Maybe that's a good start?

    User Guide (SLAU056L) Fig 26-2 shows the mapping from LCDM1 (ff) to pins Sx paired with COMy ("091h" is LCDM1). If your LCD is using COM0-COM3, a 4-mux example appears in User Guide Sec 26.2.9. 

    Appnote Fig 13 is trying to show one example of (Sx,COMy) pairings which light up particular segments. I think the coloring is intended to make the segments easier to pick out in the diagram on the left.

    But Fig 13 only shows one digit; your data sheet should have a table showing the segments for all the digits. As an example, the MSP-EXP430FR4133 Launchpad UG (SLAU595A) describes its LCD screen and connections in Tables 3 and 4.

    It looks like TI doesn't make a MCU+LCD board with the F4152. What board are you using?

  • Hi Karan,

    How about your issue? Do you need our further support?

    Best Regards

    Johnson

**Attention** This is a public forum