Simple CloudX M633 Digital Stopwatch CloudX

  • img
Project Details

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

 

Materials

CloudX M633

CloudX SoftCard

LCD Display 16x2

1k ohm

Push Button

Jumper Wire(2)

V3 USB cable

10k ohm

 

 

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 VOpin .

  • 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.

 

CODE:


#include <CloudX\LCD.h> #include <CloudX\stdlib.h> #define START_PAUSE 7 #define RESET 8 #define START 1 #define PAUSE 0 char timer[] = "00:00:00:0"; unsigned char HH, MM, SS, mSS,mscount, RFlag=0; bit OmSF = 0 , S_PFlag=0 ; interrupt TimerOmSD(){ if (INTCONbits.T0IF) { INTCONbits.T0IF = 0; TMR0 += 60; if (mscount++ == 10) { mscount = 0; OmSF = 1; } } } setup(){ //setup here pinMode(START_PAUSE , INPUT); pinMode(RESET , INPUT); LCD_setting(1,2,3,4,5,6); LCD_cmd(clear); LCD_cmd(cursorOff); LCD_writeText(1,1, "CLOUDX STOPWATCH"); loop(){ //Program here if( !readPin (START_PAUSE) ) { if(S_PFlag == START){ delayMs(200); INTCON = 0b00000000; OPTION_REG = 0b00000000; mSS--; } if(S_PFlag == PAUSE && RFlag == 1 ){ delayMs(200); INTCON = 0b11100000; OPTION_REG = 0b00000111; } 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; } 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; } if (OmSF){ OmSF = ~ OmSF; mSS++; if(mSS==10) SS ++; if(SS==60 )MM++; if(MM==60 )HH++; } 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; LCD_writeText(2,2, timer); } }

 

 

 

 

 

 

 

Share this with friends