home *** CD-ROM | disk | FTP | other *** search
/ nisttime.carsoncity.k12.mi.us / nisttime.carsoncity.k12.mi.us.tar / nisttime.carsoncity.k12.mi.us / pub / daytime / cnvbcd.c < prev    next >
Text File  |  1996-11-18  |  415b  |  17 lines

  1. char cnvbcd(val)
  2. int val;
  3. {
  4. /*
  5.         this subroutine converts the integer value passed
  6.         in val into two 4-bit BCD digits.  the two digits
  7.         are packed into a byte and are returned by the
  8.         function.  this routine is used to format the
  9.         values for setting the CMOS clock.
  10.  
  11. */
  12. int tendig,unidig;
  13.         tendig=val/10;
  14.         unidig=val - 10*tendig;
  15.         return(16*tendig + unidig);
  16. }
  17.