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.

msp-exp430fg4618 working with the LCD - understanding problems

Other Parts Discussed in Thread: MSP430FG4618

Dear Community,

first of all i have to clearify that

1. i am not a native speaker so please forgive any misspelling and wrong grammar

2. i am totally new to uC programming.

As a starter project i bought the msp-exp430fg4618 and downloaded the sample code concerning the LCD. My goal is to understand how the uC has to be programmed to work with the installed LCD. To do so i worked through the given sample code which can be found here http://www.ti.com/tool/msp-exp430fg4618 via the point 'get software'.

I also looked into the documentation of the MSP430FG4618, which is called MSP430x4xx Family UsersGuide (can be found here: http://www.ti.com/lit/pdf/slau056). I will refer to this guide as 'MSPUG' This is where i found quite detailed information about the LCD. I also looked up the data sheet of the installed LCD (http://www.softbaugh.com/downloads/SBLCDA4_Specification.pdf) to which I will refer as 'LCDUG'.

I hope this is enough basic information about my current situation.

Now my questions:

1. Is the following assumption correct?

The MSPUG on Page 749 table 26-2 shows the LCD memory in detail. It shows that LCDM1 can be found in address 091h, LCDM2 on 092h and so on. To my understanding the graphic in MSPUG  p 731 fig 26-1 shows that the LCD memory LCDM1 is equivalent to something called SEG0 which is connected to S0. LCDM2 is connected to S1 and so on. Is this assumption correct?

The following question is somewhat related to question 1.

2. How is the LCD exactly wired to the uC?

MSPUG p. 747 shows connections between segments, pins and lcd memory. For instance: S0 is connected to pin0 and S1 is connected to pin1. Together they are used to program Digit1. The content of Digit1 is specified by the content of address 091h (=LCDM1?). Now my problem: LCDUG p.3 shows the segment mapping of the LCD. To my understanding Digit1 is specified by PIN13 and PIN14 - not PIN0 and PIN1. So if i want to get Digit1 to display an 'F' i would write 0101 to PIN13 and 0001 to PIN14 of the LCD. But how do I get this information to the LCD and what and where do I have to write this information into the memory of the uC? The sample code simply writes 0101 0001 into the adress 093h (I looked into the debugger to find this out) but refering to MSPUG p. 747 this adress should be connected to PIN5/6 so how does this work? I can not seem to understand the exact connection between uC lcd memory addresses and the LCDUG segment mapping. Please enlighten me.

3. How does the segment mapping, which is specified in LCDUG p.3, correspond to the memory usage of the uC?

I looked quite a bit into the sample code and the debugger. When the sample code tests the lcd it tries to show every possible character. The first character to be displayed is a Zero in Digit1. The code writes 5f to address 093h. As a binary code this is 1001 1111. When i check the LCDUG PIN13/14 a Zero should be obtained with a 0101 1111. I simply do not get how this works.

My last question is more general but since its about setting up the communication between lcd and uC i figured it would be best not to start a new thread.

4. Configuration of LCD

The sample file LCD.c configures the COM-Ports whith the following two lines

P5SEL |=(BIT4 | BIT3 | BIT2);
P5DIR |=(BIT4 | BIT3 | BIT2);

The concerning documentation file MSP430xG461x DataSheet ( http://www.ti.com/litv/pdf/slas508i) on page 79 states that after using P5SEL.x = 1 the funtion P5DIR does not care whether its value is 0 or 1, thus the second line is completely useless or am i getting something totally wrong here?

I would be really glad if you could help me out. If I need to provide any further information please feel free to tell me.

With kind regards

Marius

  • Thanks for explaining your current state of information. It helps to locate the problem :)
    If only all people with questions would be so informative...

     1) Your assumption is partially correct. When using the standard toolchains, you don’t need to know the address of LCDM1 (or any other register). Compiler and linker take care of it if you select the proper target device. Just use the symbolic name. However, LCDM1 is not only related to S0. Take a look at the fig. 26-2. Bit 0 of LCDM1 is associated with S0 and COM0. Bit1 with S0 and COM1, bit4 with S1 and COM0 etc. So each LCDMx is for two segments (lower and upper 4 bit) and each of the four bits is for a different multiplex state. LCDM2 is therefore for S2 and S3, not S1.

     2) I think the examples in the MSPUG are a bit specific. If you have a non-multiplexed display, all segments (and 7 of them form a digit, hence the name “7-segment display”) are on one side connected to COM0 and on the other one to individual Sx pins. In theory, you can connect any 7 Sx pins (8, when inlcuding the dot) to the 7 LCD segments. Wiring and programming the LCDMx registers just has to match, to light the segments and form a digit. You need to write to at least 4 and up to 8 LCDMx registers to control all 7(8) segments. However, if you use 4x multiplexing, the LCD might be internally wired in a way that each digit (including the dot) is connected to COM0 top COM3 and two Sx pins. In this case, writing to one LCDMx register is enough to control a digit. Some specialized LCDs have segments that are not part of a digit, but form a whole word. For these, only one bit (and the connection to one Sx pin) is enough to make the word appear. It cannot be changed, of course, only switched on or off, as it is in fact only one segment in the shape of a word. Once again, the mapping is free. Settign a bit in an LCDMx register will light one LCD segment. Which one depends on the wiring. And the other side of the segment has to be connected to the proper COMx signal, depending on multiplex mode (1x, 2x, 4x).

     3) Did you download the EXP430 users guide http://www.ti.com/lit/pdf/slau213 ? At the end, it has the schematics of the board, including the wiring between MSP and LCD. There you can see that the S0 signal of the LCD is connected to P10.5, which is the S4 output of the LCD controller. So all segments are off by 4. Sometimes twisting connections makes the layout easier (else I don’t know why this was done, as the S0-S4 outputs are just used as GPIO, so four other pins could have been used instead, leaving the segment assignment 1:1). But after all, the assignment of MSP output segment signal and LCD input is purely virtual. The software just has to reflect this (which it does, and caused your confusion). (BTW, 0x5f actually is 0101 1111; 1001 1111 would have been 0x9f)

     4) If you look at the port pin schematics in the MSP430FG4618 datasheet, it seems that you’re right, setting P5SEL.x disables the digital input and output. For the LCD output to appear, on some pins, LCDSx needs to be set too (p5.0). On P8 (and P8 and P10), LCDSx is doing both, enabling the Sx output and disabling the digital I/O, P8SEL is not needed here at all. I’m not sure, whether this is an inconsistency in the port pin design or a bug ion the schematics. But in any case you’re right, PxDIR is superfluous. Maybe on other MSPs of the 4x family it isn’t. And the coder has left it there when copying code over.

**Attention** This is a public forum