#include <htc.h>
#ifndef _XTAL_FREQ
#define _XTAL_FREQ 4000000
#endif
void main(void){
TRISIO = 0xFA;
OSCCON = 0x61; //4MHz Internal OSC
while(1){
__delay_ms(125);__delay_ms(125);__delay_ms(125);__delay_ms(125); //500ms delay
GPIO = 0x04;
__delay_ms(125);__delay_ms(125);__delay_ms(125);__delay_ms(125); //500ms delay
GPIO = 0x00;
}
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
-----------------------------------------------------------------------
include <htc.h>
#ifndef _XTAL_FREQ
#define _XTAL_FREQ 4000000
#endif
__CONFIG(FOSC_INTOSCIO &WDTE_OFF &PWRTE_ON &MCLRE_ON &CP_ON &CPD_ON &BOREN_ON &IESO_OFF &FCMEN_OFF );
void main(void)
{
TRISIO = 0xFA;
OSCCON = 0x60; //4MHz Internal OSC
while(1){
__delay_ms(500); //500ms delay
GPIO = 0x04;
__delay_ms(500); //500ms delay
GPIO = 0x00;
}
}
编译出的hex文件:
点击此处下载 ourdev_675537LFV66A.rar(文件大小:212字节) (原文件名:pulse1hz.rar)
-----------------------------------------------------------------------
多谢兄台拔刀
一周热门 更多>