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.

Simple Digital Clock implementation ?

Other Parts Discussed in Thread: MSP430G2553

I have MSP430G2xxx and I wan't to built digital clock on it.

The problem is I can get the current time from function in <time.h> C file header,

But I can't set to current localtime because there's no C API to set date & time.  (the time input value is set from the external input button / GPIO)

Anybody here know how to fix my problem, or I may missing API calls or someting ? Please help..

P.S: sorry my english is bad, english isn't my native language ^^

  • You may find this MSP430 LaunchPad BoosterPack helpful

    The Terminal - 43oh OLED Booster Pack

    It demonstrates a digital clock using a MSP430G2553

  • Thanks, from the link you gave me, I only need part of it's code.

    Now it seems I need to write code that implement tick timer (see below) & re-implement time.h / time.c  so I can fetch the correct  hour/min/day/month/year value from my own customized C library "time.h"



    #pragma vector=TIMER0_A0_VECTOR
    __interrupt void Timer_A (void)
    {
        g_systemCounter++;
     
       // Check if we reached 1 second.
       if (g_systemCounter >=1000)
       {        
          seconds++;
          hseconds = 0;

          if(seconds>=60)
          {
          minutes++;
          seconds = 0;
          }

          if(minutes >=60)
          {
          hours++;
          minutes = 0;
          }
          
          OLED_PrintfSetColumnRow(7,1,LARGE_FONT);
           OLED_Printf("%d%d:%d%d:%d%d", hours/10,
                                                   hours%10,
                                                   minutes/10,
                                                   minutes%10,
                                                   seconds/10,
                                                   seconds%10);       

          // Reset system counter.
          g_systemCounter = 0;
       }
    }



**Attention** This is a public forum