
B–61863E–1/06
D. EXAMPLES OF PROGRAMSAPPENDIX
491
D When X1000.0 is off, K10.0 is turned on and off every 80 ms
(timer-wait).
D When X1000.0 is on, K10.1 is turned on and off every 160 ms (loop).
/*==============================================================*/
/* time man */
/*==============================================================*/
#include <pmclib.h>
#define K10_0 27264+(10*8)+0
#define K10_1 27264+(10*8)+1
#define X1000_0 12800+0
unsigned long tim ;
void far smpl_tim()
{
unsigned long new_tim ;
unsigned long old_tim ;
for( ; ; )
{
os_show_tim( &tim ) ;
for( ; !pl_membrd( X1000_0 ) ; )
{
tim += 10 ;
os_sync_tim( tim ) ; /* 80ms wait */
pl_membwrt(K10_0,(pl_membrd(K10_0))?0:1); /* K10.0 == ON/OFF */
}
for( ; pl_membrd( X1000_0 ) ; )
{
new_tim = 0 ;
os_set_tim( new_tim, &old_tim ) ;
do{
os_show_tim(&tim) ;
}while( tim < 20 ) ; /* 160ms loop */
pl_membwrt(K10_1,(pl_membrd(K10_1))?0:1); /* K10.1 == ON/OFF */
}
}
}
D.1
TIMER
MANAGEMENT
FUNCTION