home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s270 / 1.ddi / PCKDD51B.EXE / A_INNER.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-15  |  742 b   |  27 lines

  1. /* File:  a_inner.c */
  2.  
  3. #include <io51.h>    /* MCS-51 SFR & bit definitions */
  4.  
  5. /* external function prototypes (interface specifications) */
  6. extern void    wastetime(void);
  7.  
  8. /* external variables */
  9. extern char        state;    /* 'state' reflects value in ACC (in original demo.asm) */
  10.  
  11. void innerloop( char repeat_cnt )
  12. {
  13.     static char    i;
  14.     
  15.     for ( i = 0;  i < repeat_cnt;  i++ ) {
  16.         wastetime();
  17.         if (read_bit(P1_0_bit))            /* 'CPL P1.0':  */
  18.             clear_bit(P1_0_bit);            /* if P1.0 on,  clear P1.0 */
  19.         else
  20.             set_bit(  P1_0_bit );            /* if P1.0 off, set   P1.0 */
  21.         state = 0;
  22.         if ( read_bit( P1_0_bit ) )
  23.             state = (state) ? 0 : 1;    /* 'CPL A' */
  24.         } /* end of:  for 'i' */
  25.  
  26. } /* end of function:  'innerloop( repeat_cnt )' */
  27.