home *** CD-ROM | disk | FTP | other *** search
- void aspetta(unsigned int nvol);
- void aspettabase();
- void timeraspetta(unsigned char np, unsigned char nt);
- void inizializza();
-
- void inizializza()
- {
- TRISB=0; /* porta B: tutti i pin come Output */
- PORTB=0;
- }
-
- void aspettabase()
- {
- unsigned int ib;
- for(ib=0;ib!=0xff;ib++);
- }
-
- void aspetta(unsigned int nvol)
- {
- unsigned int i;
- for(i=0;i<nvol;i++)
- aspettabase();
- }
-
- void timeraspetta(unsigned char np, unsigned char nt)
- {
- unsigned char mask;
- mask=OPTION;
- mask=mask&(0xF8);
- np=np&(0x07);
- mask=mask|np; /* setta il prescaler */
- OPTION=mask;
- TMR0=nt;
- do {
- mask=TMR0;
- }
- while (mask!=0);
- }
-
-
-
-
-