home *** CD-ROM | disk | FTP | other *** search
- /* File: a_inner.c */
-
- #include <io51.h> /* MCS-51 SFR & bit definitions */
-
- /* external function prototypes (interface specifications) */
- extern void wastetime(void);
-
- /* external variables */
- extern char state; /* 'state' reflects value in ACC (in original demo.asm) */
-
- void innerloop( char repeat_cnt )
- {
- static char i;
-
- for ( i = 0; i < repeat_cnt; i++ ) {
- wastetime();
- if (read_bit(P1_0_bit)) /* 'CPL P1.0': */
- clear_bit(P1_0_bit); /* if P1.0 on, clear P1.0 */
- else
- set_bit( P1_0_bit ); /* if P1.0 off, set P1.0 */
- state = 0;
- if ( read_bit( P1_0_bit ) )
- state = (state) ? 0 : 1; /* 'CPL A' */
- } /* end of: for 'i' */
-
- } /* end of function: 'innerloop( repeat_cnt )' */
-