//setup(system){ test=showTouchAreas; } // Setup debug output on RS232 port SETUP( RS2 ) { set=1152ND; encode=sr; } // Load font for clock numbers and time/date LIB( fnt_Asc16, "SDHC/asc_16b.fnt" ); LIB( fnt_Asc24, "SDHC/asc_24.fnt" ); LIB( fnt_Asc32, "SDHC/asc_32.fnt" ); LIB( lib_BgImage, "SDHC/colours4.bmp" ); LIB(backg,"SDHC/TimePage.bmp"); //Load Time Edit Background Image File LIB(backg2,"SDHC/AlarPage.bmp"); //Load Alarm Edit Background Image File // Create basic style for page STYLE( st_ClockPage, page ) { back=\\cccccc; image=lib_BgImage; } // Create line styles for hour, minute and second hands STYLE( st_HourHand, draw ) { type=line; maxX=100; maxY=100; width=5; col=darkgoldenrod; } STYLE( st_MinHand, draw ) { type=line; maxX=120; maxY=120; width=3; col=goldenrod; } STYLE( st_SecHand, draw ) { type=line; maxX=120; maxY=120; width=1; col=gold; } // Create circle styles for clock dial and centre STYLE( st_ClockFace, draw ) { type=circle; maxX=272; maxY=272; width=3; back=\\a0444444; col=gold; } STYLE( st_ClockCentre, draw) { type=circle; maxX=15; maxY=15; width=2; back=white; col=darkgoldenrod; } // Create text styles for numbers round clock plus time/date STYLE( st_TimeDateTxt, text ) { font=fnt_Asc32; col=midnightblue; } STYLE( st_TimeDateTxt2, text ) { font=fnt_Asc24; col=black; } STYLE( st_TimeDateTxt3, text ) { font=fnt_Asc16; col=black; } STYLE( st_ClockFaceTxt, text ) { font=fnt_Asc24; col=white; } STYLE(Timestyle, Page) { image=backg;} STYLE(Alarmstyle, Page) { image=backg2;} STYLE(DayStyle, Data) {type=text; length=6; format="d"; } //Day with suffix 0 STYLE(MonthStyle2, Data) {type=text; length=4; format="m"; } //Month Jan-Dec STYLE(YearStyle, Data) {type=text; length=5; format="Y"; } //Full Year STYLE(HourStyle, Data) {type=text; length=3; format="H"; } //24 Hour with zero STYLE(MinuteStyle, Data) {type=text; length=3; format="i"; } //Minutes with zero STYLE(SecondStyle, Data) {type=text; length=3; format="s"; } //Seconds with zero VAR( x, 100, S16 ); VAR( y, 0, S16 ); VAR( angle, 0, S16 ); VAR( b, 0, U16 ); VAR( secs, -1, S16 ); VAR( mins, -1, S16 ); VAR( hours, -1, S16 ); VAR( tv, "", TXT ); VAR( angle2, 0, S16 ); VAR( angle3, 0, S16 ); VAR(years,-1,S16); //Initial Year Value VAR(months,-1,S16); //Initial Month Value VAR(days,-1,S16); //Initial Day Value VAR(yearst,"",TXT); //Year text string VAR(monthst,"",TXT); //Month text string VAR(dayst,"",TXT); //Day text string VAR(hourst,"",TXT); //Hour text string VAR(minst,"",TXT); //Minute text string VAR(secst,"",TXT); //Second text string VAR(DayVar,"",DayStyle); //Create a variable to store the formatted Day string VAR(MonthVar,"",MonthStyle2); //Create a variable to store the formatted Month string VAR(YearVar,"",YearStyle); //Create a variable to store the formatted Year string VAR(HourVar,"",HourStyle); //Create a variable to store the formatted Hour string VAR(MinuteVar,"",MinuteStyle); //Create a variable to store the formatted Minute string VAR(SecondVar,"",SecondStyle); //Create a variable to store the formatted Second string //////////////////// VAR(vmonth,1,U8); VAR(monthptr>"month1",PTR); VAR(month1,"Jan",TXT); VAR(month2,"Feb",TXT); VAR(month3,"Mar",TXT); VAR(month4,"Apr",TXT); VAR(month5,"May",TXT); VAR(month6,"Jun",TXT); VAR(month7,"Jul",TXT); VAR(month8,"Aug",TXT); VAR(month9,"Sep",TXT); VAR(month10,"Oct",TXT); VAR(month11,"Nov",TXT); VAR(month12,"Dec",TXT); /////////////////// //////////////////////////////////////////////////////////// // default date is 00:00:00 01 Jan 2007 //LOAD(RTC,2012,":",01,":",18,":",14,":",22,":",30); //use this line to set up a start up date and time, useful if no touch on display FUNC( fnc_AddClkNums ) // Function to add numbers 1-12 to face of clock { LOAD( hours, 1 ); LOOP( lp_AddNumsToClk, 12 ) { CALC( angle, hours, -30, "*" ); CALC( x, angle, -100, "sin" ); CALC( y, angle, -100, "cos" ); CALC( x, x, 135, "+" ); CALC( y, y, 135, "+" ); LOAD( tv, "txt_ClkNum", hours ); POSN( x, y ); TEXT( tv, hours, st_ClockFaceTxt ); CALC( hours, hours, 1, "+" ); } LOAD( hours, -1 ); } ///////////////////////////Libary and Styles for Alarm and Timers///////////////////// LIB(Alarm,"SDHC/bell.bmp?back=\\ffffff"); LIB(Timer,"SDHC/TimerI.bmp?back=\\ff0101"); LIB(AlarmI,"SDHC/belli3.bmp?back=\\000000"); LIB(TimerI,"SDHC/TimerI2.bmp?back=\\ff0101"); LIB(Butt,"SDHC/button2.bmp?back=\\ffffff"); LIB(Butt2,"SDHC/button3.bmp?back=\\ffffff"); STYLE( st_Alarm2, text ) { font=fnt_Asc16; col=white; curRel=CC; maxLen=64; } STYLE( st_Alarm, text ) { font=fnt_Asc16; col=white; curRel=RC; maxLen=64; } STYLE( st_Alarm3, text ) { font=fnt_Asc16; col=white; curRel=LC; maxLen=64; } STYLE(MyImage,Image){ curRel=CC; } STYLE( CBox, draw ) { type=Box; maxX=480; maxY=272; width=2; back=\\a0444444; col=gold; } STYLE( TimerB, draw ) { type=Box; maxX=480; maxY=272; width=2; col=gold; } ////////////////////////Alarm Routine Page/////////////////////////////////////// VAR(PreRTA,"",TXT); //Variable to store the alarm time VAR(StoreRTA,":::12:00:00",TXT); PAGE( pg_Alarm, st_ClockPage ) //Page that flashes when Alarm goes { POSN(240,135); IMG(Alarm1,Alarm,MyImage); //Image of Bell } LOAD(RTA,":::::"); //Sets the default alarm value to 0 INT(RTAlarmInt,RTA,Flash); //Interupt that Runs Flash function when RTC = RTA FUNC(Flash){SHOW(pg_Alarm);RUN(FlashB);SHOW(pg_Clock);} //Function that shows page to flash Image to act as alarm FUNC(FlashB) //Function to Flash the bell image { HIDE(Alarm1);;WAIT(300);SHOW(Alarm1);;WAIT(500);HIDE(Alarm1);;WAIT(300);SHOW(Alarm1);;WAIT(500); HIDE(Alarm1);;WAIT(300);SHOW(Alarm1);;WAIT(500);HIDE(Alarm1);;WAIT(300);SHOW(Alarm1);;WAIT(500); } //////////////////////////////////////////////////////// //////////////////Timer Routine Page//////////////////// INT(namet,TIMER4,Flash2); //When Timer4 = 0 it runs Flash2 function PAGE( pg_Timer, st_ClockPage ) //Page that flashes when Timer runs out { POSN(240,135); IMG(Timer1I,Timer,MyImage); //Image of Timer } FUNC(Flash2){HIDE(TimerIc); RUN(HideS); SHOW(pg_Timer);RUN(FlashB2);SHOW(pg_Clock);} //Function that shows page to flash Image for Timer FUNC(HideS){HIDE(TSBox1B,TSBox2B,TSBox3B,TimerIc);;} //Function that hides timer selection FUNC(FlashB2) //Function to Flash the Timer image { HIDE(Timer1I);;WAIT(300);SHOW(Timer1I);;WAIT(500);HIDE(Timer1I);;WAIT(300);SHOW(Timer1I);;WAIT(500); HIDE(Timer1I);;WAIT(300);SHOW(Timer1I);;WAIT(500);HIDE(Timer1I);;WAIT(300);SHOW(Timer1I);;WAIT(500); } /////////////////////////////////////////////////// // Create Clock Page PAGE( pg_Clock, st_ClockPage ) { POSN(135,135);DRAW( drw_ClockFace, 250, 250 , st_ClockFace ); //Draw the clock face KEY(edittkey,[RUN(ShowFnc);],250,250,TOUCH); //Add Key to edit time and set date RUN(fnc_AddClkNums); //Function adds the values to the clock face POSN(135,135); DRAW(drw_HourHand,1,1,st_HourHand); //Hour Hand DRAW(drw_MinHand,1,1,st_MinHand); //Minute Hand DRAW(drw_SecHand,1,1,st_SecHand); //Second Hand DRAW(drw_ClockCentre,15,15,st_ClockCentre); //Clock Centre POSN(369,20); TEXT(txt_Date,"",st_TimeDateTxt); //Date in 01 Jan 2007 format POSN(369,50); TEXT(txt_Time,"",st_TimeDateTxt); //Time in 00:00:00 format ////////////////////////////////////Alarm Section//////////////////////////////////////// POSN(447,51); IMG(AlarmIc,AlarmI,MyImage);HIDE(AlarmIc); //Alarm Icon to show alarm status next to time //POSN(369,216); DRAW(ABox,209,32,CBox); POSN(295,201); TEXT(AlarmTi,"ALARM",st_Alarm2); //Alarm details title POSN(387,201); TEXT(AlarmTime,"",st_Alarm3); //Alarm Time POSN(352,201); //DRAW(Box,42,22,CBox); //Alarm Status box IMG(buttoff,Butt,MyImage); POSN(352,201); TEXT(Status,"OFF",st_Alarm2); //Alarm Status KEY(HAlarm,[LOAD(RTA,StoreRTA);RUN(ShowFnc2); SHOW(NAlarm);HIDE(HAlarm);; ],47,42,TOUCH); KEY(NAlarm,[LOAD(PreRTA,":::::");LOAD(RTA,PreRTA);LOAD(AlarmTime, "" );TEXT(Status,"OFF");HIDE(AlarmIc,NAlarm);SHOW(HAlarm);; ],47,42,TOUCH); HIDE(NAlarm); //Hide the turn off alarm button on start up //////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////Countdown Timers Scetion//////////////////////////////////// //POSN(369,250); DRAW(TBox,209,32,CBox); POSN(295,247); TEXT(TimTi,"TIMER",st_Alarm2); //Countdown timer title POSN(289,50); IMG(TimerIc,TimerI,MyImage);HIDE(TimerIc); //Timer icon and cancel timer button KEY(tc1,[LOAD(TIMER4,0);RUN(HideS);],30,30,TOUCH); //Key to cancel timer POSN(352,247);//DRAW(TSBox1,42,22,CBox); //30 Second Timer box IMG(butt1m,Butt,MyImage); TEXT(t1,"1m",st_Alarm2); //30 second timer title KEY(t1k,[LOAD(TIMER4,60000,1);RUN(HideS);SHOW(TSBox1B,TimerIc);;],47,37,TOUCH); //Set timer and select box and show icon IMG(TSBox1B,Butt2,MyImage); HIDE(TSBox1B); POSN(400,247); //DRAW(TSBox2,42,22,CBox); //1 Minute Timer box IMG(butt5m,Butt,MyImage); TEXT(t2,"5m",st_Alarm2); //1 Minute timer title KEY(t2k,[LOAD(TIMER4,300000,1);RUN(HideS);SHOW(TSBox2B,TimerIc);;],47,37,TOUCH); //Set timer and select box and show icon IMG(TSBox2B,Butt2,MyImage); HIDE(TSBox2B); POSN(448,247); //DRAW(TSBox3,42,22,CBox); //5 Minute Timer box IMG(butt10m,Butt,MyImage); TEXT(t3,"10m",st_Alarm2); //5 Minute timer title KEY(t3k,[LOAD(TIMER4,600000,1);RUN(HideS);SHOW(TSBox3B,TimerIc);;],47,37,TOUCH); //Set timer and select box and show icon IMG(TSBox3B,Butt2,MyImage); HIDE(TSBox3B); //////////////////////////////////////////////////////////////////////////////////////////// LOOP( lp_Clock, forever ) { LOAD( angle, RTCSECS ); LOAD( angle2, RTCMINS ); LOAD( angle3, RTCHOURS ); IF( angle <> secs ? fnc_UpdateClk ); } } // Update time on the clock FUNC( fnc_UpdateClk ) { LOAD( secs, angle ); // secs = 0..59 // Update seconds hand. Note, this has not been optimised, so that it makes code easier to follow. CALC( angle, secs, 6, "*" ); // angle = 0..354 (0 deg = 0secs) CALC( angle, angle, 270,"+" ); // angle = 270..624 (270 deg = 0secs) CALC( angle, angle, 360, "%" ); // angle fits within 360 circle CALC( x, angle, 110, "cos" ); CALC( y, angle, 110, "sin" ); IF( angle < 90 ? [ LOAD( st_SecHand.curRel, TL ); ] : [ IF( angle < 180 ? [ LOAD( st_SecHand.curRel, TR ); ] : [ IF( angle < 270 ? [ LOAD( st_SecHand.curRel, BR ); ] : [ LOAD( st_SecHand.currel, BL ); ] ); ] ); ] ); DRAW( drw_SecHand, x, y ); LOAD( txt_Time, %H:i:s%RTC ); LOAD( angle2, RTCMINS ); LOAD( mins, angle2 ); // Update minute hand. Optimised to show minimal code CALC( angle2, mins, -6, "*" ); CALC( x, angle2, 110, "sin" ); CALC( y, angle2, 110, "cos" ); IF( angle2 > -90 ? [ LOAD( st_MinHand.curRel, BL ); ] : [ IF( angle2 > -180 ? [ LOAD( st_MinHand.curRel, TL ); ] : [ IF( angle2 > -270 ? [ LOAD( st_MinHand.curRel, TR ); ] : [ LOAD( st_MinHand.curRel, BR ); ] ); ] ); ] ); DRAW( drw_MinHand, x, y );; LOAD( angle3, RTCHOURS ); LOAD( hours, angle3 ); // Update hour hand - b is used to allow for small increment related to minutes CALC( angle3, hours, 30, "*" ); CALC( b, mins, 2, "/" ); CALC( angle3, angle3, b, "+" ); CALC( angle3, angle3, 270, "+" ); CALC( angle3, angle3, 360, "%" ); CALC( x, angle3, 80, "cos" ); CALC( y, angle3, 80, "sin" ); IF( angle3 < 90 ? [ LOAD( st_HourHand.curRel, TL ); ] : [ IF( angle3 < 180 ? [ LOAD( st_HourHand.curRel, TR ); ] : [ IF( angle3 < 270 ? [ LOAD( st_HourHand.curRel, BR ); ] : [ LOAD( st_HourHand.curRel, BL ); ] ); ] ); ] ); LOAD( txt_Date, %d M Y%RTC ); DRAW( drw_HourHand, x, y );; } PAGE(EditPage,Timestyle) { POSN(239,20); TEXT(TDEdTit,"Time + Date Set Up", st_TimeDateTxt2); POSN(120,56); TEXT(DayT,"Day",st_TimeDateTxt3); //Day heading POSN(120,98); TEXT(DayV,days,st_TimeDateTxt3); //Day value POSN(120,78); KEY(DayPK,[RUN(DayPF);],45,40,TOUCHR); //Key that increases the day POSN(120,124); KEY(DayMK,[RUN(DayMF);],45,40,TOUCHR); //Key that decreases the day POSN(190,56); TEXT(MonthT,"Month",st_TimeDateTxt3); //Month heading POSN(190,98); TEXT(MonthV,"",st_TimeDateTxt3); //Month value POSN(190,78); KEY(MonthPK,[RUN(MonthPF);],45,40,TOUCHR); //Key that increases the month POSN(190,124); KEY(MonthMK,[RUN(MonthMF);],45,40,TOUCHR); //Key that decreases the month POSN(259,56); TEXT(YearT,"Year",st_TimeDateTxt3); //Year heading POSN(259,98); TEXT(YearV,years,st_TimeDateTxt3); //Year value POSN(259,78); KEY(YearPK,[RUN(YearPF);],45,40,TOUCHR); //Key that increases the year POSN(259,124); KEY(YearMK,[RUN(YearMF);],45,40,TOUCHR); //Key that decreases the year POSN(120,156); TEXT(HourT,"Hour",st_TimeDateTxt3); //Hour heading POSN(120,199); TEXT(HourV,hours,st_TimeDateTxt3); //Hour Value POSN(120,179); KEY(HourPK,[RUN(HourPF);],45,40,TOUCHR); //Key that increases the hour POSN(120,226); KEY(HourMK,[RUN(HourMF);],45,40,TOUCHR); //Key that decreases the hour POSN(155,198); TEXT(THMS,":",st_TimeDateTxt2); POSN(190,156); TEXT(MinuteT,"Minute",st_TimeDateTxt3); //Minute heading POSN(190,199); TEXT(MinuteV,mins,st_TimeDateTxt3); //Minute value POSN(190,179); KEY(MinutePK,[RUN(MinutePF);],45,40,TOUCHR); //Key that increase the minute POSN(190,226); KEY(MinuteMK,[RUN(MinuteMF);],45,40,TOUCHR); //Key that decreases the minute POSN(225,198); TEXT(TMSS,":",st_TimeDateTxt2); POSN(259,156); TEXT(SecondT,"Second",st_TimeDateTxt3); //Second heading POSN(259,199); TEXT(SecondV,secs,st_TimeDateTxt3); //Second value POSN(259,179); KEY(SecondPK,[RUN(SecondPF);],45,40,TOUCHR); //Key that incresae the second POSN(259,226); KEY(SecondMK,[RUN(SecondMF);],45,40,TOUCHR); //Key that decreases the second POSN(370,97); TEXT(Confirm,"Save",st_TimeDateTxt3); //Save heading POSN(371,97); KEY(KeyC,[RUN(FDateStr);RUN(UpdateT);],91,44,TOUCH); //Key to pass the values to the RTC and show on clock POSN(370,191); TEXT(Cancel,"Exit",st_TimeDateTxt3); //Exit heading POSN(371,191); KEY(Keycan,[SHOW(pg_Clock);],91,44,TOUCH); //key to return to clock without making changes } FUNC(UpdateT) //Time Loop { LOAD( txt_Time, %H:i:s%RTC ); //Loads RTC Time into text Time format 00:00:00 LOAD( txt_Date, %d M Y%RTC ); //Loads RTC Date into text Date Format 01 Jan 2007 RUN(fnc_UpdateClk); //Should move hands to the correct position before showing clock face SHOW(pg_Clock); //Show Clock page } FUNC(FDateStr) { IF(days<10?[LOAD(dayst,"0",days);]:[LOAD(dayst,days);]); //Formats the day to 2 char if less than 10 and loads into the variable IF(vmonth<10?[LOAD(monthst,"0",vmonth);]:[LOAD(monthst,vmonth);]); //Formats the month to 2 char if less than 10 and loads into the variable LOAD(yearst,years); //Load the Year value into a variable IF(hours<10?[LOAD(hourst,"0",hours);]:[LOAD(hourst,hours);]); //Formats the hour to 2 char if less than 10 and loads into the variable IF(mins<10?[LOAD(minst,"0",mins);]:[LOAD(minst,mins);]); //Formats the minutes to 2 char if less than 10 and loads into the variable IF(secs<10?[LOAD(secst,"0",secs);]:[LOAD(secst,secs);]); //Formats the seconds to 2 char if less than 10 and loads into the variable LOAD(RTC,yearst,":",monthst,":",dayst,":",hourst,":",minst,":",secst); //Loads the RTC with the variables put together } PAGE(EditPage2,Alarmstyle) { POSN(239,20); TEXT(AlEdTit,"Alarm Set Up", st_TimeDateTxt2); POSN(120,85); TEXT(HourT2,"Hour",st_TimeDateTxt3); //Hour heading POSN(120,133); TEXT(HourV2,hours,st_TimeDateTxt3); //Hour Value POSN(120,112); KEY(HourPK2,[RUN(HourPF2);],45,40,TOUCHR); //Key that increases the hour POSN(120,158); KEY(HourMK2,[RUN(HourMF2);],45,40,TOUCHR); //Key that decreases the hour POSN(155,130); TEXT(AHMS,":",st_TimeDateTxt2); POSN(190,85); TEXT(MinuteT2,"Minute",st_TimeDateTxt3); //Minute heading POSN(190,133); TEXT(MinuteV2,mins,st_TimeDateTxt3); //Minute value POSN(190,112); KEY(MinutePK2,[RUN(MinutePF2);],45,40,TOUCHR); //Key that increase the minute POSN(190,158); KEY(MinuteMK2,[RUN(MinuteMF2);],45,40,TOUCHR); //Key that decreases the minute POSN(225,130); TEXT(AMSS,":",st_TimeDateTxt2); POSN(259,85); TEXT(SecondT2,"Second",st_TimeDateTxt3); //Second heading POSN(259,133); TEXT(SecondV2,secs,st_TimeDateTxt3); //Second value POSN(259,112); KEY(SecondPK2,[RUN(SecondPF2);],45,40,TOUCHR); //Key that incresae the second POSN(259,158); KEY(SecondMK2,[RUN(SecondMF2);],45,40,TOUCHR); //Key that decreases the second POSN(370,175); TEXT(Cancel2,"Exit",st_TimeDateTxt3); //Exit heading POSN(371,175); KEY(Keycan2,[TEXT(Status,"OFF");HIDE(NAlarm);SHOW(HAlarm);SHOW(pg_Clock);],91,45,TOUCH); //key to return to clock without making changes POSN(370,94); TEXT(AlarmT3,"Save",st_TimeDateTxt3); //Alarm heading POSN(371,94); KEY(KeyAla,[RUN(FDateStr2);SHOW(pg_Clock);],91,45,TOUCH); //Key to pass values to RTA and show clock page } FUNC(FDateStr2) { IF(days<10?[LOAD(dayst,"0",days);]:[LOAD(dayst,days);]); //Formats the day to 2 char if less than 10 and loads into the variable IF(vmonth<10?[LOAD(monthst,"0",vmonth);]:[LOAD(monthst,vmonth);]); //Formats the month to 2 char if less than 10 and loads into the variable IF(hours<10?[LOAD(hourst,"0",hours);]:[LOAD(hourst,hours);]); //Formats the hour to 2 char if less than 10 and loads into the variable IF(mins<10?[LOAD(minst,"0",mins);]:[LOAD(minst,mins);]); //Formats the minutes to 2 char if less than 10 and loads into the variable IF(secs<10?[LOAD(secst,"0",secs);]:[LOAD(secst,secs);]); //Formats the seconds to 2 char if less than 10 and loads into the variable LOAD(PreRTA,":,:,:",hourst,":",minst,":",secst); //Loads the PreRTA with the time put together LOAD(StoreRTA,":,:,:",hourst,":",minst,":",secst); LOAD(RTA,PreRTA); //Loads the RTA with PreRTA LOAD(AlarmTime, %H:i:s%RTA ); //Loads Time of alarm to show in Alarm Details box TEXT(Status,"ON"); //Sets the Alarm status to ON SHOW(AlarmIc);HIDE(HAlarm);SHOW(NAlarm); //Shows the alarm icon and the button to turn alarm off } //Below functions act as limits to the day, month, year, Hour, minute and second variables FUNC(DayPF) {IF(days<31?[CALC(days,days,1,"+");TEXT(DayV,days);]:[LOAD(days,1);TEXT(DayV,days);]);;} FUNC(DayMF) {IF(days>1?[CALC(days,days,1,"-");TEXT(DayV,days);]:[LOAD(days,31);TEXT(DayV,days);]);;} FUNC(MonthMF) { IF(vmonth=1? [LOAD(vmonth,12);]:[CALC(vmonth,vmonth,1,"-");] ); LOAD(monthptr>"month",vmonth); TEXT(MonthV,monthptr);; } FUNC(MonthPF) { IF(vmonth=12?[LOAD(vmonth,1);]:[CALC(vmonth,vmonth,1,"+");]); LOAD(monthptr>"month",vmonth); TEXT(MonthV,monthptr);; } FUNC(YearPF) {IF(years<2099?[CALC(years,years,1,"+");TEXT(YearV,years);]:[LOAD(years,1900);TEXT(YearV,years);]);;} FUNC(YearMF) {IF(years>1900?[CALC(years,years,1,"-");TEXT(YearV,years);]:[LOAD(years,2099);TEXT(YearV,years);]);;} FUNC(HourPF) {IF(hours<23?[CALC(hours,hours,1,"+");TEXT(HourV,hours);]:[LOAD(hours,0);TEXT(HourV,hours);]);;} FUNC(HourMF) {IF(hours>0?[CALC(hours,hours,1,"-");TEXT(HourV,hours);]:[LOAD(hours,23);TEXT(HourV,hours);]);;} FUNC(MinutePF) {IF(mins<59?[CALC(mins,mins,1,"+");TEXT(MinuteV,mins);]:[LOAD(mins,0);TEXT(MinuteV,mins);]);;} FUNC(MinuteMF) {IF(mins>0?[CALC(mins,mins,1,"-");TEXT(MinuteV,mins);]:[LOAD(mins,59);TEXT(MinuteV,mins);]);;} FUNC(SecondPF) {IF(secs<59?[CALC(secs,secs,1,"+");TEXT(SecondV,secs);]:[LOAD(secs,0);TEXT(SecondV,secs);]);;} FUNC(SecondMF) {IF(secs>0?[CALC(secs,secs,1,"-");TEXT(SecondV,secs);]:[LOAD(secs,59);TEXT(SecondV,secs);]);;} FUNC(HourPF2) {IF(hours<23?[CALC(hours,hours,1,"+");TEXT(HourV2,hours);]:[LOAD(hours,0);TEXT(HourV2,hours);]);;} FUNC(HourMF2) {IF(hours>0?[CALC(hours,hours,1,"-");TEXT(HourV2,hours);]:[LOAD(hours,23);TEXT(HourV2,hours);]);;} FUNC(MinutePF2) {IF(mins<59?[CALC(mins,mins,1,"+");TEXT(MinuteV2,mins);]:[LOAD(mins,0);TEXT(MinuteV2,mins);]);;} FUNC(MinuteMF2) {IF(mins>0?[CALC(mins,mins,1,"-");TEXT(MinuteV2,mins);]:[LOAD(mins,59);TEXT(MinuteV2,mins);]);;} FUNC(SecondPF2) {IF(secs<59?[CALC(secs,secs,1,"+");TEXT(SecondV2,secs);]:[LOAD(secs,0);TEXT(SecondV2,secs);]);;} FUNC(SecondMF2) {IF(secs>0?[CALC(secs,secs,1,"-");TEXT(SecondV2,secs);]:[LOAD(secs,59);TEXT(SecondV2,secs);]);;} FUNC(ShowFnc) //Shows time and date editor with present times { LOAD(DayVar,RTC); //Loads the Day part of the RTC into the variable LOAD(MonthVar,RTC); //Loads the Month part of the RTC into the variable LOAD(YearVar,RTC); //Loads the Year part of the RTC into the variable LOAD(HourVar,RTC); //Loads the Hour part of the RTC into the variable LOAD(MinuteVar,RTC); //Loads the Minute part of the RTC into the variable LOAD(SecondVar,RTC); //Loads the Seconds part of the RTC into the variable LOAD(days,DayVar); //Load the dayvar(formatted variable) into the days variable LOAD(vmonth,MonthVar); //Load the monthVar(formatted variable) into the months variable LOAD(years,YearVar); //Load the Yearvar(formatted variable) into the years variable LOAD(hours,HourVar); //Load the HourVar(formatted variable) into the hour variable LOAD(mins,MinuteVar); //Load the MinuteVar(formatted variable) into the mins variable LOAD(secs,SecondVar); //Load the SecondVar(formatted variable) into the secs variable LOAD(monthptr>"month",vmonth); TEXT(DayV,days); //Write the days variable into the day box TEXT(MonthV,monthptr); //write the months variable into the month box TEXT(YearV,years); //write the years variable into the year box TEXT(HourV,hours); //write the hours variable into the hour box TEXT(MinuteV,mins); //write the mins variable into the minute box TEXT(SecondV,secs); //write the secs variable into the second box SHOW(EditPage); //Show the editpage } FUNC(ShowFnc2) //Shows time and date editor with present times { LOAD(HourVar,RTA); //Loads the Hour part of the RTC into the variable LOAD(MinuteVar,RTA); //Loads the Minute part of the RTC into the variable LOAD(SecondVar,RTA); //Loads the Seconds part of the RTC into the variable LOAD(hours,HourVar); //Load the HourVar(formatted variable) into the hour variable LOAD(mins,MinuteVar); //Load the MinuteVar(formatted variable) into the mins variable LOAD(secs,SecondVar); //Load the SecondVar(formatted variable) into the secs variable TEXT(HourV2,hours); //write the hours variable into the hour box TEXT(MinuteV2,mins); //write the mins variable into the minute box TEXT(SecondV2,secs); //write the secs variable into the second box SHOW(EditPage2); //Show the editpage } LOAD(monthptr>"month",vmonth); TEXT(MonthV,monthptr); SHOW( pg_Clock );