31 lines
1.3 KiB
C
31 lines
1.3 KiB
C
|
|
#ifndef __delay_h__
|
||
|
|
#define __delay_h__
|
||
|
|
|
||
|
|
#define LOOP_BODY 20 //7 //for (iq0 = ms; iq0 > 0; iq0--)
|
||
|
|
#define WDT_CYCLE 0 //19 //clear_WDT();
|
||
|
|
#define LOOP_INIT 1//4 //for (iq1 = LOOP_1MS;
|
||
|
|
#define LOOP_CYCLE 40//14 //6//4 //iq1 > 0; iq1--) // LOOPCNT
|
||
|
|
#define LOOP_JUDGE 5//3 //iq1 > 0;
|
||
|
|
#define LOOP_DEC 1 //iq0--
|
||
|
|
|
||
|
|
#define DELAY_FREQ 55400000//FREQ //4M
|
||
|
|
|
||
|
|
#define US10_CYCLE (DELAY_FREQ/100000) // 10us CYCLE
|
||
|
|
#define TOTAL_CYCLE_10US (US10_CYCLE-LOOP_BODY)
|
||
|
|
#define LOOP_10US (TOTAL_CYCLE_10US/LOOP_CYCLE)
|
||
|
|
#define DELTA_10US (TOTAL_CYCLE_10US-(LOOP_10US*LOOP_CYCLE))
|
||
|
|
|
||
|
|
#define US100_CYCLE (DELAY_FREQ/10000) // 100us CYCLE
|
||
|
|
#define TOTAL_CYCLE_100US (US100_CYCLE-LOOP_BODY)
|
||
|
|
#define LOOP_100US (TOTAL_CYCLE_100US/LOOP_CYCLE)
|
||
|
|
#define DELTA_100US (TOTAL_CYCLE_100US-(LOOP_100US*LOOP_CYCLE))
|
||
|
|
|
||
|
|
#define US1000_CYCLE (DELAY_FREQ/1000) // 100us CYCLE
|
||
|
|
#define TOTAL_CYCLE_1000US (US1000_CYCLE-LOOP_BODY)
|
||
|
|
#define LOOP_1000US (TOTAL_CYCLE_1000US/LOOP_CYCLE)
|
||
|
|
#define DELTA_1000US (TOTAL_CYCLE_1000US-(LOOP_1000US*LOOP_CYCLE))
|
||
|
|
|
||
|
|
void delay_ms(u16 ms);
|
||
|
|
void delay_10us(u16 us);
|
||
|
|
#endif
|