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.

How to set P7.0 to high in MSP430F47197

Other Parts Discussed in Thread: MSP430F47197

 p7.0 of MSP430F47197  is connected to one of my LCD's leg that needs to be high to clear the LCD. According to the following page(74) of the datasheet, if I am not mistaken if p7.0 wants to be high as OUTPUT p7DIR must be 1 and P7SEL and LCDS24 must be low (0), right?

But I have no clue if I can choose P7 bits one by one? If I write in C and let's say P7.0 sets to 1 IAR gives me a warning.

How can I set a single bit of Port 7 or other ports to low or high?

  • P7OUT = P7OUT | 0x01; // set bit-0 of P7OUT without changing other bits

    P7SEL = P7SEL & 0xFE; // clear bit-0 of P7SEL without changing other bits

    I do not know where LCDS24 is.

  • Oh shoot! My mind got stuck somewhere else!

    LCDS24 is on the first line of explanation table for p8.0(I/O). You mean I do not need it to connect to the LCD?


    I don't know why the datasheets are not easy to follow!

  • i have never used F4xx with LCD. I did not know what LCDS24 was.

    From the data-sheet and user's guide, it looks like LCDS24 is bit-6 of LCDAPCTL0 and controls the multiplexing of 4 pins. If cleared, P7.0, P7.1, P7.2, and P7.3 all become GPIO pins. If set, those 4 pins become S24, S25, S26, and S27.

    LCDAPCTL0 = LCDAPCTL0 & 0xBF; // clears bit-6 without changing other bits.

    You better check your hardware before you do this. Does your LCD have S24-27? Why do you want to drive P7.0 high? Or, do you mean you what S27 high?

  • old_cow_yellow said:

    i have never used F4xx with LCD. I did not know what LCDS24 was.

    Unfortunately it is not precisely mentioned what that is in datasheet either. But from msp430f47197.h I found the following explanation.

    #define LCDS24              (0x40)    /* LCD Segment 24 to 27 Enable. */

    And as you said it is controlled by LCDAPCTL0_  as follows.


    #define LCDAPCTL0_ (0x00ACu) /* LCD_A Port Control Register 0 */
    DEFC( LCDAPCTL0 , LCDAPCTL0_)
    #define LCDS0 (0x01) /* LCD Segment 0 to 3 Enable. */
    #define LCDS4 (0x02) /* LCD Segment 4 to 7 Enable. */
    #define LCDS8 (0x04) /* LCD Segment 8 to 11 Enable. */
    #define LCDS12 (0x08) /* LCD Segment 12 to 15 Enable. */
    #define LCDS16 (0x10) /* LCD Segment 16 to 19 Enable. */
    #define LCDS20 (0x20) /* LCD Segment 20 to 23 Enable. */
    #define LCDS24 (0x40) /* LCD Segment 24 to 27 Enable. */
    #define LCDS28 (0x80) /* LCD Segment 28 to 31 Enable. */

    Likewise S36 as the following picture depicts.

    My LCD's printouts are as follows.

    P8.2/S17 ==> pin 36 ===> EN LCD 

    P8.1/S18 ==> pin 37 ==> RW LCD 

    P8.0/S19 ==> pin 38 ==> RS LCD (Data or Instruction)

    P7.7/S20 ==> pin 39 ==> DB7 LCD (Data bus)

    P7.6/S21 ==> pin 40 ==> DB6 LCD (Data bus)

    P7.5/S22 ==> pin 41 ==> DB5 LCD (Data bus)

    P7.4/S23 ==> pin 42 ==> DB4 LCD (Data bus)

    P7.3/S24 ==> pin 43 ==> DB3 LCD (Data bus)

    P7.2/S25 ==> pin 44 ==> DB2 LCD (Data bus)

    P7.1/S26 ==> pin 45 ==> DB1 LCD (Data bus)

    P7.0/S27 ==> pin 46 ==> DB0 LCD (Data bus)

    It is said that to clear the LCD I need to set DB0 to 1 and the rest of DBs must be set to 0, RS and RW also to 0.

    But the confusing thing is to use what function according to these two tables on MSP430F?

     Does your LCD have S24-27? Why do you want to drive P7.0 high? Or, do you mean you what S27 high?

    well, this is the thing! I don't know what function do I need to use! S or P(I/O). For sure I need to set the pins to 1.

  • CaEngineer said:
    Unfortunately it is not precisely mentioned what that is in datasheet either.

    LCDS24 is a switch in the LCD module register. As such, its name and function are explained in the users guide, not the datasheet. The users guide contains the definition, the datasheet the implementation details.

    CaEngineer said:
    I don't know what function do I need to use! S or P(I/O). For sure I need to set the pins to 1.

    If you need to set it to a static high output level, then it is GPIO. If it were a segment output, ti wouldn't be static, as LCD segments require AC signals, so COM and Sx pins are constantly toggling, either synchronous (segments off) or inverted (segments on). (of course, the output signal toggle is done by the LCD module, you only have to mark the segment bits to be active or inactive by software)

    You shoudl provide some schematics, so we can see what you really need to do.

**Attention** This is a public forum