예제 #1
0
파일: main.c 프로젝트: Andy1978/needler
void update_lcd(void)
{
  if(show_settings_time) //Einstellungen anzeigen
  {
    lcd_clrscr();
    lcd_gotoxy(0,0);
    lcd_puts(font_name);
    char buf[3];
    itoa(font_size,buf,10);
    lcd_puts(buf);
  }
  else //normaler Editor
  {
    lcd_command(LCD_DISP_ON);
    lcd_gotoxy(0,0);
    //_delay_us(30);
    uint8_t x;
    uint8_t cx, cy, vx, vy;
    get_viewport(&vx, &vy);
    get_cursor(&cx, &cy);
    for(x=0;x<LCD_WIDTH;x++)
      lcd_putc(get_text_buffer(vy)[vx+x]);
    for(x=0;x<LCD_WIDTH;x++)
      lcd_putc(get_text_buffer(vy+1)[vx+x]);
    lcd_gotoxy(cx-vx,cy-vy);
    lcd_command(LCD_DISP_ON_CURSOR);
  }
}
예제 #2
0
///////////////////////////////// ENTRY POINT  /////////////////////////////////
int main(void)
{
	char buff[16];
	
	adc_init();
	lcd_init();
	
	for (;;) {                          
		uint16_t sample_acc = 0;
		
		for (int i=0; i<AVG_N_SAMPLES; i++) {
			sample_acc += adc_v_read();
		}
		fmt_voltage(sample_acc, buff);
		lcd_gotoxy(0, 0);
		lcd_print(buff);
		
		sample_acc = 0;
		for (int i=0; i<AVG_N_SAMPLES; i++) {
			sample_acc += adc_a_read();
		}
		fmt_ampere(sample_acc, buff);
		lcd_gotoxy(0, 1);
		lcd_print(buff);
		
		_delay_ms(10);   
    }
}
예제 #3
0
int main(void)
{	      
  int32_t dac_data = 0;
  int8_t inc_dir = 1;
  char buffer[16];
  
	RCC->AHBENR |= RCC_AHBENR_GPIOAEN; 	// enable the clock to GPIOA
	RCC->AHBENR |= RCC_AHBENR_GPIOBEN; 	// enable the clock to GPIOB
	RCC->AHBENR |= RCC_AHBENR_GPIOCEN; 	// enable the clock to GPIOC

	// Put PORTC.8 in output mode
	GPIOC->MODER |= (1 << 16);

	// Put PORTC.9 in output mode
	GPIOC->MODER |= (1 << 18);

	// Put PORTA.0 in input mode
	GPIOA->MODER &= ~(3 << 0);

	// This configures interrupt such that SysTick_Handler is called
	// at ever TIMER_TICK_HZ i.e. 1/1000 = 1ms
	SysTick_Config(SystemCoreClock / TIMER_TICK_HZ);
	
	// Initialize the lcd	
	lcd_init();
  dac_init();
  	  
	lcd_puts("   STM32F051");	
	lcd_gotoxy(1, 4);
	lcd_puts("DAC TEST");  
  delay_ms(2000);
  
  lcd_clear();
  lcd_puts("DAC Value (PA4): ");
  
  // Generate a step wave on DAC output whose amplitude is
  // proportional to the voltage on ADC input.
	while(1)
	{            
    DAC_SetChannel1Data(DAC_Align_8b_R, dac_data);
    DAC_SoftwareTriggerCmd(0, ENABLE);
    dac_data += (10 * inc_dir);
    if(dac_data > 255)
    {
      dac_data = 250;
      inc_dir = -1;
    }
    else if(dac_data < 0)
    {
      dac_data = 0;
      inc_dir = 1;
    }
    
    int_to_str(dac_data, 5, buffer, sizeof(buffer));
    lcd_gotoxy(1, 0);
    lcd_puts(buffer);
    delay_ms(1000);    
	}

}
예제 #4
0
void doLCD(char* s1, char* s2){
	lcd_clrscr();             /* clear screen of lcd */
	lcd_gotoxy(0,0);              /* bring cursor to 0,0 */
	lcd_puts(s1);        /* type something random */
	lcd_gotoxy(0,1);          /* go to 0nd col, 1nd row (or 1, 2 depending on how you count)*/
	lcd_puts(s2);  /* type something random */
}
예제 #5
0
파일: test.c 프로젝트: BrettWTurley/life
int main(void)
{
    /* initialize display, cursor off */
    lcd_init(LCD_DISP_ON);
    lcd_command(LCD_FUNCTION_4BIT_2LINES );
    lcd_clrscr();
    int i = 0;
    lcd_puts_P("   I love you\n");
    lcd_puts_P("     Kelsey");
    char c;
    for(;;++i)
    {
        if(i%2==0) c = 0xDF;
        else c = 0x20;
        lcd_gotoxy(0, 0);
        lcd_putc(c);
        lcd_gotoxy(0, 1);
        lcd_putc(c);
        lcd_gotoxy(15, 0);
        lcd_putc(c);
        lcd_gotoxy(15, 1);
        lcd_putc(c);
        _delay_ms(500);
    }
}
예제 #6
0
파일: ustaw_timer.c 프로젝트: tomjoad/timer
unsigned char godziny(unsigned char pozycja) //ustawianie czasu, wszystkie funkcje podobne.
{
	static unsigned char _godzina=0;
		while(bit_is_clear(pin_klaw,pin_set)&&bit_is_clear(pin_klaw,pin_enter))
			{
				if (bit_is_set(pin_klaw,pin_plus))
					{
						++_godzina;
							if (_godzina==24)
								_godzina=0;
						write_zmienna_czas(_godzina);
						lcd_gotoxy(1,pozycja);
						_delay_ms(120);
						
					}
				if (bit_is_set(pin_klaw,pin_minus))
					{
						--_godzina;
							if (_godzina==255)
									_godzina=24;
						write_zmienna_czas(_godzina);
						lcd_gotoxy(1,pozycja);
						_delay_ms(120);
					}		
			}
		while(bit_is_set(pin_klaw,pin_set))			//odczekanie na puszczenie klawisza set
							
					{
						_delay_ms(200);					
					}
	return _godzina;
}
예제 #7
0
//main function
void main(void)
{
    unsigned char st1[]="STARTING";
    unsigned char st2[]=".";

    //pins for drive LCD
    TRISB = 0x80;

    //Initialize modules
    Init_LCD();
    i2c_config();

    set_ds1307_time(AM,0,0,6);
    set_ds1307_day(8,11,8,13);

    lcd_putstr(st1);

    for(i=0;i<7;i++)
    {
        lcd_putstr(st2);
        Delay1KTCYx(200);
    }
    LCD_CMD(LCD_clear);
    
    while(1)
    {
        lcd_gotoxy(1,1);//hang 1, cot 1.
        Display_time(get_ds1307_time());

        lcd_gotoxy(1,2);//hang 2, cot 1
        Display_day(get_ds1307_day());

        Delay10KTCYx(70);
    };
}
예제 #8
0
void updateDisplay() {
  
  lcd_gotoxy(0,0);
  if (parameters[P_CURRENT_STATE] == STATE_OFF) {
    lcd_puts_p(PSTR("  pSaw Chiller   "));
    lcd_gotoxy(0,1);
    lcd_puts_p(PSTR("    Standby      "));
    return;

  } else if (parameters[P_CURRENT_STATE] == STATE_ON) {
    lcd_puts_p(PSTR(" Chiller online  "));

  } else if (parameters[P_CURRENT_STATE] == STATE_FAN_ON) {
    lcd_puts_p(PSTR("   Running fan   "));

  } else if (parameters[P_CURRENT_STATE] == STATE_WARMUP) {
    lcd_puts_p(PSTR("   Huuuurnggh!   "));

  } else if (parameters[P_CURRENT_STATE] == STATE_COMPRESSOR_ON) {
    lcd_puts_p(PSTR("   Compressing!  "));
  }
  
  lcd_gotoxy(0,1);
  lcd_printf(PSTR("s=%d \xdf" "C o=%d \xdf" "C"),
	     parameters[P_STORE_CURRENT]/10,
	     parameters[P_CIRCULATION_CURRENT]/10);
}
예제 #9
0
void menu_display_main(void)
{
    //    uint8_t i;

    menu_curr = encoder % MENU_LEN; // max menu items
    //if( menu_curr < 0 ) menu_curr = 0;
    if( menu_curr >= MENU_LEN ) menu_curr = MENU_LEN-1;

    menu_shift = menu_curr-1;
    if( menu_curr <= 0 ) menu_shift = 0; // curr is uint, low bound does not work

    //if( menu_shift < 0 ) menu_shift = 0;
    if( menu_shift >= MENU_LEN-2 ) menu_shift = MENU_LEN-3;

    if( ((changed & ~KEY_ENC) == 0) && (menu_curr == menu_curr_old) ) return;
    menu_curr_old = menu_curr;

    lcd_gotoxy( 14, 0 );
    lcd_puts("      "); // Clear tail

    lcd_gotoxy( 0, 0 );
    put_menu_item(menu_shift);
    put_menu_item(menu_shift+1);
    put_menu_item(menu_shift+2);

    lcd_gotoxy( 12, 1 );
    lcd_puts("        "); // Clear tail
    lcd_gotoxy( 0, 1 );
    lcd_puts(">");
    lcd_puts(menu[menu_curr].long_name);
}
예제 #10
0
파일: main.c 프로젝트: naminic/Avr-adc
void main(void)
{
unsigned char init_result[7],lcd_result[10];
double bss;

ADMUX=ADC_VREF_TYPE & 0xff;    
ADCSRA=0x86;          //initiate AD for 125kHz clock, 8 bit result and AREF pin as voltage reference.

lcd_init(16);   //lcd connect to port D and 16 line mode.

while (1)
      {
        bss=read_adc(5);
        bss=bss*(3.3/256);
        
        lcd_clear();
        lcd_gotoxy(0,0);
        lcd_putsf("voltage is:");
        
        ftoa(bss,2,init_result);
        sprintf(lcd_result,"%4s volt.",init_result);
        
        lcd_gotoxy(0,1);
        lcd_puts(lcd_result);
        
        delay_ms(350);
      }
}
예제 #11
0
void menu_display_scan(void)
{
    lcd_gotoxy( 0, 0 );
    lcd_puts("Ok: Rescan 1Wire");
    lcd_gotoxy( 0, 1 );
    init_temperature(); // Prints
}
예제 #12
0
void dsp_setup_coil_pulse(int16 measure, int16 reference_5v, int1 mode)
{
	lcd_gotoxy( 1, 1 );
	printf( lcd_putc, "* Setup pulse time *");
	
	lcd_gotoxy( 1, 2 );
	printf( lcd_putc, "Pul " );
	dsp_range_line( 2, 3, 4, 11, 
				 coil.pulse_length-COIL_MIN_PULSE_LENGTH,
				 COIL_MAX_PULSE_LENGTH-COIL_MIN_PULSE_LENGTH );
	printf(lcd_putc, "%3Luus", coil.pulse_length +
								COIL_PULSE_LENGTH_CORRECTION);
	
	lcd_gotoxy( 1, 3 );
	printf( lcd_putc, "Vol " );
	dsp_prop_strength_bar( 0, 12, measure, COIL_MAX_ADC_VALUE );
	if ( mode == DSP_SHOW_VOLTS ) {
		int16 volts = (measure * 5) / reference_5v;
		if ( volts > 999 ) {
			volts = 999;
		}
		printf(lcd_putc, "%3LuV", volts);
	}
	else {
		printf(lcd_putc, "%4Lu", measure);
	}
	
	lcd_gotoxy( 1, 4 );
	printf(lcd_putc, "5V reference:   %4Lu", reference_5v);
}
예제 #13
0
void print_arrows(uint8_t row)
{
	lcd_gotoxy(0, row);
	lcd_data(0x7F);         // <--
	lcd_gotoxy(15, row);
	lcd_data(0x7E);         // -->
}
예제 #14
0
void menu_display_help(void)
{
    lcd_gotoxy( 14, 0 );    lcd_puts("|  +1 ");
    lcd_gotoxy( 14, 1 );    lcd_puts("|  -1 ");
    lcd_gotoxy( 14, 2 );    lcd_puts("| Save");
    lcd_gotoxy( 14, 3 );    lcd_puts("| Exit");
}
예제 #15
0
void dsp_main_mode( int16 signal, int16 noise_estimation, int16 battery_volts,
					int1 mode )
{
	lcd_gotoxy( 1, 1 );
	printf( lcd_putc, "* Main mode * %5.2wV", battery_volts);
	
	lcd_gotoxy( 1, 2 );
	printf( lcd_putc, "Zer " );
	dsp_range_line( 2, 3, 4, 12, coil.zero, COIL_MAX_ADC_VALUE );
	if ( mode == DSP_SHOW_PERCENT ) {
		signed int8 percent = math_change_range(coil.zero, 
												COIL_MAX_ADC_VALUE, 100);
		dsp_percent( percent );
	}
	else {
		printf(lcd_putc, "%4Ld", coil.zero);
	}
	
	lcd_gotoxy( 1, 3 );
	printf( lcd_putc, "Sig " );
	dis_signal( signal, mode );
	
	lcd_gotoxy( 1, 4 );
	dis_noise( noise_estimation, mode );
}
예제 #16
0
void ini ()
{

   lcd_init(); 
   delay_ms(2);      
   x=1;y=1;
   lcd_gotoxy(x,y);
   printf(lcd_putc,"  Hugo Soares ");
   x=1;y=2;
   lcd_gotoxy(x,y);
   printf(lcd_putc,"**  Apresenta  **");
   delay_ms(2000);
   printf(lcd_putc,"\f" ) ;  
   x=1;y=1;
   lcd_gotoxy(x,y);
   printf(lcd_putc,"  Robot Mentor " ) ;
   x=1;y=2;
   lcd_gotoxy(x,y);
   printf(lcd_putc,"*****************" ) ;
   delay_ms(2000);
   printf(lcd_putc,"\f" ) ;
   x=1;y=1;
   lcd_gotoxy(x,y);

}
예제 #17
0
void menu_display_status(void)
{
    static uint8_t cnt_main_monitor;

    //lcd_clear_line( 1 );

    //lcd_clear_line( 2 );
    lcd_gotoxy( 17, 2 ); lcd_puts("   ");
    lcd_gotoxy( 0, 2 );
    lcd_puts("MQTT/UDP:");
    lcd_puti( mqtt_io_count % 100 ); // Take 2 digits

/*
    lcd_puts(" ModBus:");
    lcd_puti( modbus_event_cnt % 100 ); // Take 2 digits
    lcd_putc( (cnt_main_monitor++ & 1) ? ':' : '.' );
    lcd_puti( (modbus_crc_cnt+modbus_exceptions_cnt) % 100 ); // Take 2 digits
    //lcd_puts("  ");
*/
    //lcd_clear_line( 3 );
    lcd_gotoxy( 16, 3 ); lcd_puts("    ");
    lcd_gotoxy( 0, 3 );
    lcd_puts("EEprom:");
    lcd_putc( ui_marker_unsaved ? '*' : '.' );
    lcd_puts(" 1WErr:");
    lcd_puti( ow_error_cnt % 100 ); // Take 2 digits
    //lcd_puts("  ");

    lcd_gotoxy( 0, 0 );
    lcd_puts("IO Status  ");
}
예제 #18
0
파일: ustaw_timer.c 프로젝트: tomjoad/timer
unsigned char minuty(unsigned char pozycja)
{
	static unsigned char _minuta=0;
		while(bit_is_clear(pin_klaw,pin_set)&&bit_is_clear(pin_klaw,pin_enter))
			{
				if (bit_is_set(pin_klaw,pin_plus))
					{
						++_minuta;
							if (_minuta==60)
								_minuta=0;
						write_zmienna_czas(_minuta);
						lcd_gotoxy(1,pozycja);
						_delay_ms(120);
					
					}
				if (bit_is_set(pin_klaw,pin_minus))
					{
						--_minuta;
							if (_minuta==255)
									_minuta=59;
						write_zmienna_czas(_minuta);
						lcd_gotoxy(1,pozycja);
						_delay_ms(120);

					}

			}
		while(bit_is_set(pin_klaw,pin_set))			//odczekanie na puszczenie klawisza set
							
					{
						_delay_ms(200);					
					}
	return _minuta;
}
예제 #19
0
int main(void)
{
	char serialCharacter;
	
	lcd_init(LCD_DISP_ON);
	lcd_gotoxy(2,0); lcd_puts("Serial");
	lcd_gotoxy(3,1); lcd_puts("LCD");
	
	DDRD |= (1<<PD1);	// habilita o pino PD1 como TXD (output)
	DDRB |= (1<<PB0);	// habilita o LED no pino PB0
	
	PORTB|=(1<<PB0);
	
	initUSART();
	printString("Serial ok:");
	
	PORTB&=~(1<<PB0);
	
    while(1)
    {	PORTB|=(1<<PB0);
        serialCharacter = receiveByte();
		PORTB&=~(1<<PB0);
		lcd_putc(serialCharacter);
    }
}
예제 #20
0
파일: main.c 프로젝트: modyskyline/AVR_LIBS
int main(void)
{

	PORTC=0xFF;
	unsigned char key;
	static FILE mystdout = FDEV_SETUP_STREAM(lcd_printf, NULL, _FDEV_SETUP_WRITE);
	// setup our stdio stream
	stdout = &mystdout;

	keypad_init();
	lcd_init ();
	lcd_gotoxy(1,1);
	printf("keypad");
	lcd_gotoxy(1,2);

	while(1)
	{
		/* the function to get the pressed key*/
		key=key_scan();
		/*important to write only when a key is pressed*/
		//if (key!=0)	printf("%c",key);
		if (key!=0)	PORTC=key_scan();

	}
	return(0);
}
예제 #21
0
파일: main.c 프로젝트: alexpriem/avr
void update_command (void) {

    char buf[30];

	buf[0]=0;
	switch (action) {
		case INACTIVE: strcpy (buf,"waiting");
						break;
		case FILL: strcpy (buf,"filling");
						break;
		case WIND_LEFT: strcpy (buf,"wind left");
						break;
		case WIND_RIGHT: strcpy (buf,"wind right");
						break;
		case CORR: strcpy (buf,"Correct layer");
					if (corrmode==ADD) {strcat (buf,":+");}
					if (corrmode==SUB) {strcat (buf,":-");}
					break;
		case LAYER: strcpy (buf,"Layer");
						break;
	}
#ifdef DEBUG
	uart_puts(buf);
	uart_puts("\r\n");
#endif
	lcd_gotoxy (0,0,0);
	lcd_puts (0,"                     ");
	lcd_gotoxy (0,0,0);
	lcd_puts (0,buf);

}
void Splash() {

	lcd_init();
	
	struct animStep anim[16];
	char name[3];

	lcd_set_char(0,(unsigned char*)Aini0);
	lcd_set_char(1,(unsigned char*)Aini1);
	lcd_set_char(2,(unsigned char*)Aini2);
	lcd_set_char(3,(unsigned char*)Aini3);
	lcd_set_char(4,(unsigned char*)Aini4);
	lcd_set_char(5,(unsigned char*)Aini5);
	lcd_set_char(6,(unsigned char*)Aini6);
	lcd_set_char(7,(unsigned char*)Aini7);

	int animLength = 13; 
	int i;
	
	anim[0]  = createStep(6,8,2);
	anim[1]  = createStep(6,8,2);
	anim[2]  = createStep(0,8,2);
	anim[3]  = createStep(1,8,2);
	anim[4]  = createStep(2,8,2);
	anim[5]  = createStep(3,8,2);
	anim[6]  = createStep(4,9,2);
	anim[7]  = createStep(3,10,2);
	anim[8]  = createStep(4,11,2);
	anim[9]  = createStep(3,12,2);
	anim[10] = createStep(1,12,2);
	anim[11] = createStep(0,12,2);
	anim[12] = createStep(7,12,2);

	name[0] = 'D';
	name[1] = 'L';
	name[2] = 'L';


	for(i = 0; i < animLength; i++) {
		if(i == 6) {
			lcd_gotoxy(i+2,2);
			_lcd_write_byte(5,1);
		}
		else if(i > 6 && i < 10) {
			lcd_gotoxy(i+2,2);
			_lcd_write_byte(6,1);
			lcd_gotoxy(i+2,1);
			_lcd_write_byte(name[i-7],1);
		}
		lcd_gotoxy(anim[i].posx,anim[i].posy);
		_lcd_write_byte(anim[i].sprite,1);
		_delay_ms(100);
	}

	_delay_ms(1000);
	lcd_clear();


}
예제 #23
0
void init_devices(void)
{
    // --------------------------------------------------------------
    // DDR and core CPU init
    // --------------------------------------------------------------

    // stop errant interrupts until set up
    cli();

    MCUCR = 0;
    TIMSK = 0;
    //GICR  = 0x00;

#if HALF_DUPLEX
    HALF_DUPLEX_DDR |= _BV(HALF_DUPLEX_PIN);
#endif

    LED1_DDR |= _BV(LED1);
    LED2_DDR |= _BV(LED2);


    // --------------------------------------------------------------
    // initialize subsystems
    // --------------------------------------------------------------

    lcd_init();
    uart_init();

    adc_init();

#if SERVANT_NPWM > 0
    timer1_init();      	// timers 0, 1
#endif

    timer0_init();
    sei(); 			// re-enable interrupts

    modbus_init();

    lcd_clear();
    lcd_gotoxy( 0, 0 );
    lcd_puts("Scan 1Wire:");
    lcd_gotoxy( 0, 1 );
    init_temperature();


    menu_init();

    // --------------------------------------------------------------
    // all peripherals are now initialized, start 'em
    // --------------------------------------------------------------

    adc_start();

#if SERVANT_NPWM > 0
    timer1_start();
#endif

}
예제 #24
0
void frontend_init(uint8_t nSensors){
	unsigned char i;
	char buffer[16];
	
	//Program Specialchars
	//0 - Arrow Up
	static const PROGMEM unsigned char up[] = {0x4,0xe,0x15,0x4,0x4,0x4,0x4,0x4};
	//1 - Beerbottle
	static const PROGMEM unsigned char bottle[] = {0x0,0x4,0x4,0xe,0xe,0xe,0xe,0xe};
	//2 - Stall -sign
	static const PROGMEM unsigned char stall[] = {0x0,0xa,0x11,0x15,0x11,0xa,0x0,0x0};
	//3 - °C
	static const PROGMEM unsigned char de_ce[] = {0x1c,0x14,0x1c,0x3,0x4,0x4,0x3,0x0};
	//4 - Mittelwert
	static const PROGMEM unsigned char middle[] = {0x0,0x1,0xe,0x13,0x15,0x19,0xe,0x10};
	//5 - LEFT
	static const PROGMEM unsigned char left[] = {0x0,0x2,0x6,0xe,0x6,0x2,0x0,0x0};
	//6 - RIGHT
	static const PROGMEM unsigned char right[] = {0x0,0x8,0xc,0xe,0xc,0x8,0x0,0x0};

	lcd_init(LCD_DISP_ON);

	
	
	//Schreibe CustomChar in Display
	lcd_command(_BV(LCD_CGRAM));
	for(i=0;i<8;i++){
		lcd_data((pgm_read_byte_near(&up[i])));
	}
	for(i=0;i<8;i++){
		lcd_data((pgm_read_byte_near(&bottle[i])));
	}
	for(i=0;i<8;i++){
		lcd_data((pgm_read_byte_near(&stall[i])));
	}
	for(i=0;i<8;i++){
		lcd_data((pgm_read_byte_near(&de_ce[i])));
	}
	for(i=0;i<8;i++){
		lcd_data((pgm_read_byte_near(&middle[i])));
	}
	for(i=0;i<8;i++){
		lcd_data((pgm_read_byte_near(&left[i])));
	}
	for(i=0;i<8;i++){
		lcd_data((pgm_read_byte_near(&right[i])));
	}
	
	//Initialisiere Willkommen
	lcd_gotoxy(1,0);
	lcd_puts("Here for beer");
	lcd_putc(1);
	lcd_gotoxy(0,1);
	
	sprintf(buffer, "%i Sensors found", nSensors);
	lcd_puts(buffer);

}
예제 #25
0
파일: MICROPF.c 프로젝트: mr3m/MICRO
//En la interrupcion externa un valor es adquirido a traves del 
//teclado matricial
void  EXT_isr(void)     
{
    output_low(LED);
    printf(lcd_putc,"\f");
    lcd_gotoxy(1,2);
    printf(lcd_putc," . = * Enter = #");
    d=0;
    i=0;
    while (text!='#') {         //TAbla de conversionaes digitales
        delay_ms(200);  
        text='E';
        if ((input(PIN_B0)!=0)) {
            tec=input_b();
            if      ((tec==1)||(tec==-31))
                text='1';
            else if ((tec==113)||(tec==49)||(tec==-15)||(tec==17))
                text='2';
            else if ((tec==9)||(tec==-23))
                text='3';
            else if ((tec==5)||(tec==-27))
                text='4';
            else if ((tec==117)||(tec==21)||(tec==53)||(tec==-11))
                text='5';
            else if ((tec==13)||(tec==-19))
                text='6';
            else if ((tec==3)||(tec==-29))
                text='7';
            else if ((tec==115)||(tec==-13)||(tec==51)||(tec==19))
                text='8';
            else if ((tec==-53)||(tec==11)||(tec==-21)||(tec==-117))
                text='9';
            else if ((tec==-25)||(tec==7))
                text='.';
            else if ((tec==23)||(tec==55)||(tec==-9)||(tec==-21))
                text='0';
            else if ((tec==-17)||(tec==15))
                text='#';
            lcd_gotoxy(1+i,1);
            printf(lcd_putc,"%c",text);
            delay_ms(200);
            d[i]=text;
            i++;   
        }        
    }
    if (atof(d)==0)   //Valor predeterminado
    vn=30; 
    else
    vn=atof(d);         //El valor adquirido es un FLOAT
    printf(lcd_putc,"\f");
    lcd_gotoxy(1,2);
    printf(lcd_putc,"IN");
    lcd_gotoxy(1,1);
    printf(lcd_putc,"%.1f",vn);
    enable_interrupts(INT_TIMER1);
    //Habilita las interrupciones por timer pues solo al haber 
    //adquirido una temperatura tiene sentido 
    enable_interrupts(INT_TIMER2);
    }  
