Sai ở dòng 130 (missing "(")
- #include <mega16.h>
- #include <delay.h>
- #include <aLCD.h>
- #define KEYPAD_DDR DDRB
- #define KEYPAD_PORT PORTB
- #define KEYPAD_PIN PINB
- unsigned char cot[3]={0xE0, 0xD0, 0xB0};
- unsigned char hang[3]={0x0E, 0x0D, 0x0B};
- unsigned char keypad[3][3]={'7', '8', '9',
- '4', '5', '6',
- '1', '2', '3'};
- unsigned char key;
- unsigned char checkpad();
- //kiemtra keypad================================
- unsigned char checkpad()
- {
- unsigned char i, j, thuhang, thucot;
- for(i=0;i<3;i++){
- thucot=KEYPAD_PIN & 0xF0;
- if(thucot==cot[i])
- for(j=0;j<3;j++){
- thuhang=KEYPAD_PIN & 0x0F;
- if(thuhang=hang[j]) return keypad[j][i];
- };
- };
- };
- ================================
- void main(void)
- {
- PORTA=0x00;
- DDRA=0x00;
- PORTB=0x00;
- DDRB=0x00;
- PORTC=0x00;
- DDRC=0x00;
- PORTD=0x00;
- DDRD=0x00;
- TCCR0=0x00;
- TCNT0=0x00;
- OCR0=0x00;
- TCCR1A=0x00;
- TCCR1B=0x00;
- TCNT1H=0x00;
- TCNT1L=0x00;
- ICR1H=0x00;
- ICR1L=0x00;
- OCR1AH=0x00;
- OCR1AL=0x00;
- OCR1BH=0x00;
- OCR1BL=0x00;
- ASSR=0x00;
- TCCR2=0x00;
- TCNT2=0x00;
- OCR2=0x00;
- MCUCR=0x00;
- MCUCSR=0x00;
- TIMSK=0x00;
- UCSRB=0x00;
- ACSR=0x80;
- SFIOR=0x00;
- ADCSRA=0x00;
- SPCR=0x00;
- TWCR=0x00;
- lcd_init(8);
- KEYPAD_PORT=0X0F;
- KEYPAD_DDR=0XF0;
- init_LCD();
- clr_LCD();
- // nhap gio, phut, ngay, thang, nam=============================
- print_LCD("thu:",3);
- key=checkpad();
- int thu=key;
- if(key)putChar_LCD(key);
- delay_ms(100);
- clr_LCD();
- print_LCD("ngay:",4);
- key=checkpad();
- int ngay=key;
- if(key)putChar_LCD(key);
- delay_ms(100);
- clr_LCD();
- print_LCD("thang:",5);
- key=checkpad();
- int thang=key;
- if(key)putChar_LCD(key);
- delay_ms(100);
- clr_LCD();
- print_LCD("nam:",3);
- key=checkpad();
- int nam=key;
- if(key)putChar_LCD(key);
- delay_ms(100);
- clr_LCD();
- print_LCD("gio:",3);
- key=checkpad();
- int gio=key;
- if(key)putChar_LCD(key);
- delay_ms(100);
- clr_LCD();
- print_LCD("phut:",4);
- key=checkpad();
- int phut=key;
- if(key)putChar_LCD(key);
- delay_ms(100);
- clr_LCD();
- //Hien thi gio len LCD
- move_LCD(1,5);
- sprintf("%d",gio); putChar(':'); sprintf("%d",phut);
- move_LCD(2,2);
- sprintf("T%d",thứ); putChar('/'); sprinf("%đ",ngày); putChar('/'); Sprintf("%đ",tháng); putChar(/); sprintf("%đ",nam);
- //trinh chay dong ho===========================
- while (1)
- {
- for(gio<24){
- for(phut<60){
- for(int giay=0; giay<60;giay++){delay_ms(1000)};
- giay=0;
- move_LCD(1,5);
- sprintf("%d",gio); putChar(':'); sprintf("%d",phut);
- move_LCD(2,2);
- sprintf("T%d",thu); putChar('/'); sprinf("%d",ngay); putChar('/'); Sprintf("%d",thang); putChar(/); sprintf("%d",nam);
- phut++;
- }
- phut=0; //lỗi là missing "("
- gio++;
- move_LCD(1,5);
- sprintf("%d",gio); putChar(':'); sprintf("%d",phut);
- move_LCD(2,2);
- sprintf("T%d",thu); putChar('/'); sprinf("%d",ngay); putChar('/'); Sprintf("%d",thang); putChar(/); sprintf("%d",nam);
- }
- }
- }
Comment