void main(){ SET_BIT(DDRB, 0); ini_lcd(); clr_lcd(); for(;;){ pos_lcd(0,0); put_str_lcd("Press 1. Saria's..."); pos_lcd(1,0); put_str_lcd("Press 2. Mary..."); if (get_key() == 16) { clr_lcd(); pos_lcd(0,2); put_str_lcd("Saria's Song"); pos_lcd(1, 0); put_str_lcd("Press B to stop."); play_song(saria, 85); clr_lcd(); } else if (get_key() == 15) { clr_lcd(); pos_lcd(0,2); put_str_lcd("Mary Had A"); pos_lcd(1, 2); put_str_lcd("Little Lamb"); play_song(mary, 26); clr_lcd(); } wait_avr(50); } }
int main() { int tmren = 0; ini_lcd(); InitADC(); timer1_init(); cli(); CLR_BIT(DDRA, 1); puts_lcd2("I:---- AVG:----"); pos_lcd(1, 0); puts_lcd2("Mi:---- Ma:----"); while(1) { wait_btn(); if(tmren) { cli(); tmren = 0; } else { sei(); tmren = 1; } } }
void LCD(void) { ini_lcd(); clr_lcd(); put_str_lcd("hi"); wait_avr(3000); clr_lcd(); resetLCD(); setDateTime(); }
int main(void){ ini_lcd(); ini_avr(); for(;;) { if(get_key() == 13) // SET DATE { //put_lcd('A'); row = 0; col = 0; clr_lcd(); pos_lcd(0,0); put_str_lcd("MMDDYYYY"); start = 0; pos_lcd(0,0); set_date = 1; set_time = 0; index = 0; } else if(get_key() == 9) // SET TIME { //put_lcd('B'); row = 1; col = 0; clr_lcd(); pos_lcd(1,0); put_str_lcd("HHMMSS"); start = 0; pos_lcd(1,0); set_time = 1; set_date = 0; index = 0; } if (start == 1) { increment(); print(); } else { if(get_key() == 2) { //put_lcd('#'); if (set_date) {setDate();} if (set_time) {setTime();} start = 1; } else if(get_key() == 3){ put_lcd('0'); if(set_date){ date[index] = 0; } else if(set_time){ time[index] = 0; } index++; col++; } else if(get_key() == 4){ //put_lcd('*'); clr_lcd(); col = 0; row = 0; set_time = 0; set_date = 0; start = 1; index = 0; } else if(get_key() == 6){ put_lcd('9'); if(set_date){ date[index] = 9; } else if(set_time){ time[index] = 9; } index++; col++; } else if(get_key() == 7){ put_lcd('8'); if(set_date){ date[index] = 8; } else if(set_time){ time[index] = 8; } index++; col++; } else if(get_key() == 8){ put_lcd('7'); if(set_date){ date[index] = 7; } else if(set_time){ time[index] = 7; } index++; col++; } else if(get_key() == 10){ put_lcd('6'); if(set_date){ date[index] = 6; } else if(set_time){ time[index] = 6; } index++; col++; } else if(get_key() == 11){ put_lcd('5'); if(set_date){ date[index] = 5; } else if(set_time){ time[index] = 5; } index++; col++; } else if(get_key() == 12){ put_lcd('4'); if(set_date){ date[index] = 4; } else if(set_time){ time[index] = 4; } index++; col++; } else if(get_key() == 14){ put_lcd('3'); if(set_date){ date[index] = 3; } else if(set_time){ time[index] = 3; } index++; col++; } else if(get_key() == 15){ put_lcd('2'); if(set_date){ date[index] = 2; } else if(set_time){ time[index] = 2; } index++; col++; } else if(get_key() == 16){ put_lcd('1'); if(set_date){ date[index] = 1; } else if(set_time){ time[index] = 1; } index++; col++; } if (set_time) { if (col > 5) { col = 0; pos_lcd(row, col); } } else if (set_date) { if (col > 7) { col = 0; pos_lcd(row, col); } } } wait_avr(25); } return 0; }
int main(void) { ini_lcd(); clr_lcd(); int ca = 0; int cb = 0; int aa=0; int ab=0; int ma=0; int mb=0; int mina=0; int minb=0; //ADMUX |= 71; //SET_BIT(ADMUX,6); //ADCSRA|=135; //SET_BIT(ADCSRA) //ADMUX=(1<<REFS0); // For Aref=AVcc; SET_BIT(ADMUX,6); //ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); //Prescalar div factor =128 ADCSRA|=135; //wait_avr(50000); //uint8_t ch=ch&0b00000111; //ADMUX|=ch; //ADCSRA|=(1<<ADSC); //ADCSRA|=(1<<ADEN); while(1) { //TODO:: Please write your application code pos_lcd(0,0); sprintf(beg,"A:Start Sampling"); puts_lcd2(beg); pos_lcd(1, 0); sprintf(beg,"B:reset"); puts_lcd2(beg); if(key_pressed(0, 7)) { while(1) { if(key_pressed(1, 7)) { result = 1; max=0; min=9999; average=0; total=0; count=0; clr_lcd(); break; } get_adc(); clr_lcd(); pos_lcd(0, 0); //int a,b; ca = result / 100; cb = result % 100; aa=average/100; ab=average%100; ma=max/100; mb=max%100; mina=min/100; minb=min%100; sprintf(beg,"Cr:%01d.%02d Mx:%01d.%02d",ca,cb,ma,mb);//(adc/1023)*5 puts_lcd2(beg); pos_lcd(1, 0); sprintf(beg,"Avg:%01d.%02d Mn:%01d.%02d",aa,ab,mina,minb); puts_lcd2(beg); wait_avr(500); } } } }