Пример #1
0
void ic_update_lcd(i_charger *ic)
{
   //first line of 1602 given to charger...
   lcd_cursor(0,0);


   if(ic->i_stage == STOP){
      lcd_puts("END");
      short x = 1000*ic->voltage;
	  print10(x); 
	  info("TOP");
	  x =1000*ic->top_voltage; 
	  print10(x);
  
   }else{
      lcd_puts("PWM");
      print10(pwm_getduty());
      lcd_puts(" ");
   }
      
}
uint8_t Sensornummerlesen(uint8_t index, uint8_t* nummer)
{
	uint8_t tempScratchPad[9];
	if  ((DS18X20_read_scratchpad(&gSensorIDs[index][0], tempScratchPad ))== DS18X20_OK)
	{
			lcd_gotoxy(14,1);
		lcd_puts("GUT\0");

		*nummer=tempScratchPad[2];
		return DS18X20_OK;
	}
	
	else 
	{
				lcd_gotoxy(14,1);
		lcd_puts("BAD\0");

		*nummer=0xFF;
		return DS18X20_ERROR;
	}
}
Пример #3
0
static void tui_draw_mainpage(uint8_t forced) {
	uint8_t d;
	unsigned char line[17];
	unsigned char buf[16];
	line[16]=0;
	if (!forced) {
		static uint8_t drawcnt=0;
		drawcnt++;
		if ((drawcnt&1)==0) {
			uint8_t i;
			for (i=0;i<4;i++) {
				uint8_t c = tui_mp_modidx[i] + 1;
				if (c >= TUI_MODS_MAXDEPTH) c=0;
				if (tui_mp_mods[i][c] == 255) c=0;
				tui_mp_modidx[i] = c;
			}
		}
	}
	// Line 0
	memset(line,' ',16);
	d = tui_run_mod(tui_mp_mods[0][tui_mp_modidx[0]],buf,10);
	memcpy(line,buf,d);
	d = tui_run_mod(tui_mp_mods[1][tui_mp_modidx[1]],buf,15-d);
	memcpy(&(line[16-d]),buf,d);
	lcd_gotoxy(0,0);
	lcd_puts(line);
	// Line 1
	memset(line,' ',16);
	d = tui_run_mod(tui_mp_mods[2][tui_mp_modidx[2]],buf,10);
	memcpy(line,buf,d);
	d = tui_run_mod(tui_mp_mods[3][tui_mp_modidx[3]],buf,15-d);
	memcpy(&(line[16-d]),buf,d);
	lcd_gotoxy(0,1);
	lcd_puts(line);
	tui_force_draw = 0;
	if (!forced) {
		tui_refresh_interval = tui_update_refresh_interval();
		tui_next_refresh = timer_get_5hz_cnt()+tui_refresh_interval;
	}
}
Пример #4
0
void 	String_zerlegen_Isel(char * str_rx, char * Position, char * Winkel) {
	//0M5200, +600
	//Achse M Position, +Geschwindigkeit
	char * Achse="0";
	Achse[0] = str_rx[1];	// Achse setzen
	Achse[1] = '\0';
	// Ausgeben welche Achse gewaehlt wurde
	if(atoi(Achse)==0){
		lcd_puts("Achse: ");
		lcd_puts(Achse);
		lcd_puts(" (Rotation)\n");
	}
	if(atoi(Achse)==1){
		lcd_puts("Achse: ");
		lcd_puts(Achse);
		lcd_puts(" (Hoehe)   \n");
	}
	// Anzahl der Schritte aus dem String auslesen
	char c;
	int i = 0;
	do {
		c = str_rx[i + 3];
		if (c != ',') {
			Position[i] = c;
			i++;
		}
	} while (i < 20 && c != '\0' && c != ',');
	Position[i] = '\0'; // String 0 Terminieren
	int32_t z;
	int32_t y;
	z = atol(Position);	// String in Zahl(long) umwandeln
	y = z / 7200;		// Berechnung des Winkel
	z = (z * 71111)  /1024;	// Berechnung der Schritte
	ltoa(y, Winkel,		10 ); // Winekl in String umwandeln
	ltoa(z, Position,	10 ); // Schritte in String umwandeln
Пример #5
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  ");
}
Пример #6
0
int main(void) {

    ANSEL=0;
    ANSELH=0;
    CM1CON0=0;
    CM2CON0=0;
    TRISA=0;
    TRISC=0;

    lcd_init();

    while (1==1)
    {
        lcd_clear();
        pause(100);
        lcd_goto(0);
        pause(1);
        for (b0=0; b0<10; b0=b0+1)
        {
            lcd_putch( b0 + number );
            pause(2);
        }
        lcd_goto(0x40);
        pause(2);

        _delay(4);

        __delay_us(1000);




        lcd_puts("Hello World");
        pause(20);
        lcd_puts("_EOF");
        pause(10);
    }

    return 0;
}
Пример #7
0
void lcd_put_temperatur(uint16_t temperatur)
{
		char buffer[8]={};
		//uint16_t temp=(temperatur-127)*5;
		uint16_t temp=temperatur*5;
//		uint16_t temp=temperatur;
		lcd_gotoxy(0,1);
		lcd_putint16(temp);

//		itoa(temp, buffer,10);
		r_itoa16(temp,buffer);
//		lcd_putc(' * ');
		
		char outstring[8]={};

		outstring[7]='\0';
		outstring[6]=0xDF;
		outstring[5]=buffer[6];
		outstring[4]='.';
		outstring[3]=buffer[5];
		if (abs(temp)<100)
		{
		outstring[2]=' ';
		outstring[1]=' ';
		}
		else if (abs(temp)<1000)
		{
		outstring[2]=buffer[4];
		outstring[1]=' ';
		
		}
		else
		{
		outstring[2]=buffer[4];
		outstring[1]=buffer[3];

		}
		
		outstring[0]=buffer[0];
/*
		if (temp<100)
		{
		lcd_putc(' ');
		}
		if (temp<10)
		{
		lcd_putc(' ');
		}
	*/	
		lcd_puts(outstring);

}
Пример #8
0
void vStartAntBOT(void){

	PowerOn();
	DDRB = 0xFF;
	PORTB = 0xFF;

	///* initialize display, cursor off */
	lcd_init(LCD_DISP_ON);
	///* clear display and home cursor */
	lcd_clrscr();
	lcd_puts("Ant BOT>\nPower On");

	mirf_RX_ADDR_P0 = mirf_Default_ADDR;
	mirf_ShockB_init(2);

//	RC_SetUnits(500,7);
//	  test wheels
//	RC_SetUnits(500, 6);
//	RC_SetUnits(500, 5);
//	RC_SetUnits(100, 1);






#if(USE_BOT_CTRL == 1)
	vStartControlTask(mainCONTROL_PRIORITY);
#endif
#if(USE_BOT_LIGHTS == 1)
	vStartLightsTask( mainLIGHTS_PRIORITY );
#endif
#if(USE_BOT_BUTTON == 1)
	vStartButtonTask( mainBUTTON_PRIORITY, 10 );
#endif
#if(USE_BOT_ARM == 1)
	vStartArmTask(mainARM_PRIORITY);
#endif
#if(USE_BOT_WHEEL == 1)
	vStartWheelTask(mainWHEEL_PRIORITY);
#endif

#if(USE_BOT_SERVO == 1)
	RC_StartModule();
#endif

#if(USE_BOT_ADC == 1)
	vAdcInit(5);
#endif


}
Пример #9
0
USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) {
    usbRequest_t *rq = (void *)data; // cast data to correct type
        
    switch(rq->bRequest) { // custom command is in the bRequest field
    case USB_LED_ON:
        PORTB |= 1; // turn LED on
        return 0;
    case USB_LED_OFF: 
        PORTB &= ~1; // turn LED off
        return 0;
    
      case USB_DATA_OUT: // send data to PC
        usbMsgPtr = replyBuf;
		LCD_goto(2,0);
		lcd_puts(replyBuf);
        return sizeof(replyBuf);
		
		
	  case USB_DATA_WRITE: // modify reply buffer
        replyBuf[7] = rq->wValue.bytes[0];
        replyBuf[8] = rq->wValue.bytes[1];
        replyBuf[9] = rq->wIndex.bytes[0];
        replyBuf[10] = rq->wIndex.bytes[1];
				LCD_goto(2,0);
		lcd_puts(replyBuf);
        return 0;
	
	case USB_DATA_IN: // receive data from PC   
     dataLength = (uchar)rq->wLength.word;  
      dataReceived = 0;      
     if(dataLength > sizeof(replyBuf)) // limit to buffer size  
       dataLength = sizeof(replyBuf);         
      return USB_NO_MSG; // usbFunctionWrite will be called now


	
		}
    return 0; // should not get here
}
Пример #10
0
int main(void)
{
    lcd_init(LCD_DISP_ON_CURSOR_BLINK);           //Initialize LCD
    spi_init_slave();                             //Initialize slave SPI
    
    unsigned char data, buffer[10];
    
    DDRA  = 0x00;                                 //Initialize PORTA as INPUT
    PORTA = 0xFF;                                 //Enable Pull-Up Resistors
    
    while(1)
    {
        lcd_clrscr();                             //LCD Clear screen
        lcd_home();                               //LCD move cursor to home 
        lcd_puts("Testing");
        lcd_gotoxy(0,1);
        data = spi_tranceiver(ACK);               //Receive data, send ACK
        itoa(data, buffer, 10);                   //Convert integer into string
        lcd_puts(buffer);                         //Display received data
        _delay_ms(20);                            //Wait
    }
}
Пример #11
0
/**
 * Execute the BASIC command in 's'.
 */
