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/MSP430F4132: MSP430f413 driving Varitronix LCD VIM-878-DP

Expert 1030 points
Part Number: MSP430F4132

Tool/software: Code Composer Studio

Has anyone had any experience here? For some reason I can't fathom, I can only get digits to display if all segments are turned on. For instance, loading 0x01, 0x02, 0x04 or 0x08 into LCDM1 won't display anything, but putting 0x0F in will turn on all 4 segments, D,E,F and CA. I find this puzzling. I'm using the internal charge pump and LCDACTL=0x1D,  LCDAPCTL0=0xff, LCDAPCTL1=0x00, LCDAVCTL0 = 08, and LCDAVCTL1=0x13. Any help gratefully accepted.

  • Hi,

    This sounds like something that could be caused by an issue with the COM signals. Are you using 4-pin MUX (because this is what is used for the LCD) on the MSP430? Other than that, I would need more information to figure out what might be going wrong, such as a code snippet showing how you are initializing everything.

    Regards,
    Nathan
  • Hi Nathan. Do you need all the code or just a part? Here are the relevant bits. Dig[8] is initialised  in InitVars(). I'm away on leave for the next two weeks, but I'll look for your comments when I get back on the 29th.

    #define LO0		0x07
    #define HI0		0x0E
    #define LO1		0x00
    #define HI1		0x06
    #define LO2		0x23
    #define HI2		0x4C
    #define LO3		0x21
    #define HI3		0x4E
    #define LO4		0x24
    #define HI4		0x46
    #define LO5		0x25
    #define HI5		0x4A
    #define LO6		0x27
    #define HI6		0x4A
    #define LO7		0x00
    #define HI7		0x0E
    #define LO8		0x27
    #define HI8		0x4E
    #define LO9		0x24
    #define HI9		0x4E
    
    

    unsigned char Dig[8];                // Varitronix characters [88888888]

    /*
     * main.c
     */
    int main(void) {
    
      WDTCTL = WDTPW | WDTHOLD;				// Stop watchdog timer
      //
      InitOsc();
      InitPorts();
      InitTimers();
      InitRTC();
      InitVars();
      //
      Delay(10);							// Wait for 32kHz to stabilize
      //
      InitLCD();
      //
      __bis_SR_register(GIE);				// Enable all active  interrupts
      //
      while (1) {
    // main loop here
    if ( some condition ) {
    ShowDigits();
    }
    }
    //
    // Enable LCD
    //
    void InitLCD(void) {
      LCDACTL 	= LCDFREQ_32 + LCD4MUX;		// LCDFREQ=1kHz, 4-Mux
      LCDAVCTL1 = VLCD_11;					// Vlcd = 3.2V
      LCDAVCTL0 = LCDCPEN;					// Charge pump enabled
      LCDAPCTL1 = 0x00;						// Turn off segments 32 - 39
      LCDAPCTL0 = 0xff;						// Turn on segments 0 - 31
      LCDACTL  |= LCDON;					// LCDON
      //
      //BTCTL = LCDFREQ_128;				// STK LCD freq = ACLK/128
      //P5SEL = 0xFE;						// Set Rxx and COM pins for LCD
    }
    
    
    /*
     * Show all digits. Called from main()
     */
    void ShowDigits(void) {
      Show7( Dig[7] );
      Show6( Dig[6] );
      Show5( Dig[5] );
      Show4( Dig[4] );
      Show3( Dig[3] );
      Show2( Dig[2] );
      Show1( Dig[1] );
      Show0( Dig[0] );
    }
    
    /*
     * Show digit 7
     */
    void Show7(unsigned char d) {
      LCDM1  = LoSegs( d );
      LCDM16 = HiSegs( d );
    }
    
    
    /*
     * Assign ON/OFF values to segments a,b,c,dp,g,h,m,n
     */
    unsigned char HiSegs(unsigned char d) {
      unsigned char c;
    
      switch ( d ) {
        case 0x00:		// Segments: a,b,c
          c = HI0;
          break;
        case 0x01:		// Segments: b,c
          c = HI1;
          break;
        case 0x02:		// Segments:
          c = HI2;
          break;
        case 0x03:		// Segments:
          c = HI3;
          break;
        case 0x04:		// Segments:
          c = HI4;
          break;
        case 0x05:		// Segments:
          c = HI5;
          break;
        case 0x06:		// Segments:
          c = HI6;
          break;
        case 0x07:		// Segments:
          c = HI7;
          break;
        case 0x08:		// Segments:
          c = HI8;
          break;
        case 0x09:		// Segments:
          c = HI9;
          break;
        default:
          c = 0xff;		// Segments:
      }
      return c;
    }
    
    

  • Hi,

    In your initPorts function (or elsewhere), do you include the following line?:

    P5SEL =BIT4+BIT5+BIT6+BIT7;

    Please make sure that the bit numbers are correct because if not the COM signals will not operate correctly.

    Regards,
    Nathan
  • Actually, no! Is it as simple as that! For the S[n] pins all i did was set the relevant PnDIR bits to outputs, not special function. So should P2, P3, and P4 etc also have their PnSEL bits set? Thanks, H.
  • Hi,

    Setting LCDAPCTL0 should be all you need to do to set the segment pins (which you already do). But you do need to do that for the COM pins. Please give that a try and let me know if it works.

    Regards,
    Nathan
  • Yes, that has worked. I'll tick the 'resolved' box now. Thanks for your help, Nathan.

**Attention** This is a public forum