This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/MCU/MCU_REAL _FINAL/delay.c
2022-05-19 21:07:52 +08:00

29 lines
No EOL
313 B
C

#include "delay.h"
#include <intrins.h>
void delay100us()
{
unsigned char i, j;
_nop_();
_nop_();
i = 2;
j = 15;
do
{
while (--j);
} while (--i);
}
//void delay(int i)
//{
// int j = i;
// for(;j>0;j--)
// delay100us();
//}
void delay(int n)
{int i, j;
for(i=n;i>0;i--)
for(j = 28; j > 0; j--);
}