PDA

View Full Version : help lỗi


davekieu
15-09-2011, 12:20 AM
em viết chương trình trong ccs xong build là dính 100 cái lỗi : Expecting an identifier luông không biết là lỗi gì nữa bác nào giúp với
code :
#include <16F877.h>
#fuses HS, NOWDT, NOLVP, NOBROWNOUT, NOPROTECT, NOPUT
#use delay(clock=12000000)
#use Fast_IO(B)
#use Fast_IO(D)
#asm
int dulieuthu=0h;
int bitdo;
void main()
{
set_tris_d(0); // tat ca chan d deu la ngo ra gan led
set_tris_b(1); // b1 la ngo vao con lai la ngo ra
enable_interrupts(INT_EXT); //cho phep ngat ngoai
ext_int_edge(H_to_L);
enable_interrupts(GLOBAL); // ok ngat
while(1)
{
xulydulieu();
xuat(dulieuthu)
delay_ms(200);
}
}
void xuat(n)
{
if (n==0h) output_d(11000000b)
else if(n==01h) output_d(10100100b) //kenh 1
else if(n==02h) output_d(10110000b) //kenh 2
else if(n==03h) output_d(10011001b) //kenh 3
else if(n==04h) output_d(10010010b) //kenh 4
else if(n==05h) output_d(10000010b) //kenh 5
else if(n==06h) output_d(11011000b) //kenh 6
else if(n==07h) output_d(10000000b) //kenh 7
else if(n==08h) output_d(10010000b) //kenh 8
else if(n==09h) output_d(11000000b) //kenh 9
else nop; // do nothing
}


#INT_EXT
void xulydulieu ()
{
int i;
i=1;
while(input(pin_b0)
{
delay_us(200);
i++;
}
if((i<14) && (i>8)); //i*2~24. ~2400us
{
for(i=0;i<8;i++)
{
while(input(PIN_B0));
delay_us(800);
bitdo=input(PIN_B0);
if (bitdo)// bitdo = 1
bit_set(dulieuthu,i)
}
}
}

pstin
16-09-2011, 05:29 PM
Hic, bác davekieu này đúng là cao thủ võ lâm, sai chính tả nhiều quá, 100 lỗi là phải rồi!!!!!!!!!!!!!!.
Sửa lỗi cho bác đuối luôn, chạy hay không là do bác lập trình thôi!!!!!!!!!.
#include <16F877.h>
#fuses HS, NOWDT, NOLVP, NOBROWNOUT, NOPROTECT, NOPUT
#use delay(clock=12000000)
#use Fast_IO(B)
#use Fast_IO(D)

int dulieuthu=0x00;
int bitdo;
Void xulydulieu();
void xuat(n);
void main()
{
set_tris_d(0); // tat ca chan d deu la ngo ra gan led
set_tris_b(1); // b1 la ngo vao con lai la ngo ra
enable_interrupts(INT_EXT); //cho phep ngat ngoai
ext_int_edge(H_to_L);
enable_interrupts(GLOBAL); // ok ngat
while(1)
{
xulydulieu();
xuat(dulieuthu);
delay_ms(200);
}
}
void xuat(n)
{
if(n==0x00) {output_d(0b11000000);}
else if(n==0x01) {output_d(0b10100100);} //kenh 1
else if(n==0x02) {output_d(0b10110000);} //kenh 2
else if(n==0x03) {output_d(0b10011001);} //kenh 3
else if(n==0x04) {output_d(0b10010010);} //kenh 4
else if(n==0x05) {output_d(0b10000010);} //kenh 5
else if(n==0x06) {output_d(0b11011000);} //kenh 6
else if(n==0x07) {output_d(0b10000000);} //kenh 7
else if(n==0x08) {output_d(0b10010000);} //kenh 8
else if(n==0x09) {output_d(0b11000000);} //kenh 9
else {}; // do nothing
}


#INT_EXT
void xulydulieu()
{
int i;
i=1;
while(input(pin_b0))
{
delay_us(200);
i++;
}
if((i<14)&&(i>8)) //i*2~24. ~2400us
{
for(i=0;i<8;i++)
{
while(input(PIN_B0))
{delay_us(800);}
bitdo=input(PIN_B0);
if (bitdo)// bitdo = 1
{bit_set(dulieuthu,i);}
}
}
}