gksldyk
Üye
- Katılım
- 5 Nis 2023
- Mesajlar
- 3
- Puanları
- 1
- Yaş
- 28
Arkadaşlar merhaba pıcte yeni sayılırım size bi sorum olucak yardımlarınızı bekliyorum. Butona basınca ledi yaksın butona basmayınca led sönsün uygulaması yaptım.Proteusta çalışıyor fakat nedense breadboard üzerinde çalıştıramadım. Mclr falan hepsi tamam ama nedeni nedir acaba kodlarım şu şekilde ;
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = ON // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3/PGM pin has PGM function; low-voltage programming enabled)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
#define _XTAL_FREQ 4000000
void main(void) {
TRISB=0x00;
TRISD=0x01;
PORTB=0x00;
while(1) {
if(RD0==1){
PORTB=0x02;
__delay_ms(300);
PORTB=0x00;
__delay_ms(300);
}
if(RD0==0){
PORTB==0x00;
}
}
}
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = ON // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3/PGM pin has PGM function; low-voltage programming enabled)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
#define _XTAL_FREQ 4000000
void main(void) {
TRISB=0x00;
TRISD=0x01;
PORTB=0x00;
while(1) {
if(RD0==1){
PORTB=0x02;
__delay_ms(300);
PORTB=0x00;
__delay_ms(300);
}
if(RD0==0){
PORTB==0x00;
}
}
}