home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************
-
- FILE
- timeintc.c - timer demo program using time1.c
-
- SYNOPSIS
- masm timeinta /ml;
- cl /Gs /c time1.c
- cl timeintc.c setalarm.c time1 timeinta
-
- REMARKS
- Prints the seconds for 10 seconds. DOS's time keeping function is
- temporarily suspended, but will be restored at the end of the test.
-
- This program sets the PC's system clock to tick at 50 ms intervals,
- 20 interrupts per second through init_tmr().
-
- LAST UPDATE
- 18 January 1988
-
- Copyright(c) 1987-1988 D.M. Auslander and C.H. Tham
-
- ***********************************************************************/
-
- /***********************************************************************
- I M P O R T S
- ***********************************************************************/
-
- #include <stdio.h>
-
- #include "envir.h"
- #include "time1.h"
-
-
- /***********************************************************************
- P R I V A T E D A T A
- ***********************************************************************/
-
- static int tick = 0; /* count of interrupts */
- static int time = 0; /* time in seconds */
- static int flag = 0; /* flag each 1 second period */
-
-
- /***********************************************************************
- R O U T I N E S
- /***********************************************************************
-
- /*----------------------------------------------------------------------
- PROCEDURE
- MAIN
-
- REMARKS
-
- LAST UPDATE
- 17 September 1987
- ----------------------------------------------------------------------*/
-
- main()
- {
-
- init_tmr(50L); /* initialize timer, 50 ms per tick */
-
- while (time < 10) /* not 10 seconds yet */
- {
- settimer(1000L); /* set for 1 second */
-
- while (!timeup()) /* wait */
- ;
-
- printf("%2d\n", ++time); /* print seconds */
- }
-
- rstr_tmr(); /* restore timer system */
-
- }
-
-
-