21ic问答首页 - PIC16(L)F1938/9 点灯程序不生效
PIC16(L)F1938/9 点灯程序不生效
小木匠大瓜2024-07-16
/*
* 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;
}
这个程序闪灯不生效
* 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;
}
这个程序闪灯不生效
您需要登录后才可以回复 登录 | 注册