12F675 GP4无输出
时间:10-02
整理:3721RD
点击:
请教一下各位
led0 闪烁,led4不亮;去掉led4=1;led0就正常了,
为什么led4不亮?
用的MPLAB X IDE V2.35
#include<pic.h>
#include <xc.h>
#pragma config FOSC = EXTRCCLK // Oscillator Selection bits (RC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-Up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = OFF // GP3/MCLR pin function select (GP3/MCLR pin function is digital I/O, MCLR internally tied to VDD)
#pragma config BOREN = ON // Brown-out Detect Enable bit (BOD enabled)
#pragma config CP = OFF // Code Protection bit (Program Memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
#define led0 GP0
#define led4 GP4
void main()
{
OSCCAL=0x40;
TRISIO=0b00001000;
OPTION_REG=0b00000000;
CMCON=0x07;
INTCON=0x00;
WPU=0;
IOCB=0;
while(1)
{
led0=1;
led4=1;
}
}
请教一下各位
led0 闪烁,led4不亮;去掉led4=1;led0就正常了,
为什么led4不亮?
用的MPLAB X IDE V2.35
#pragma config FOSC = EXTRCCLK 这个有问题 改成#pragma config FOSC = INTRCIO 之后 GP0 GP4都闪烁 恰好相反
没有人用这个吗
谢谢,小编提供的场地。
MICROCHIP 原装正品,另有可替换单片机(无需修改PCB资料,程序可共用PIC的) 有用到的兄弟多多支持! 电话13430885511(微信同号),QQ2355910801
12F675 优势出货哦