trương trình của em ntn, nhưng nó hiện lỗi là ko tìm thấy tập file (File not found.)
mọi người giúp em cái lỗi này vs
#include <pic16f887.h> [ LỖI Ở ĐOẠN NÀY]
#device *=16 adc=10
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=20m)
#byte port_led7 = 0x06 //port B
#byte scan_led = 0x08 //port D
#byte trisa = 0x85 //tris A
#byte trisb = 0x86 //tris B
#byte trisd = 0x88 //tris D
#bit led1 = scan_led.7
#bit led2 = scan_led.6
#bit led3 = scan_led.5
#bit led4 = scan_led.4
int8 read,dem_ngat;
int8 led_code[13]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x9 0,0xff,0x9c,0xc6};//{0,1,2,3,4,5,6,7,8,9, , *,C}
int8 led_buffer[4];
#int_timer0 void quet_led(void)//sau 5ms thi thay doi led sang
{
set_timer0(6);//cai dat gia tri ban dau cho timer0 ///////////
if(++dem_ngat==3)
{ dem_ngat=0;
port_led7=led_code[10];//tat led
if(led1==0)
{
led1=1;
led2=0;
port_led7=led_buffer[1];
}else
{
if(led2==0)
{
led2=1;
led3=0;
port_led7=led_buffer[2];
}else
{
if(led3==0)
{
led3=1;
led4=0;
port_led7=led_buffer[3];
}else
{
led4=1;
led1=0;
port_led7=led_buffer[0];
}
}
}
}
}
void write_led_buffer(int8 temp)
{
led_buffer[0]=led_code[temp/10];
led_buffer[1]=led_code[temp%10];
led_buffer[2]=led_code[11];
led_buffer[3]=led_code[12];
}
void main()
{
//set tris
trisa=0xff;
trisb=0x0;
trisd=0x0;
//setup timer 0
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_64);
//tan so timer0 = precase/64 set_timer0(6);
//dat gia tri ban dau cho RTC
//setup ADC
setup_adc_ports(AN0);
//chon kenh ADC setup_adc(ADC_CLOCK_INTERNAL);
// delay_ms(50);
// enable_interrupts(global);
//cho phep ngat toan cuc enable_interrupts(int_rtcc);
while(true)
{
read=read_adc();
read=read/2;
delay_ms(200);
write_led_buffer(read);
}
}
mọi người giúp em cái lỗi này vs
#include <pic16f887.h> [ LỖI Ở ĐOẠN NÀY]
#device *=16 adc=10
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=20m)
#byte port_led7 = 0x06 //port B
#byte scan_led = 0x08 //port D
#byte trisa = 0x85 //tris A
#byte trisb = 0x86 //tris B
#byte trisd = 0x88 //tris D
#bit led1 = scan_led.7
#bit led2 = scan_led.6
#bit led3 = scan_led.5
#bit led4 = scan_led.4
int8 read,dem_ngat;
int8 led_code[13]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x9 0,0xff,0x9c,0xc6};//{0,1,2,3,4,5,6,7,8,9, , *,C}
int8 led_buffer[4];
#int_timer0 void quet_led(void)//sau 5ms thi thay doi led sang
{
set_timer0(6);//cai dat gia tri ban dau cho timer0 ///////////
if(++dem_ngat==3)
{ dem_ngat=0;
port_led7=led_code[10];//tat led
if(led1==0)
{
led1=1;
led2=0;
port_led7=led_buffer[1];
}else
{
if(led2==0)
{
led2=1;
led3=0;
port_led7=led_buffer[2];
}else
{
if(led3==0)
{
led3=1;
led4=0;
port_led7=led_buffer[3];
}else
{
led4=1;
led1=0;
port_led7=led_buffer[0];
}
}
}
}
}
void write_led_buffer(int8 temp)
{
led_buffer[0]=led_code[temp/10];
led_buffer[1]=led_code[temp%10];
led_buffer[2]=led_code[11];
led_buffer[3]=led_code[12];
}
void main()
{
//set tris
trisa=0xff;
trisb=0x0;
trisd=0x0;
//setup timer 0
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_64);
//tan so timer0 = precase/64 set_timer0(6);
//dat gia tri ban dau cho RTC
//setup ADC
setup_adc_ports(AN0);
//chon kenh ADC setup_adc(ADC_CLOCK_INTERNAL);
// delay_ms(50);
// enable_interrupts(global);
//cho phep ngat toan cuc enable_interrupts(int_rtcc);
while(true)
{
read=read_adc();
read=read/2;
delay_ms(200);
write_led_buffer(read);
}
}
Comment