XC8, PIC16F1827 ve RA7[Çözüldü]

Başlatan mehmet, 06 Temmuz 2015, 03:11:19

mehmet

Bu kodlarda ne hata yapıyorum da RA7 çalışmıyor. Zira
aynı kodları MikroC ile yapınca RA7 çalışıyor... Kafamın
durduğu yer neresi sizce?
// PIC16F1827 Configuration Bit Settings

// 'C' source line config statements

#include <xc.h>

// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.

// CONFIG1
#pragma config FOSC = INTOSC    // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin)
#pragma config WDTE = OFF       // Watchdog Timer Enable (WDT disabled)
#pragma config PWRTE = ON       // Power-up Timer Enable (PWRT enabled)
#pragma config MCLRE = OFF      // MCLR Pin Function Select (MCLR/VPP pin function is digital input)
#pragma config CP = ON          // Flash Program Memory Code Protection (Program memory code protection is enabled)
#pragma config CPD = OFF        // Data Memory Code Protection (Data memory code protection is disabled)
#pragma config BOREN = ON       // Brown-out Reset Enable (Brown-out Reset enabled)
#pragma config CLKOUTEN = OFF   // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
#pragma config IESO = ON        // Internal/External Switchover (Internal/External Switchover mode is enabled)
#pragma config FCMEN = ON       // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled)

// CONFIG2
#pragma config WRT = OFF        // Flash Memory Self-Write Protection (Write protection off)
#pragma config PLLEN = OFF      // PLL Enable (4x PLL disabled)
#pragma config STVREN = ON      // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset)
#pragma config BORV = LO        // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.)
#pragma config LVP = OFF        // Low-Voltage Programming Enable (High-voltage on MCLR/VPP must be used for programming)

#define _XTAL_FREQ      8000000L

void main(void) 
{
      CM1CON0 = 0x00;
      CM2CON0 = 0x00;
      CM2CON1 = 0x00;
      
      ANSELA = 0x00;
      ANSELB = 0x00;
      
      OSCCONbits.SPLLEN  = 0b0;
      OSCCONbits.IRCF3   = 0b1;
      OSCCONbits.IRCF2   = 0b1;
      OSCCONbits.IRCF1   = 0b1;
      OSCCONbits.IRCF0   = 0b0;
      OSCCONbits.SCS0    = 0b0;
      OSCCONbits.SCS1    = 0b0;
      
      PORTA = 0x00;
      TRISA = 0x00;
      
      PORTB = 0x00;
      TRISB = 0xFF;
      
      while(1)
      {
         LATAbits.LATA7 = 0b1;
         __delay_ms(500);
         LATAbits.LATA7 = 0b0;
         __delay_ms(500);
      }
}
Olan olmuştur,
olacak olan da olmuştur.
Olacak bir şey yoktur.
---------------------------------------------
http://www.mehmetbilgi.net.tr

alexsi

Merhaba,
Timer interruptun ne kadar süreli çalışıyor? Bir de Timer'ın kesme oluşturduğu yerde bir portu toggle yap skopla timer periyodun dogru mu ona bak?
Ek olarak ;
çıkış olarak kullandığın portun LATA yıda konfigüre et.
Birde böyle dene derim. 
birde
#pragma config FOSC = INTOSC  internal osc secimi değilmi ?
O zaman
#define _XTAL_FREQ      8000000L nedir ?
OSC ayarların yanlış geldi bana.
http://www.kontrolarge.com/ Bildiklerimiz öğrendiklerimiz kadardır. Ya bilmediklerimiz ..?

mehmet

Hata usburn(Brenner8) linux versiyonundan kaynaklanıyormuş. Aynı programın
MS Win programı veya Pickit3 ile sorunsuz yükleniyor...

Alıntı yapılan: alexsi - 06 Temmuz 2015, 09:05:57
Merhaba,
Timer interruptun ne kadar süreli çalışıyor? Bir de Timer'ın kesme oluşturduğu yerde bir portu toggle yap skopla timer periyodun dogru mu ona bak?
Ek olarak ;
çıkış olarak kullandığın portun LATA yıda konfigüre et.
Birde böyle dene derim. 
birde
#pragma config FOSC = INTOSC  internal osc secimi değilmi ?
O zaman
#define _XTAL_FREQ      8000000L nedir ?
OSC ayarların yanlış geldi bana.
Bu kod aptal bir yak/söndür olayı. İnterrupt vs. yok.
Int osc seçimi.
#pragma config FOSC = INTOSC

__delay_ms(xx) fonksiyonu için frekans tanımlaması.
#define _XTAL_FREQ      8000000L


LATA zaten ilgil satırlarda çıkış olarak tanımlanmış.
Olan olmuştur,
olacak olan da olmuştur.
Olacak bir şey yoktur.
---------------------------------------------
http://www.mehmetbilgi.net.tr