delay.h
Go to the documentation of this file.
1 
42 #ifndef _DELAY_H_
43 #define _DELAY_H_ 1
44 
45 #ifndef XTAL_FREQ
46 //#define XTAL_FREQ 4MHZ ///< Crystal frequency in MHz
47 #define XTAL_FREQ 3686
48 #endif
49 
50 #define MHZ *1000
51 #define KHZ *1
52 
53 #if XTAL_FREQ >= 12MHZ
54 
55 #define DelayUs(x) { unsigned char _dcnt; \
56  _dcnt = (x)*((XTAL_FREQ)/12MHZ); \
57  while(--_dcnt != 0){ \
58  CLRWDT(); continue;} }
59 #else
60 
61 #define DelayUs(x) { unsigned char _dcnt; \
62  _dcnt = (x)/(12MHZ/(XTAL_FREQ))|1; \
63  while(--_dcnt != 0){ \
64  CLRWDT(); continue;} }
65 #endif
66 
67 extern void delay_10us(unsigned char x);
68 extern void delay_ms(long t);
69 extern void DelayMs(unsigned char);
70 
71 #endif
72 /* ***************************************************************[ENDL]**** */
void delay_10us(unsigned char x)
Definition: delay.c:29
void delay_ms(long t)
Definition: delay.c:40
void DelayMs(unsigned char)