Peak2Peak
Aktif Üye
- Katılım
- 27 Haziran 2020
- Mesajlar
- 291
Kod:
#pragma config FOSC = INTOSCCLK // Oscillator Selection bits (INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/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 // MCLR Pin Function Select bit (MCLR pin function is MCLR)
#pragma config CP = ON // Code Protection bit (Program memory code protection is disabled)
#pragma config CPD = ON // Data Code Protection bit (Data memory code protection is disabled)
#pragma config BOREN = OFF // Brown Out Detect (BOR disabled)
#pragma config IESO = OFF // Internal External Switchover bit (Internal External Switchover mode is enabled)
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is enabled)
#define _XTAL_FREQ 4000000
#include <xc.h>
void main(void)
{
TRISIO=0x02;//input output
while(1)
{
if(GP1==0)
{
GP2=0;
__delay_ms(500);
GP2=1;
__delay_ms(500);
}
else
{
GP2=1;
}
}
}
Kodum bu şekilde gp1 inputunda 4.2 gerilim gözüküyor ama if bloğunun içine giriyor neyde hata yapıyorum.
Last edited by a moderator: