www.www
17-05-2011, 18:02
سلام خسته نباشید من با کدویژن زیاد کار نکردم ولی نمیدونم مشکل این برنامه چیه
#include <mega16.h>
#include <stdio.h>
#include <delay.h>
#asm
.equ_lcd_port=0x1B
#endasm
#include <lcd.h>
unsigned char scan_key(void);
unsigned char code[4][4]={{0,4,8,12},{1,5,9,13},{2,6,10,14},{3,7,11,15}} ;
char buffer_lcd[10];
void main(void)
{
{
unsigned char key;
PORTC=0x00;
DDRC=0xf0 ;
lcd_init(16);
lcd_clear();
while (1)
{
key=scan_key();
if(key!=0xff){
lcd_clear();
lcd_gotoxy(0,0);
sprintf(buffer_lcd,"key=%d",key);
lcd_puts(buffer_lcd);
}
}
}
}
//=================
unsigned char scan_key(void);
{
unsigned char i,data,num_key,temp;
num_key = 0xff
temp=0x70;
for(i=0;i<4;i++)
{
PORTC=temp;
delay_ms(5);
data=PINC & 0x0f;
if(data==0x07)
num_key=code[0][i];
if(data==0x0B)
mum_key=code[1][i];
if(data==0x0D)
mum_key=code[2][i];
if(data==0x0E)
mum_key=code[3][i];
temp=((temp=1) | 0x80) & 0xF0;
}
return mum_key;
}
ارورش هم اینه
Error: X.c(57): '{' not expected
هرکاری کردم نشد
از بزرگوارای عزیز خواهش میکنم کمک کنید
#include <mega16.h>
#include <stdio.h>
#include <delay.h>
#asm
.equ_lcd_port=0x1B
#endasm
#include <lcd.h>
unsigned char scan_key(void);
unsigned char code[4][4]={{0,4,8,12},{1,5,9,13},{2,6,10,14},{3,7,11,15}} ;
char buffer_lcd[10];
void main(void)
{
{
unsigned char key;
PORTC=0x00;
DDRC=0xf0 ;
lcd_init(16);
lcd_clear();
while (1)
{
key=scan_key();
if(key!=0xff){
lcd_clear();
lcd_gotoxy(0,0);
sprintf(buffer_lcd,"key=%d",key);
lcd_puts(buffer_lcd);
}
}
}
}
//=================
unsigned char scan_key(void);
{
unsigned char i,data,num_key,temp;
num_key = 0xff
temp=0x70;
for(i=0;i<4;i++)
{
PORTC=temp;
delay_ms(5);
data=PINC & 0x0f;
if(data==0x07)
num_key=code[0][i];
if(data==0x0B)
mum_key=code[1][i];
if(data==0x0D)
mum_key=code[2][i];
if(data==0x0E)
mum_key=code[3][i];
temp=((temp=1) | 0x80) & 0xF0;
}
return mum_key;
}
ارورش هم اینه
Error: X.c(57): '{' not expected
هرکاری کردم نشد
از بزرگوارای عزیز خواهش میکنم کمک کنید