예제 #26
0
void menu_display_io(void)
{
    lcd_gotoxy( 0, 0 );
    lcd_puts("Channels: ");
    lcd_gotoxy( 0, 1 );
    lcd_put_bits( dio_state );

    if( changed & KEY_OK )        select_menu( &menu_main );
}
예제 #27
0
void frontend_alarm(uint8_t **wheel_target, uint8_t *next_state){
	*next_state = MAIN;
	*wheel_target = NULL;
	lcd_clrscr();
	lcd_gotoxy(5,0);
	lcd_puts("Timer");
	lcd_gotoxy(4,1);
	lcd_puts("reached");
}
예제 #28
0
void lcd_status_line(const char *msg)
{
    lcd_gotoxy( 0, 3 );
    lcd_puts("Init ");
    lcd_puts( msg );
    lcd_puts("          ");
    lcd_gotoxy( 0, 0 );
    //syslog( LOG_INFO, "Status: %s", msg );
}
예제 #29
0
int main()
{

    cli();
    //unsigned char csr = MCUCSR;
    MCUCSR = 0;

#if USE_WDOG
    wdt_disable();
#endif

    init_devices();
    flash_led2_once();

    lcd_clear();
    lcd_gotoxy( 0, 0 );
    lcd_puts("Load EEPROM:");
    lcd_gotoxy( 0, 1 );

    load_eeprom_settings();
    flash_led1_once();

#if USE_WDOG
    wdt_enable(WDTO_2S);
#endif

    for (;;)
    {
        modbus_process_rx();
#if 1
        menu_run();
#else
        lcd_gotoxy( 0, 0 );

        int i;

        i = adc_value[6] >> 5;
        lcd_puts("vr1=");
        lcd_puti(i);
        i = adc_value[7] >> 5;
        lcd_puts(" vr2=");
        lcd_puti(i);
        lcd_puts("  ");
#endif

#if USE_WDOG
        wdt_reset();
#endif
    }


    while(1)
        ; // die here

    return 1;
}
예제 #30
0
void menu_display_errlog(void)
{
    //uint8_t pos = encoder;
    lcd_gotoxy( 0, 0 );

    //lcd_put_event( pos );
    lcd_gotoxy( 0, 1 );
    //lcd_put_event( pos+1 );

}