Ðề tài: CCS C for PIC16F877A
View Single Post
Old 21-11-2007, 10:06 AM   #350
tungtot_vl
Đệ tử 6 túi
 
tungtot_vl's Avatar
 
Tham gia ngày: Jul 2007
Bài gửi: 154
:
dùng ngắt trên các chân từ rc4 -> rc7 khi chạy thì báo lỗi invalid pri_processor diẻctive.
em thấy trong các ngắt có loại ngắt này nhưng khi khai báo sao nó không hiểu nhỉ.
Code:
#include<16f877a.h>
#fuses NOLVP,NOWDT,PUT,hs,NOPROTECT
#device 16F877*=16 ADC=8
#use delay(clock=20000000)
#use fast_io(a)
#byte porta=0x05
#use fast_io(b)
#byte portb=0x06
#use fast_io(c)
#byte portc=0x07
#use fast_io(d)
#byte portd=0x08
#use fast_io(e)
#byte porte=0x09
#bit ra0 = porta.0
#bit ra1 = porta.1
#bit ra2 = porta.2
#bit rc3 = portc.3
//======================================================
int u,t;
int16 count;
#INT_RC
void interrupt_RC()
{  int8 i,l,x,y;
   portb =0;
   for(i=0;i<24;i++)
      {
         portb = 0xff;         
         delay_ms(1000);
         portb = 0;
         delay_ms(1000);
      }
}



//=====================================================
 void main()
   {

      set_tris_b(0);
      set_tris_a(0);
      set_tris_c(0xff);
      set_tris_e(0);
      set_tris_d(0);
      enable_interrupts(global);
     enable_interrupts(int_RC);
     ext_int_edge(h_TO_l);
     // rc3 = 0;
      while(true)
        {

        }
 }
   //=============================================

thay đổi nội dung bởi: namqn, 21-11-2007 lúc 05:43 PM.
tungtot_vl vẫn chưa có mặt trong diễn đàn