/*
* File: main.c
* Author: Administrator
*
*/
#pragma config FOSC = INTOSC, WDTE = OFF, PWRTE = OFF, MCLRE = ON
#include <xc.h>
void Delay_50us(unsigned int n) {
unsigned char i;
while (n--) {
for (i = 0; i < 104; i++);
}
}
void Delay_ms(unsigned int n) {
while (n--) {
Delay_50us(20);
}
}
void main(void) {
TRISCbits.TRISC0 = 0;
LATCbits.LATC0 = 1;
while (1) {
LATCbits.LATC0 = 0;
Delay_ms(500);
LATCbits.LATC0 = 1;
Delay_ms(500);
}
return;
}
这个程序闪灯不生效
|