Rda kesmesi

Benim kullandığım kesme böyle. Kopyalayıp yapıştırarak bir kontrol edin lütfen. Kolay gelsin.



Kod:
#include <18F45k22.h>
#device *=16
#device ADC=10
#fuses NOMCLR,INTRC,PLLEN,WDT256,PROTECT
#use delay(clock=64m,internal=16m,restart_wdt)

//---------------------------PORT ADRES AYARI----------------------------------
#define  SLAVE_ADRES 1
#define  P_BAUD      9600
#define  P_PARITY    N
#define  P_BIT       8
#define  P_STOP      1
//-----------------------------------------------------------------------------
#define  KEYHIT_DELAY  1000 
#use rs232 (baud=BAUDD, xmit=pin_C6, rcv=pin_C7, parity=PARITYY, stop=STOPP,enable=pin_c5,errors,restart_wdt,bits=BITT,timeout=KEYHIT_DELAY)


//=============================================================================
//=========================UART1 HABERLESME KESMESİ============================
#int_rda
void serihaberlesme_kesmesi ()
{
//disable_interrupts(int_rda);
modbus.rx_buffer[modbus.read_counter]=getc(); modbus.read_counter++; 
modbus.time=1;
//enable_interrupts(int_rda);
}
//=============================================================================
//=========================PIC MODBUS INIT=====================================
void modbus_init(void)
{
    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1|RTCC_8_bit);      //51.2 us overflow
    enable_interrupts(INT_TIMER0);
    enable_interrupts(int_rda); 
    setup_adc_ports(sAN0|sAN1|sAN2);
    setup_adc(ADC_CLOCK_DIV_64);
    set_adc_channel(0);     
    enable_interrupts(GLOBAL);
}
//=============================================================================
 
mantık olarak
Benim kullandığım kesme böyle. Kopyalayıp yapıştırarak bir kontrol edin lütfen. Kolay gelsin.



Kod:
#include <18F45k22.h>
#device *=16
#device ADC=10
#fuses NOMCLR,INTRC,PLLEN,WDT256,PROTECT
#use delay(clock=64m,internal=16m,restart_wdt)

//---------------------------PORT ADRES AYARI----------------------------------
#define  SLAVE_ADRES 1
#define  P_BAUD      9600
#define  P_PARITY    N
#define  P_BIT       8
#define  P_STOP      1
//-----------------------------------------------------------------------------
#define  KEYHIT_DELAY  1000
#use rs232 (baud=BAUDD, xmit=pin_C6, rcv=pin_C7, parity=PARITYY, stop=STOPP,enable=pin_c5,errors,restart_wdt,bits=BITT,timeout=KEYHIT_DELAY)


//=============================================================================
//=========================UART1 HABERLESME KESMESİ============================
#int_rda
void serihaberlesme_kesmesi ()
{
//disable_interrupts(int_rda);
modbus.rx_buffer[modbus.read_counter]=getc(); modbus.read_counter++;
modbus.time=1;
//enable_interrupts(int_rda);
}
//=============================================================================
//=========================PIC MODBUS INIT=====================================
void modbus_init(void)
{
    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1|RTCC_8_bit);      //51.2 us overflow
    enable_interrupts(INT_TIMER0);
    enable_interrupts(int_rda);
    setup_adc_ports(sAN0|sAN1|sAN2);
    setup_adc(ADC_CLOCK_DIV_64);
    set_adc_channel(0);    
    enable_interrupts(GLOBAL);
}
//=============================================================================
mantık olarak aynı yazılım sadece getch yerine fgetch kullanıyorum . işlemci otomatik olarak aceba enable işlemini yapamıyor olabilirmi ?
 

Forum istatistikleri

Konular
129,806
Mesajlar
930,282
Kullanıcılar
452,608
Son üye
murat620

Yeni konular

Geri
Üst