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.

MSP430F2274 TO 4 DIGIT 7 SEGMENT LED DISPLAY

Other Parts Discussed in Thread: MSP430F2274, CD4555B

Hi  guys, I'm new in this area and i am desperately need help as i am really stuck here. I'm supposed to display the 4 digits which the first digit of the led showing "1" followed by "2" then "3" and "4". Im supposed to set a timer inside and making it run very fast. So fast that my 4 digit 7 segment display is showing 1,2,3,4 instead of 1|0|0|0 , 0|2|0|0, 0|0|3|0, 0|0|0|4 I need the codings urgently and if can please help me up. thanks a million. Im using msp430f2274 to display the 4 digit 7 segment display. Thank you very much.

  • By the way, my current codings are


    #include "msp430x22x4.h"

    int main( void )
    {
     
      WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer to prevent time out reset
      P2DIR |=0x01; //Set P2.0 to output direction
      P2DIR |=0x02; //Set P2.1 to output direction 
      P2DIR |=0x04; //Set P2.2 to output direction
      P2DIR |=0x08; //Set P2.3 to output direction
      P2DIR |=0x10; //Set P2.4 to output direction
      P4DIR |=0x04; //Set P4.3 to output direction
     
      P2OUT =0x08;
      P4OUT =0x00;
       
     
    }

  • You down't write much abotu your hardware. From what I understand, you have a 4-digit 7 segment display. Well...

    Does it have 1 HEX-to-7segment decoder internally or do you need to access the segments individually? Is the multiplexing done with 4 independent common cathode/anode signals or doe sit have a multiplex input?

    In the most common case, you'll have 4 separate 7-segment displays with 7 individual cathodes (or anodes) wired together across the 4 displays, and one separate anode (or cathode) for each display.

    This means you'll need 11 port signals on the MSP. You code has only 6.

    sean yee said:
      P2DIR |=0x01; //Set P2.0 to output direction
      P2DIR |=0x02; //Set P2.1 to output direction 
      P2DIR |=0x04; //Set P2.2 to output direction
      P2DIR |=0x08; //Set P2.3 to output direction
      P2DIR |=0x10; //Set P2.4 to output direction

    Those can be combined into one: P2DIR |=0x1F

    However, for a 7 segment display, you'll need 7 pins for the data and 4 pins for the multiplex.

    Let's assume P2.0 to P2.6 are for the data and P4.0 to P4.3 are for the multiplexing.

    Port Initialization would be:

    P2OUT=0x7F;
    P4OUT=0x00;
    P2DIR = 0x7F;
    P4DIR = 0x00;

    Then set up the timer.

    TA0CTL = TASSEL_2|MC_1|TACLR;
    TA0CCTL0 = CCIE;
    TA0CCR0 = 9999;

    Assuming a default clock speed of 1MHz (you might need to configure the clock module to get a known clock frequency), this will result in one CCR0 interrupt every 10 ms, so the switching frequency is 100Hz and the display turnaround frequency is 25Hz. A smaller TA0CCR0 value increases the frequency.

    Inside the ISR (TIMERA0_VECTOR) you need to put the following:

    static unsigned char digit = 0;
    P4OUT = 0; // disable the display
    P2OUT = value[digit]; // set the (precalculated) bit combination of the 7 segments for this digit from a (global) array
    P4OUT = 1<<digit;
    digit++;
    if(digit==4)digit=0;

    Of course you'll need to put useful data into a global array 'unsigned char value[4]'.

     

    That's all.

  • ok bro, i have a CD4555b decoder and im using CD4511 ic chip to control the 7 Segments so yeap

**Attention** This is a public forum