#ifndef __UTILS_C #define __UTILS_C #include "utils.h" //Should be a good peace greater in the reality void Delay1ms(unsigned int time) { unsigned int i; for(i=0; i> 4) * 10); Result += (((BCDValue & 0x0F00) >> 8) * 100); Result += (((BCDValue & 0xF000) >> 12) * 1000); return(Result); } //convert a intvalue to a BCD-VALUE BCD16 INT2BCD( int INTValue) { BCD16 Result; Result = INTValue % 10; INTValue = INTValue / 10; Result |= ((INTValue % 10) << 4); INTValue = INTValue / 10; Result |= ((INTValue % 10) << 8); INTValue = INTValue / 10; Result |= ((INTValue % 10) << 12); return(Result); } #ifdef MAXMONTHDAYSUSED prog_char maxmonthdays[12] ={31,28,31,30,31,30,31,31,30,31,30,31}; unsigned char get_maxmonthdays( int month, int year ){ unsigned char tmdays; tmdays = PRG_RDB(&maxmonthdays[month - 1]); if( (month == 2 ) && ( ( year & 3 ) == 0 ) ){ //in leap years, February has 29 Days. tmdays++; } return( tmdays ); } #endif #endif