Simple CloudX M633 Digital Stopwatch

In this project, we are going to make a version of a digital clock that can keep a record of hours, minutes and seconds, just like a stopwatch on your mobile phone! We are going to use an LCD to display the time

Step 1: Component Needed

  • CloudX M633
  • CloudX SoftCard
  • LCD Display
  • Potentiometer
  • Push Button
  • Bread Board
  • Jumper Wire
  • V3 USB cable
  • 10k

You can get your component here

Step 2: HARDWARE

Step 1: Fix the LCD display in the bread board and connect to the CloudX M633 Board as per the following

  • R/S to pin1
  • ENA to pin2
  • D4 to pin3
  • D5 to pin4
  • D6 to pin5
  • D7 to pin6

Additionally, wire a 10k pot to +5V and GND, with it's wiper (output) to LCD screens VO pin .

  • connect Vss and K to GND
  • connect Vdd and A to +5v
  • connect R/W to to GND

N.B: A is Anode, K is Cathode

Step 2:

  • Fix the first push button(Start and Stop) in the bread board and connect the first leg to 10k and Pin7 of the CloudX Board and the other leg to GND.
  • Fix the Second push button(reset) in the breadBoard and connect the first leg to 10k and pin8 of the CloudX Board and the other leg to GND.

Step 3: CODING

Copy this code to your CloudX IDE

<p>#include <CloudX/M633.h><br>#include <CloudX/Lcd.h>
#include <Cloudx/stdlib.h></p><p>#define START_PAUSE 7
#define RESET 8
#define START 1
#define PAUSE 0</p><p>char timer[] = "00:00:00:0";
unsigned char HH, MM, SS, mSS,mscount, RFlag=0;
bit OmSF=0 , S_PFlag=0   ;</p><p>interrupt TimerOmSD(){</p><p>    if (INTCONbits.T0IF) {
      INTCONbits.T0IF = 0;
      TMR0 += 60;
      if (mscount++ == 10) {
      mscount = 0;
      OmSF = 1;
    }
   }
    
}</p><p>setup(){
//setup here</p><p>            pinMode(START_PAUSE , INPUT);
            pinMode(RESET , INPUT);  
            lcdSetting (1,2,3,4,5,6);
            lcdCmd(clear);
            lcdCmd(cursorOff);
            lcdWriteText(1,1, "CLOUDX STOPWATCH");</p><p>loop(){
//Program here</p><p>if( !readPin(START_PAUSE) ) {
         if(S_PFlag == START){
            delayMs(200);
            INTCON =     0b00000000;
            OPTION_REG = 0b00000000;
            mSS--;
            }</p><p>         if(S_PFlag == PAUSE && RFlag == 1 ){
            delayMs(200);
            INTCON =     0b11100000;
            OPTION_REG = 0b00000111;
            }</p><p>            if(S_PFlag == PAUSE && RFlag == 0 ){
            delayMs(200);
            INTCON =     0b11100000;
            OPTION_REG = 0b00000111;
            TMR0 += 60;
            mscount=0;
            OmSF = 0;
            }
     
            S_PFlag = ~S_PFlag;
            RFlag = 1;
            }</p><p>            if( !readPin(RESET) ){
            delayMs(200);
            HH = 0;
            MM = 0;
            SS = 0;
            mSS = 0;
            INTCON =     0b00000000;
            OPTION_REG = 0b00000000;
            mscount=0;
            OmSF = 0;
            RFlag = 0;
            S_PFlag = PAUSE;</p><p>            }</p><p>           if (OmSF){
                OmSF = ~ OmSF;
                mSS++;
                if(mSS==10) SS ++;
                if(SS==60 )MM++;
                if(MM==60 )HH++;
                }</p><p>            
            if(HH==100) HH=0;
            if(MM==60) MM=0;
            if(SS==60) SS=0;
            if(mSS==10) mSS=0;
            timer[1] = (HH%10) +48; timer[0] = (HH/10) +48;
            timer[4] = (MM%10) +48; timer[3] = (MM/10) +48;
            timer[7] = (SS%10) +48; timer[6] = (SS/10) +48;
            timer[9] = mSS +48;
            lcdWriteText(2,2, timer);</p><p>        }
}</p>

Step 4:

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Plastics Contest

      Plastics Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018

    Discussions