//文字列をスクロール表示、構造体で方向および速度を設定する void lcd_scroll(SCROLL_FACTORY settings) { int i; for (;;) { //画面を塗りつぶす(残像防止) lcd_cursor(0, 0); for (i = 0; i < 32; i++) { lcd_printch(' '); if (i == 15) { lcd_cursor(0, 1); } } lcd_print_with_position(settings.string, settings.x, settings.y); //方向設定に従って座標を更新 settings.x += settings.direction; //改行の判断、座標の変更 if (settings.x >= 16 || settings.x < 0) { if (settings.y == 0) { settings.y = 1; } else { settings.y = 0; } if (settings.direction == LEFT) { settings.x = 15; } else { settings.x = 0; } } wait1ms(settings.speed); } }
uint8_t menu_edit_month(uint8_t m) { for (;;) { lcd_locate(3, 0); menu_print_month(m); lcd_locate(3, 0); set_busy_led(true); lcd_cursor(true); for (;;) { if (get_key_autorepeat(KEY_PREV)) { if (m == 0) m = 11; else --m; break; } if (get_key_autorepeat(KEY_NEXT)) { if (m == 11) m = 0; else ++m; break; } if (get_key_press(KEY_SEL)) { set_busy_led(false); lcd_cursor(false); return m; } } } }
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv DO NOT ALTER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv //****************************************************************************** // Call display_results after every generation // // returns TRUE when MAX_TIME is reached or switch is pressed // int display_results(uint16 generation) { static uint16 old_seconds; lcd_mode(0); lcd_cursor(4, 1); lcd_printf("%d", generation); // only update when seconds changes if (!seconds) old_seconds = 0; if (seconds != old_seconds) { old_seconds = seconds; printf("/%d", seconds); lcd_cursor(145, 1); printf("%2d", generation / seconds); } // check for max time exceeded if (seconds >= MAX_TIME) { lcd_cursor(50, 80); lcd_printf("\a\b\t%d.%02d", generation / MAX_TIME, generation % MAX_TIME); if (generation < MAX_TIME * 5) { lcd_cursor(30, 30); lcd_printf("\a\b\tTOO SLOW!"); } switches = 0; // clear any pending switches while (!switches); // wait for any switch } return switches; // return switch value }
uint8_t menu_edit_value(uint8_t v, uint8_t min, uint8_t max) { uint8_t x = lcd_x; uint8_t y = lcd_y; lcd_locate(x, y); lcd_cursor(true); set_busy_led(true); for (;;) { lcd_printf("%02d", v); lcd_locate(x, y); for (;;) { if (get_key_autorepeat(KEY_PREV)) { if (v <= min) v = max; else --v; break; } if (get_key_autorepeat(KEY_NEXT)) { if (v >= max) v = min; else ++v; break; } if (get_key_press(KEY_SEL)) { lcd_cursor(false); set_busy_led(false); return v; } } } }
/****************************************************************************** ** Function name: lcd_clear ** ** Descriptions: erase the lcd display ** ** parameters: None ** Returned value: None ** ******************************************************************************/ void lcd_clear(void) { lcd_cursor(0,0); lcd_write(" ", 20); lcd_cursor(1,0); lcd_write(" ", 20); }
//Main Function int main(void) { lcd_port_config(); lcd_init(); unsigned char x; PIR(); while(1) { x = PINL &0xFF; if(x) //switch is not pressed { lcd_cursor(1,1); lcd_string("Human Detected "); } else { lcd_cursor(1,1); lcd_string("Empty Space "); } } }
void main() { unsigned char tag1[] = "4100A352E959"; // This is the valid tag the system is looking for unsigned char *str; rf_init_devices(); while(1) { _delay_ms(50); rf_display(); // read the tag, store it and display str = rf_return(); // get the read tag details into another string lcd_cursor(1,1); lcd_string(str); _delay_ms(100); if(!strcmp(str,tag1)) // compare the required tag with the tag which is read { lcd_cursor(2,1); lcd_string(" Valid Tag"); } else { lcd_cursor(2,1); lcd_string(" invalid tag"); } _delay_ms(100); lcd_wr_command(0x01); } return 0; }
void wait() { lcd_cursor(1, 0); print_string("Listo"); while (!get_btn()); clear_screen(); lcd_cursor(3, 0); print_string("Go"); _delay_ms(200); }
int main() { TIL311 = 0x01; default_interrupts(); serial_start(SERIAL_SAFE); millis_start(); lcd_init(); lcd_puts("Hello from C,\non the 68008!"); beep(700,250); DELAY_MS(50); beep(500,300); DELAY_MS(100); beep(700,500); DELAY_MS(500); play_rtttl(songs[0]); while(true) { TIL311 = 0xCC; DELAY_MS(1000); TIL311 = 0xC0; DELAY_MS(1000); TIL311 = 0xDE; DELAY_MS(1000); TIL311 = 0x00; DELAY_MS(1000); if(serial_available()) { int16_t ch; lcd_clear(); uint8_t c = 0; while ((ch = getc()) != -1) { putc(ch); lcd_data(ch); if (c++ == 15) lcd_cursor(0,1); } } else { lcd_clear(); lcd_puts("Time since boot:"); lcd_cursor(0,1); lcd_printf("%3d.%02d seconds",millis()/1000, (millis()%1000)/10); } } }
//Main function int main(void) { //Initialize value array with 0 int i; for(i=0;i<1000;i++){ val_array[i] = 0; } data_pos = 0; bot_pos = 0; init_devices(); //LCD_Reset_4bit(); lcd_cursor(2,1); lcd_string("DRAWOID"); while(1){ if (bot_pos < data_pos){ lcd_print(1,9,val_array[bot_pos],3); lcd_cursor(1,1); if (mov_array[bot_pos] == 'F'){ lcd_string("F"); move_straight(val_array[bot_pos],1); } else if (mov_array[bot_pos] == 'B'){ lcd_string("B"); move_straight(val_array[bot_pos],0); } else if (mov_array[bot_pos] == 'R'){ lcd_string("R"); turn_right(val_array[bot_pos]); } else if (mov_array[bot_pos] == 'L'){ lcd_string("L"); turn_left(val_array[bot_pos]); } else if (mov_array[bot_pos] == 'U'){ lcd_string("U"); pen_up(); } else if (mov_array[bot_pos] == 'D'){ lcd_string("D"); pen_down(); } bot_pos++; _delay_ms(1000); } } return 0; }
void lcd_putc(char data) { if (data=='\f') { lcd_cursor(0,1); } else if (data=='\n') { lcd_cursor(0,2); } else if (data=='\v') { lcd_cursor(0,3); } else if (data=='\r') { lcd_cursor(0,4); } else if (data=='°') { lcd_data(0xDF); } else if (data=='\x01') { lcd_data(0x00); } else if (data=='\x02') { lcd_data(0x01); } else if (data=='\x03') { lcd_data(0x02); } else if (data=='\x04') { lcd_data(0x03); } else if (data=='\x05') { lcd_data(0x04); } else if (data=='\x06') { lcd_data(0x05); } else if (data=='\x07') { lcd_data(0x06); } else if (data=='\x08') { lcd_data(0x07); } else if (data=='%') { lcd_data(0x25); } else if (data=='|') { lcd_data(0x7C); } else if (data=='µ') { lcd_data(0xE4); } else if (data=='@') { lcd_data(0x40); } else if (data=='ß') { lcd_data(0xE2); } else if (data=='€') { lcd_data(0xE3); } else if (data=='ä' || data=='Ä') { lcd_data(0xE1); } else if (data=='ö' || data=='Ö') { lcd_data(0xEF); } else if (data=='ü' || data=='Ü') { lcd_data(0xF5); } else if (data=='\\') { lcd_data(0b01011100); } else { lcd_data(data); } }
int main(void) { lcd_init(); lcd_cursor(0,0); lcd_printch('K'); lcd_cursor(1,0); lcd_printch('i'); lcd_cursor(2,0); lcd_printch('s'); lcd_cursor(3,0); lcd_printch('a'); lcd_cursor(4,0); lcd_printch('r'); lcd_cursor(5,0); lcd_printch('a'); lcd_cursor(6,0); lcd_printch('z'); lcd_cursor(7,0); lcd_printch('u'); return 0; }
//Main Function int main(void) { init_devices(); lcd_set_4bit(); lcd_init(); while(1) { lcd_cursor(1,3); lcd_string("FIRE BIRD 5"); lcd_cursor(2,1); lcd_string("NEX ROBOTICS IND"); } }
void update_lcd_status() { /*****************************/ /*second line ,debug infomation */ char mode = read_adc_mode(); lcd_cursor(0,1); show_gate(); lcd_puts(" "); show_filter(); if(1==mode){//50R, divid 32 //LCD2004 lcd_cursor(0,3); lcd_puts("MB504 F/32 50R input"); lcd_cursor(0,2); lcd_puts(" "); //LCD1602 lcd_cursor(12,1); lcd_puts("50R"); } if(2==mode){ lcd_cursor(0,3); lcd_puts("preAmp 1Mohm input "); lcd_cursor(0,2); lcd_puts(" "); //LCD1602 lcd_cursor(12,1); lcd_puts("1M "); } if(0==mode){ //L,C meter //LCD1602 lcd_cursor(12,1); lcd_puts("LC "); //LCD2004 lcd_cursor(0,2); if(0==LC_CAL) /* calibration done*/ update_LC(); else LC_calibrate(); } }
void pr_int(int a,int b,uint16_t c,int d) /* get negative values*/ { if (c>32767) { lcd_cursor(a,b); lcd_string("-"); c = 65536 -c; lcd_print(a,b+1,c,d); } else { lcd_cursor(a,b); lcd_string("+"); lcd_print(a,b+1,c,d); } }
void ds1302_test() { char sec; lcd_cursor(0,0); //year/month/date lcd_hex8(0x20); lcd_hex8(ds1302_read(DS1302_YEAR)); lcd_puts("/"); lcd_hex8(ds1302_read(DS1302_MONTH)); lcd_puts("/"); lcd_hex8(ds1302_read(DS1302_DATE)); lcd_puts(" "); /*hour:min*/ sec=ds1302_read(DS1302_SEC); lcd_hex8(ds1302_read(DS1302_HOUR)); if(sec%2) lcd_puts(":"); else lcd_puts(" "); lcd_hex8(ds1302_read(DS1302_MIN)); }
void post_display(unsigned long number) { char mode = read_adc_mode(); if(1==mode){//50R, divid 32 number*=32; } lcd_cursor(0,0); if((number>999)&&(number<999999)){ printLL(number,3,3); lcd_puts("KH"); } if(number>999999){ printLL(number,6,6); //omit xxHz lcd_puts("MH"); } if(number<=999) { printLL(number,0,0); lcd_puts("Hz"); } lcd_puts(" "); lcd_puts(" "); }
void lcd_clear() { char dummy[25]; strcpy(dummy," "); lcd_string(dummy); lcd_cursor(1,1); }
/*! Function used for displaying a number on LCD */ void lcd_num(int x) { if (current_state == 4) { lcd_cursor(2,1); } else if (current_state == 8) { lcd_cursor(1,1); current_state = 0; } current_state++; char cVal[10]; itoa(x,cVal,10); lcd_string(cVal); char a=" "; lcd_wr_char(a); }
void black_line() { L_velocity = VELOCITY_MAX; R_velocity = VELOCITY_MAX; get_vector(); lcd_cursor(1,1); lcd_string("Straight"); forward(); if (Center_white_line > THRESHOLD) { if (Left_white_line > THRESHOLD) L_velocity = VELOCITY_MIN; else if (Right_white_line > THRESHOLD) R_velocity = VELOCITY_MIN; } else { if (Left_white_line > THRESHOLD) L_velocity = 20; else if (Right_white_line > THRESHOLD) R_velocity = 20; } velocity(L_velocity, R_velocity); if (Center_white_line < THRESHOLD && Left_white_line < THRESHOLD && Right_white_line < THRESHOLD) { forward(); stop(); } }
int main ( void ) { _delay_ms(1000); uint8_t cchar[] = {128,138,138,128,145,142,128,128}; lcd_init(); lcd_command(0x28); lcd_cursor(0, 0); lcd_clear(); _delay_ms(200); //lcd_print(cchar, 64); //lcd_command(0x80); //lcd_char(0); lcd_print("ATmega644 QENC Test", line0); DDRA = 0; PCICR = 1; PCMSK0 = 3; sei(); while (1) { sprintf(strp, "Count: %ld ", enc); lcd_print(str, line1); sprintf(strp, "Rotations: %ld", enc/2496); lcd_print(str, line2); sprintf(strp, "Dis Gone: %ld", (enc/2496)*7); lcd_print(str, line3); } //lcd_print(" Wright Hobbies ", line2); //lcd_print(" Robotics ", line3); while (1) ; return 0; }
//-------------------------------------------------------****MAIN FUNCTION ****------------------------------------------------ int main() { init_devices(); lcd_set_4bit(); lcd_init(); lcd_cursor(1,1); lcd_string("START"); _delay_ms(rand()); //--*** GRIPPER INITAL POSITION ***--- S2 = 0x73; cli(); timer0_init(); TIMSK |= (1 << OCIE0) | (1 << TOIE0); // timer 0 compare match and overflow interrupt enable sei(); pickup(); while(1) { if( bot_id_set == 1) { init_devices2(); init_grid(); dispersion(); localize(); region_division(); break; } } }
void lcd_print_int(int8_t line_no, int8_t pos_no, int8_t number) { char s[3]; sprintf(s,"%3d",number); lcd_cursor(line_no,pos_no); lcd_string(s); }
int main(void) { init_devices(); lcd_set_4bit(); lcd_init(); lcd_cursor(1,5); lcd_string("HI"); lcd_print(2,1,read,3); while(1) { //white line sensing sensor_data_interpretation(); flag=0; if(Center_white_line<0x28) { flag=1; forward(); velocity(150,150); } if((Left_white_line>0x28) && (flag==0)) { flag=1; forward(); velocity(130,50); } if((Right_white_line>0x28) && (flag==0)) { flag=1; forward(); velocity(50,130); } if(Center_white_line>0x28 && Left_white_line>0x28 && Right_white_line>0x28) { forward(); velocity(0,0); } if(count>=6) break; } stop(); read = 0; lcd_init(); //Printing the stored value on lcd after the count value is reached 6. lcd_print(1,1 , store[0][0], 3); lcd_print(1,5 , store[0][1], 3); lcd_print(1,9 , store[0][2], 3); lcd_print(1,13 , store[0][3], 3); lcd_print(2,1 , store[0][4], 3); lcd_print(2,5 , store[0][5], 3); while(1); }
/* * Function Name: main * Input: None * Output: int to inform the caller that the program exited correctly or incorrectly (C code standard) * Logic: calls various functions given in the header file of lcd to display a string on lcd. * Example Call: Called automatically by the Operating System * */ void main (void) { lcd_init(); //initializes the LCD lcd_clear(); //clears screen of LCD lcd_cursor(1,5); //places cursor at 5th column of 2nd row lcd_string("YOUR NAME"); //writes your name on the screen of LCD while(1); } //main ends here
void LC_calibrate() { double L,C; /*to caculate */ static double f0, f1; double C_cal = 950/pow(10,12); //950pF calbrition capcitor if(1==LC_CAL) f0=(double)F; if(2==LC_CAL) f1=(double)F; //C0=C_cal*(f1*f1/(f0*f0-f1*f1) //L0=1/(4*pi*pi*f1*f1(C0+C_cal)) if(3==LC_CAL){ //update result and show the calibration result C0=C_cal*(f1*f1/(f0*f0-f1*f1)); L0=1/(4*pi*pi*f1*f1*(C0+C_cal)); lcd_cursor(0,2); lcd_puts("L:"); L=L0*pow(10,10); /*0.1nH*/ print10L(L,9,4); lcd_puts("uH** "); lcd_cursor(0,3); lcd_puts("C:"); C=C0*pow(10,13); /*0.1 pF*/ print10L(C,8,1); lcd_puts("pF** "); }else{ lcd_cursor(0,2); lcd_puts("CAL:step "); print10L(LC_CAL,1,0); lcd_puts(" "); lcd_cursor(0,3); lcd_puts("F:"); print10L(F,7,0); lcd_puts(" "); } }
void screen_type_paint(Screen *scr, TxProfile *txp) { // lcd_printfxy(5,0, "%-11s", _switch_names[txp->switch_a]); // lcd_printfxy(5,1, "%-11s", _switch_names[txp->switch_b]); lcd_cursor(6,0); lcd_write(_txtype_names[txp->tx_mode & 3]); if (txp->tx_mode != TX_MODE_ACRO) { lcd_printfxy(1,1, "%+04i %+04i %+04i", txp->swash[0], txp->swash[1], txp->swash[2]); } else { lcd_cursor(1,1); lcd_write(" "); } input_cursor(); }
/** \brief Informationen auf LCD ausgeben. */ static void update_lcd(void) { uint8_t wpm; irq_disable(); wpm = capture.wpm; irq_enable(); lcd_cursor(0, 0); lcd_printf("mdec-%d.%d", VERSION_MAJOR, VERSION_MINOR); lcd_cursor(0, 10); lcd_printf("%2d WpM", wpm); lcd_cursor(1, 0); lcd_put_mstr(out.text); lcd_commit(); }
void menu_adjust_brightness(void) { uint8_t i; uint8_t min = 0; uint8_t max = 255; uint8_t res; uint8_t step; lcd_clear(); lcd_puts_P(PSTR("Adjust brightness")); lcd_locate(0, 1); lcd_cursor(false); set_busy_led(true); for (;;) { lcd_locate(0, 1); lcd_putc('['); for (i = 0; i < 18; i++) { lcd_putc(i >= (lcd_brightness / 14) ? ' ' : 0xFF); } lcd_putc(']'); res = lcd_set_brightness(lcd_brightness); if (res) break; for (;;) { step = 10; if (lcd_brightness < 20 || lcd_brightness > 235) step = 1; if (get_key_autorepeat(KEY_PREV)) { if (lcd_brightness <= min) lcd_brightness = max; else lcd_brightness -= step; break; } if (get_key_autorepeat(KEY_NEXT)) { if (lcd_brightness >= max) lcd_brightness = min; else lcd_brightness += step; break; } if (get_key_press(KEY_SEL)) { lcd_cursor(false); set_busy_led(false); menu_ask_store_settings(); return; } } } pwm_error(); }
//Main Function int main(void) { unsigned char x; int flag=1; init_devices(); //Initialize all the devices lcd_set_4bit(); //Set the LCD in 4 bit mode while(1) { x = PINL & (1<< 6); //Read the PL6 pin to read the PIR Sensor output lcd_init(); //Initialize the LCD if(x) //Check if the PL6 pin is HIGH { PORTJ = 0xFF; //Turn ON Bargraph LED if(flag ==1) // A flag has been added to stop the screen from re-initializing every time in the while loop { lcd_init(); lcd_cursor(1,1); } lcd_string("Human Detected"); //Display "Human Detected" on the LCD flag=0; } else { PORTJ = 0x00; //Turn OFF Bargraph LED if(flag==0) { lcd_init(); lcd_cursor(1,1); } lcd_string("Empty Space"); //Display "Empty Space" on the LCD flag=1; } } }