void execute(char *s) {
  unsigned char command;
  char * args;
  reset_interrupted();
  s = skip_whitespace(s);
  args = find_args(s);
  command = find_keyword(s);
  if (command != CMD_UNKNOWN) {
    command_functions[command](args);
  } else {
    lcd_puts("Unknown command!\n");
  }
}
Пример #12
0
/**
@brief Write int in the specified radix r of minlen w prepended by char c.
@param[in]	a	int
@param[in]	r	Radix
@param[in]	l	Min length
@param[in]	c	Prepending char
*/
void lcd_puti_lc(const uint32_t a, uint8_t r, uint8_t l, char c)
{
	char s[10];

	itoa(a, s, r);

	while( l > strlen(s) ) {
		lcd_putc(c);
		l--;
	}

	lcd_puts(s);
}
Пример #13
0
void lcd_putint2(uint8_t zahl)	//zweistellige Zahl
{
	char string[3];
	int8_t i;								// SchleifenzŠhler
	zahl%=100;								// 2 hintere Stelle
	//  string[4]='\0';                     // String Terminator
	string[2]='\0';							// String Terminator
	for(i=1; i>=0; i--) {
		string[i]=(zahl % 10) +'0';         // Modulo rechnen, dann den ASCII-Code von '0' addieren
		zahl /= 10;
	}
	lcd_puts(string);
}
Пример #14
0
/* prompt user to plug USB and fix a problem */
static void prompt_usb(const char* msg1, const char* msg2)
{
    int button;
    lcd_clear_display();
    lcd_puts(0, 0, msg1);
    lcd_puts(0, 1, msg2);
#ifdef HAVE_LCD_BITMAP
    lcd_puts(0, 2, "Insert USB cable");
    lcd_puts(0, 3, "and fix it.");
#endif
    lcd_update();
    do
    {
        button = button_get(true);
        if (button == SYS_POWEROFF)
        {
            power_off();
        }
    } while (button != SYS_USB_CONNECTED);
    usb_screen();
    system_reboot();
}
Пример #15
0
void frontend_tempdetails(uint8_t **wheel_target, uint8_t *next_state, int16_t *measVal, uint16_t measMiddle, uint8_t nSensors){
	char buffer[8];
	*wheel_target = NULL;
	*next_state = MENU_MAIN;
	lcd_clrscr();
	for(uint8_t i = 0; i < nSensors; i++){
		if((i+1)%2 != 0){
			lcd_gotoxy(0,(i/2));
		}else{
			lcd_gotoxy(8, (i/2));
		}
		sprintf(buffer, "%i:", i);
		lcd_puts(buffer);
		DS18X20_format_from_decicelsius(measVal[i], buffer, 10);
		lcd_puts(buffer);
	}
	lcd_gotoxy(8,1);
	lcd_putc(AVERAGE);
	lcd_puts(":");
	DS18X20_format_from_decicelsius(measMiddle, buffer, 10);
	lcd_puts(buffer);
}
Пример #16
0
void weck_page_print_page(eds_weck_page_block_t *p)
{
	char s[32];
	uint16_t dauer;
	uint8_t d1,d2;

	// LCD Bildschirm loeschen
	lcd_clrscr();

	if (weck_page_state == STATE_VIEW)
	{
		if (get_weck_details(p->weck_id, &dauer) != 0)
		{
			// vermutlich keine Antwort gekommen
			snprintf_P(s,sizeof(s)-1,
					PSTR("Fehler!"));
			lcd_gotoxy(0,1);
			lcd_puts(s);
			return;
		}
	}
	if (weck_page_state == STATE_EDIT)
	{
		dauer = weck_details_dauer_edit;
	}

	// 1. Zeile
	snprintf_P(s,sizeof(s)-1,PSTR("%8s"),p->name);
	lcd_gotoxy(0,0);
	lcd_puts(s);

	// 2. Zeile
	d1 = dauer / 3600;
	d2 = (dauer / 60) % 60;

	snprintf_P(s,sizeof(s)-1, PSTR("wecken in %d:%02dh"),d1,d2);
	lcd_gotoxy(0,1);
	lcd_puts(s);
}
Пример #17
0
void lcd_putint(uint8_t zahl)
{
char string[4];
  int8_t i;                             // schleifenzŠhler
 
  string[3]='\0';                       // String Terminator
  for(i=2; i>=0; i--) 
  {
    string[i]=(zahl % 10) +'0';         // Modulo rechnen, dann den ASCII-Code von '0' addieren
    zahl /= 10;
  }
lcd_puts(string);
}
Пример #18
0
void menuStatisticsView(uint8_t event)
{
  TITLE(STR_MENUSTAT);

  switch(event)
  {
    case EVT_KEY_FIRST(KEY_UP):
      chainMenu(menuStatisticsDebug);
      return;

#if defined(PCBTARANIS)
    case EVT_KEY_LONG(KEY_MENU):
      g_eeGeneral.globalTimer = 0;
    	break;
#endif
    case EVT_KEY_FIRST(KEY_EXIT):
      chainMenu(menuMainView);
      return;
  }

  lcd_puts(  1*FW, FH*0, STR_TOTTM1TM2THRTHP);
  putsTimer(    5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0);
  putsTimer(   12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0);

  putsTimer(    5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0);
  putsTimer(   12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0);

  putsTimer(   12*FW+5*FWNUM+1, FH*0, s_timeCumTot, 0, 0);
  
#if defined(PCBTARANIS)
  putsTimer(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + sessionTimer, 0, 0);
#endif

#if defined(THRTRACE)
  uint8_t traceRd = (s_traceCnt < 0 ? s_traceWr : 0);
  const uint8_t x=5;
  const uint8_t y=60;
  lcd_hline(x-3,y,MAXTRACE+3+3);
  lcd_vline(x,y-32,32+3);

  for (uint8_t i=0; i<MAXTRACE; i+=6) {
    lcd_vline(x+i+6,y-1,3);
  }
  for (uint8_t i=1; i<=MAXTRACE; i++) {
    lcd_vline(x+i, y-s_traceBuf[traceRd], s_traceBuf[traceRd]);
    traceRd++;
    if (traceRd>=MAXTRACE) traceRd = 0;
    if (traceRd==s_traceWr) break;
  }
#endif
}
Пример #19
0
//draws a single line with GPS satellite info
//  const uint8_t row - the row to draw the line on
//  const loc_state_t* loc - GPS location information
void ui_draw_sat_info( const uint8_t row, const loc_state_t* loc ){
  char small_buffer[SMALL_BUF_LEN];

  lcd_clearline(row);
  lcd_gotoxy(0, row);

  //print out the dilution of precision meter
  lcd_gotoxy(0, row);
  if( (loc->dop) <= MAX_GREAT_DOP ){ //if dop is ideal or excellent
    lcd_putc(FULL_SIG_CHAR);
  } else if( (loc->dop) <= MAX_GOOD_DOP ){ //if dop is good
    lcd_putc(GOOD_SIG_CHAR);
  } else if( (loc->dop) <= MAX_ACCEPTABLE_DOP ){ //if dop is moderate
    lcd_putc(LOW_SIG_CHAR);
  } else { //if dop is fair or poor
    lcd_putc(BAD_SIG_CHAR);
  }

  //number of satellites
  lcd_gotoxy(1, row);
  sprintf_P( small_buffer, PSTR("%dst"), loc->sats );
  lcd_puts( small_buffer );

  //time in HH:MM:SS
  lcd_gotoxy(8, row);
  sprintf_P( small_buffer,
             PSTR("%lu:%lu:%lu"),
             (((loc->time)/10000)
               #ifdef USE_TIME_ZONE
               +24+TIME_ZONE)%24
               #else
               )
               #endif
             ,
             ((loc->time)%10000)/100,
             (loc->time)%100);
  lcd_puts( small_buffer );
}
Пример #20
0
void menuTelemetryArduPilot3(uint8_t event)
{
    switch(event)
    {
    case EVT_KEY_FIRST(KEY_UP):
        chainMenu(menuTelemetryArduPilot2);
        break;
    case EVT_KEY_FIRST(KEY_DOWN):
        chainMenu(menuTelemetryArduPilot4);
        break;
    case EVT_KEY_FIRST(KEY_EXIT):
        ARDUPILOT_DisableRXD();
        chainMenu(menuMainView);
        break;
    }
    initval (0, PACK_POS, ALT);
    initval (1, PACK_POS, ALH);
    title ('3');  
    lcd_puts  (1*FW, 1*FH, PSTR(" Altitude"));    
    lcd_putsAtt (2*FW, 2*FH, VALSTR(0), APSIZE);
    lcd_puts  (1*FW, 4*FH, PSTR(" Altitude Hold") );
    lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
}
Пример #21
0
void menuTelemetryArduPilot2(uint8_t event)
{
    switch(event)
    {
    case EVT_KEY_FIRST(KEY_UP):
        chainMenu(menuTelemetryArduPilot1);
        break;
    case EVT_KEY_FIRST(KEY_DOWN):
        chainMenu(menuTelemetryArduPilot3);
        break;
    case EVT_KEY_FIRST(KEY_EXIT):
        ARDUPILOT_DisableRXD();
        chainMenu(menuMainView);
        break;
    }
    initval (0, PACK_POS, SPD);
    initval (1, PACK_POS, CRT);
    title ('2');  
    lcd_puts  (1*FW, 1*FH, PSTR(" Ground speed"));    
    lcd_putsAtt (2*FW, 2*FH, VALSTR(0), APSIZE);
    lcd_puts  (1*FW, 4*FH, PSTR(" Climb rate") );
    lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
}
Пример #22
0
void act_hd44780_Init(void)
{
	///FIXME: What is this, this needs to be more clear by far....

	// Contrast (brightness on an oled display)
	TCCR0A |= (1<<COM0B1)|(1<<WGM01)|(1<<WGM00);
	TCCR0B |= (1<<CS00);
	OCR0B = act_hd44780_INITIAL_CONTRAST;
	DDRD |= (1<<PD5);

#if (act_hd44780_TYPE==0)
	// Backlight
	TCCR0A |= (1<<COM0A1)|(1<<WGM01)|(1<<WGM00);
	TCCR0B |= (1<<CS00);
	OCR0A = act_hd44780_INITIAL_BACKLIGHT;
	DDRD |= (1<<PD6);
#endif

	lcd_init(LCD_DISP_ON);
	lcd_clrscr();
	lcd_puts("HomeAutomation\n");
	lcd_puts("HD44780-module\n");
}
Пример #23
0
// ADC interrupt service routine
interrupt [ADC_INT] void adc_isr(void)
{
unsigned int adc_data;
// Read the AD conversion result
adc_data=ADCW;
// Place your code here
delay_ms (200); 
lcd_clear();
//temp1=read_adc(1);
temp=((adc_data*5.0)/1023);
ftoa(temp,2,str_temp) ;
lcd_puts(str_temp);

}
Пример #24
0
void StatusMode_in(){
    int i;
    lcd_copypage(2, 1);
    lcd_setshowpage(1);
    lcd_setdrawpage(1);
    status_x = lcd_getcurx();
    status_y = lcd_getcury();
    lcd_setforeground(COL_BLACK);
    lcd_setbackground(COL_WHITE);

    lcd_locate(0, WindowHeight - 1);
    for(i=0;i<WindowWidth;i++)
        lcd_puts(" ");
}
Пример #25
0
void menuTelemetryArduPilot4(uint8_t event)
{
    switch(event)
    {
    case EVT_KEY_FIRST(KEY_UP):
        chainMenu(menuTelemetryArduPilot3);
        break;
    case EVT_KEY_FIRST(KEY_DOWN):
        chainMenu(menuTelemetryArduPilot5);
        break;
    case EVT_KEY_FIRST(KEY_EXIT):
        ARDUPILOT_DisableRXD();
        chainMenu(menuMainView);
    break;
    }
    initval (0, PACK_POS, CRS);
    initval (1, PACK_POS, BER);
    title ('4'); 
    lcd_puts  (1*FW, 1*FH, PSTR(" Course"));    
    lcd_putsAtt (2*FW, 2*FH, VALSTR(0), APSIZE);
    lcd_puts  (1*FW, 4*FH, PSTR(" Bearing"));
    lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
}
Пример #26
0
void zero_init()
{
    lcd_clear();
    lcd_puts("Memory init");
    write_var(0, 0, 0x19);
    write_var(0, 1, 0x08);
    write_var(0, 2, 0x1E);  //30
           
    block = 0;            
    addr = 3;
    for(i = 0; i < MAX_PATTERNS; i++)
    {
        write_var(block, addr, v1.length);
        addr++;
            check_ab();
        for(j = 0; j < MAX_ITEMS; j++)                
        {                   
            lcd_gotoxy(0, 1);  
            
            lcd_puts(t_preset);
            lcd_putchar(' ');
            
            LCDWriteInt(i, 0);
            
            lcd_putchar(' ');
            lcd_puts(t_item);
            lcd_putchar(' ');
            
            LCDWriteInt(j, 0);
            lcd_putchar(' ');
            
            write_var(block, addr, v1.out[j]);
            addr++;
            check_ab();
        }
    }
}
Пример #27
0
int main(void)
{	
	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();
  	  
	lcd_puts("   STM32F051");
	
	lcd_gotoxy(1, 4);
	lcd_puts("LCD TEST");
	while(1)
	{
		// Set PORTC.8
		GPIOC->BSRR = (1 << 8);
		delay_ms(1000);
		// Reset PORTC.8
		GPIOC->BRR = (1 << 8);
		delay_ms(1000);
	}

}
Пример #28
0
int main( void )
{
  uint32_t val = 0;
  char s[sizeof("4294967295")];		// ASCII space for 32 bit number
  char textbuf [ 16 + 1 ];

  //_delay_ms ( 5000 );

  lcd_init();

#if 1
  char *p;

  if ( 1 ) {
    char  *source = "68u65gujl";
    unsigned int i;
    for ( i = 0; i < strlen ( source ); i++ ) {
      textbuf [ i ] = source [ i ];
    }
    textbuf [ i ] = '\0';
    lcd_xy( 0, 0 );
    lcd_puts( textbuf );			// display number right adjusted
  }
#endif

#if 0
  for(;;){
    ultoa( val, s, 10 );
    lcd_xy( 0, 1 );
    lcd_blank( 10 - strlen( s ));	// insert spaces until number
    lcd_puts( s );			// display number right adjusted
    val++;
  }
#endif

  return ( 0 );
}
Пример #29
0
void lcd_put_tempbis99(uint16_t temperatur)
{
		char buffer[7]={};
		//uint16_t temp=(temperatur-127)*5;
		//lcd_gotoxy(0,1);
		//lcd_puts("t:\0");
		//lcd_putint((uint8_t) temperatur);	
		uint16_t temp=(temperatur)*5;
		//lcd_puts("T:\0");
		//lcd_putint16(temp);	

//		uint16_t temp=temperatur;
		
//		itoa(temp, buffer,10);
		r_itoa16(temp,buffer);
//		lcd_puts(buffer);
//		lcd_putc(' * ');
		
		char outstring[7]={};

		outstring[6]='\0';
		outstring[5]=0xDF;
		outstring[4]=buffer[6];
		outstring[3]='.';
		outstring[2]=buffer[5];
		if (abs(temp)<100)
		{
		outstring[1]=' ';
		
		}
		else 
		{
		outstring[1]=buffer[4];
				
		}		
		outstring[0]=buffer[0];
/*
		if (temp<100)
		{
		lcd_putc(' ');
		}
		if (temp<10)
		{
		lcd_putc(' ');
		}
	*/	
		lcd_puts(outstring);
		lcddelay_ms(2);
}
Пример #30
0
void update_LC(void)
{

	double C,L; /*to caculate */
	double f=F;
    char sC=0, sL=0;

	L= 1/(((f*2*pi)*(f*2*pi))*C0);
    C= 1/(((f*2*pi)*(f*2*pi))*L0);
    
    L-=L0;
	C-=C0;
	
	L*=pow(10,6);  /*uH*/
	C*=pow(10,12);  /*pF*/

    if(L<0){ sL=1; L=-L;}
	if(C<0){ sC=1; C=-C;}
	
    lcd_puts("L:"); 
	if(sL)lcd_putc('-');
	L*=10000;   /*0.1nH*/
	print10L(L,9,4); 
	lcd_puts("uH     "); 

	lcd_cursor(0,3);


	lcd_puts("C:"); 
	if(sC)lcd_putc('-');
	C*=10;  /*0.1 pF*/
	print10L(C,8,1);
    lcd_puts("pF       "); 

	
}