- UID
- 340891
- 性别
- 男
|
#include
#include
/* PORTB definitions */
#define PORTB (*((volatile unsigned char*)(0x0001)))
#define DDRB (*((volatile unsigned char*)(0x0003)))
void deley_100us(void);
void deley_30ms(void);
void main(void) {
DDRB = 0xFF;
PORTB= 0x01;
deley_30ms();
PORTB= 0x02;
deley_30ms();
}
void deley_30ms(void) {
int i;
for(i=0;i<299;i++);
deley_100us();
}
void deley_100us(void) {
int j;
for(j=0;j<50;j++);
asm("nop\n");
|
|