void Disp_Client_Data()
{
  uint8_t line = 1 ,column = 0,chk =0;
  char buf;
  LCDClear();
  LCDFont(FONT_SMALL);
  while(1)
  {
    while(!WIFI_ReceiveByte(&buf));
    chk = Parse_Data(buf);
    if(chk == 2)
    {
      Format_Data(buf,&line,&column);
      if(buf == 'X')
      {
        LCDClear();
        LCDPrintf(1,0,"Connection Closed");
        LCDPrintf(8,0,"SW2 to Exit");
        wait_for_sw();
        LCDPrintf(8,0,"Exit        ");
        break;
      }
        
  }
}
}
Beispiel #2
0
void routine(void) {
  
  LCDClear();
  LCDBitmap(bitcoin); // display Bitcoin Logo
  delay(3000);

  LCDClear();
  gotoXY(0, 4);
  LCDString("kendricktabi.com");
  delay(3000);

  LCDClear();
  gotoXY(0, 0);
  LCDString(" {Bitcoin!} ");
  gotoXY(0, 2);
  LCDString("Connecting  ");
  LCDString("to WiFi");
    
  LCDClear();
  gotoXY(0, 2);
  LCDString("    WiFi    "); 
  LCDString(" Connected! "); 
  delay(1000);
  LCDClear();
	for(;;) {
		loop();
	}
}
void Auto_Setup(uint8_t type)
{
  LCDPrintf(1,0,"Connecting..");
  switch(type)
  {
    case 0:
      LCDClear();
      LCDFont(FONT_SMALL);
      Echo_Disable();             // Disable Echo for each command ( easier to parse)
     while (!(Echo_Confirm()));   // Send AT command till response OK 
     if(!Disassociate())          // Disassociate if currently associated to any network
      {
       LCDPrintf(5,0,"Exit");
        break;
      }
      if(!DHCP_Enable())         // Enable Dynamic IP (or Dynamic Host Configuration Protocol)
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      if(!Auto_Wifi())           // Configure Auto Connect Wifi settings
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      if(!Auto_Network())       // Configure Auto Connect Network Settings 
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      if(!Auto_Enable())        // Enable Auto Connect Profile
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      if(!Auto_Start())         // Start Auto Connect
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      LCDPrintf(1,0,"Connected");
      LCDPrintf(8,0,"SW2 to connect");
      break;
    default:
      break;
  }
// Auto connection done 
// Now Actual Application  
  wait_for_sw();
  LCDClear();
  LCDPrintf(1,0,"Connect Client");
  Data_handle(CLIENT);            // Wait For Client Connection Details
  wait_for_sw();
//  Disp_Client_Data();             // Parse message sent from Client and Display the Data
}      
Beispiel #4
0
void main()
{
     unsigned char i;

   //Initialize LCD module
   LCDInit(LS_BLINK|LS_ULINE);

   //Clear the screen
   LCDClear();

   //Simple string printing
   LCDWriteString("Congrats ");

   //A string on line 2
   LCDWriteStringXY(0,1,"Loading ");

   //Print some numbers
   for (i=0;i<99;i+=1)
   {
      LCDWriteIntXY(9,1,i,3);
      LCDWriteStringXY(12,1,"% ");
      _delay_loop_2(0);
      _delay_loop_2(0);
      _delay_loop_2(0);
      _delay_loop_2(0);

   }

   //Clear the screen
   LCDClear();

   //Some more text

   LCDWriteString("Hello world");
   LCDWriteStringXY(0,1,"By YourName Here");    // <--- Write ur NAME HERE !!!!!!!!!!!

   //Wait
   for(i=0;i<100;i++) _delay_loop_2(0);

   //Some More ......
   LCDClear();
   LCDWriteString("    eXtreme");
   LCDWriteStringXY(0,1,"  Electronics");

	//Wait
   for(i=0;i<100;i++) _delay_loop_2(0);

   //Custom Chars ......
   LCDClear();
   LCDWriteString("Custom Char !!!");
   LCDWriteStringXY(0,1,"%0%1%2%3%4%5%6%7");

}
void main(void) 
{

    OSCTUNEbits.PLLEN = 1;
    LCDInit();
    LCDClear();
    InitPins();
    ConfigPeriph();
    ConfigInterrupts();

    while (1) {
	    received = ReadSerial();
	    LCDClear();
            switch(received) {
                case 'a':
                         received2 = ReadSerial();  
                         sprintf(output,"Received char:%c",received2); 
			/*
			 *  FIXME : PIC18 doesn't transmit back to RPi
			 *  python script hangs on serial.read(1)
			 *  Same behavior with cat -A /dev/ttyACM0 
			 *
			 * 
			 * _delay(2); // 2 cycle delay
			 *while(!PIR1bits.TX1IF);
			 *sprintf(output,"TRANSMIT");
			 *LCDWriteLine(output,0);
			 *TXREG1=received2;
                         *
			 */
			 break ;
                case 'b':
                         potentiometer = ReadPot();
                         sprintf(output,"Pot value: %d", potentiometer);
                         LATD =~ LATD;
                         break;
                  
                case 'c':
			   received2=ReadSerial();
			   sprintf(output,"Set LED to 0x%X",received2);
                           LATD = received2;
                           break;
                default:
                    sprintf(output, ">>UNKNOWN %c",received);
                    break;
             
            }
        LCDWriteLine(output,0);
	
	
    }
}
Beispiel #6
0
void Task_LCDMAN(void *pdata){
	char* src;
	INT8U err;
	while(1){
		src = (char*)OSMboxPend(Mbox_LCDMAN,0,&err);
		LCDClear();
		//LCDString(0,"ID:");
		LCDString(0,src);
		OSTimeDlyHMSM(0,0,3,0);
		LCDClear();
		LCDString(0,"   Bitman Lab\n   Log System.");
	}
}
void StateTemperature(void)
{
  uint8_t temp_Value;
  uint8_t degree_Type = 0;
  uint8_t sChange = 0;

  DisplayTempMenu();                                    // Temperature menu text
  if (BUT_PRESSED())                             // If a button press is pending
  {
    if (RB0_PRESSED())                          // If temperature mode confirmed
    {
      RESET_RB0();                                        // Event has been used
      LCDClear();                                            // Clear the screen
      for (;;)                                                  // Infinite loop
      {
        temp_Value = I2CReadTemp();           // Get current temperature reading
        DisplayTemperature(temp_Value,degree_Type);   // Display current reading
        if (BUT_PRESSED())                       // If a button press is pending
        {
          if (RB0_PRESSED())                             // User chooses to exit
          {
            RESET_RB0();                                  // Event has been used
            nState = ST_TEMPERATURE;              // Move on to temperature mode
            LCDClear();                            // Wipe display for next mode
            break;                                     // Exit the infinite loop
          }
	  if (RA4_PRESSED())                             // User chooses to exit
          {
            RESET_RA4();                                  // Event has been used
	    if (sChange == 1)
	    {
	      sChange = 0;
	      degree_Type = 1;
	    }
	    else
	    {
	      sChange = 1;
	      degree_Type = 0;
	    }
          }
        }
      }
    }
    else if (RA4_PRESSED())                   // If next mode selected (by user)
         {
           RESET_RA4();                                   // Event has been used
           nState = ST_CLOCK;                    // Move to clock selection mode
           LCDClear();                             // Clear LCD for next display
         }
  }                                                  // If button press recorded
}                                             	   // Temperature selection mode
void main()
{
    unsigned char i;
   for(i=0;i<10;i++) _delay_loop_2(0);
   
    while(1)
   {

   //Initialize LCD module
   LCDInit(LS_BLINK|LS_ULINE);
  
   for(i=0;i<10;i++) _delay_loop_2(0);
   //Clear the screen
   LCDClear();

   //Simple string printing
   LCDWriteStringXY(0,0,"Welcome to CELAB");
   //LCDWriteString("Congrats ");

   //A string on line 2
   LCDWriteStringXY(0,1,"Loading ");

   //Print some numbers
   for (i=0;i<99;i+=1)
   {
      LCDWriteIntXY(9,1,i,3);
      LCDWriteStringXY(12,1,"%");
      _delay_loop_2(0);

   }

   //Clear the screen
   LCDClear();

   //Some more text

   LCDWriteString("Hello world");
   LCDWriteStringXY(0,1,"ComputronicsLab");    // <--- Write ur NAME HERE !!!!!!!!!!!

   //Wait
  for(i=0;i<50;i++) _delay_loop_2(0);

   //Some More ......
   LCDClear();
   LCDWriteString("Computronics");
   LCDWriteStringXY(0,1,"Lab");
   for(i=0;i<50;i++) _delay_loop_2(0);
   }

}
Beispiel #9
0
int main(int argc, const char *argv[])
{
	LCDInit(LS_NONE);
	LCDClear();

	// while(1)
	// {
		//Clear the screen
		// LCDClear();


		//Simple string printing
		LCDWriteString("GET A STRING!");

		//A string on line 2
		// LCDWriteStringXY(0,1," Senior Project");
		// int i;
		//Wait
		// for(i=0;i<100;i++) _delay_loop_2(0);

		//Clear the screen
		// LCDClear();
	// }

	return 0;
}
Beispiel #10
0
void loop() {
  gotoXY(0, 5);
  LCDString("Please wait.");


  LCDClear();
  gotoXY(0, 0);
  LCDString("{BTC PRICES}");
  gotoXY(0, 2);
  LCDString("$= ");
  
  gotoXY(0, 5);
  LCDString("Updated!    ");

  delay(1000);
  gotoXY(0, 5);
  LCDString("            ");

  gotoXY(0, 5);
  for (int x=0; x <= 11; x++){
      LCDString(".");
      delay(1000);
   }

  gotoXY(0, 5);
  for (int x=0; x <= 11; x++){
      LCDString(" ");
      delay(1000);
  }

}
Beispiel #11
0
void LCDInit(void)
{
    // Initialize SPI Interface
    Initialize_SPI();

    // set pin directions
    LCD_CS_MAKE_OUT();
    LCD_CS_HIGH();
    LCD_DC_MAKE_OUT();
    LCD_RES_MAKE_OUT();

    // Toggle reset pin
    LCD_RES_LOW();
    Delay(1000);
    LCD_RES_HIGH();
    Delay(1000);

    // Send sequence of command
    LCDSend(0x21, SEND_CMD); // LCD Extended Commands.
    LCDSend(0xC8, SEND_CMD); // Set LCD Vop (Contrast). 0xC8
    LCDSend(0x04 | !!(LCD_START_LINE_ADDR & (1u << 6)), SEND_CMD); // Set Temp S6 for start line
    LCDSend(0x40 | (LCD_START_LINE_ADDR & ((1u << 6) - 1)), SEND_CMD); // Set Temp S[5:0] for start line
    //LCDSend( 0x13, SEND_CMD );  // LCD bias mode 1:48.
    LCDSend(0x12, SEND_CMD); // LCD bias mode 1:68.
    LCDSend(0x20, SEND_CMD); // LCD Standard Commands, Horizontal addressing mode.
    //LCDSend( 0x22, SEND_CMD );  // LCD Standard Commands, Vertical addressing mode.
    LCDSend(0x08, SEND_CMD); // LCD blank
    LCDSend(0x0C, SEND_CMD); // LCD in normal mode.

    // Clear and Update
    LCDClear();
    LCDUpdate();
}
Beispiel #12
0
void showSplashScreen()
{
   	//Clear the screen
   	LCDClear();
	displayMsg(m1_splash, m2_splash, 0);
   	_delay_ms(2000);
}
Beispiel #13
0
void main(void)
{
    //Initialize the LCD module
    LCDInit(LS_NONE);

    //Initialize the ADC module
    ADCInit();

    //Clear the LCD
    LCDClear();

    LCDWriteString("Thermometer");

    while(1)
    {
        //Read the temperature using LM35
        float t = LM35ReadTemp();

        //Print it on the LCD
        LCDWriteIntXY(0,1,t,3);

        //Print the degree symbol and C
        LCDWriteString("%0C");

        //Wait 200ms before taking next reading
        __delay_ms(200);
    }

}
void main(void)
{
    /* Initialize I/O and Peripherals for application */
    InitApp(); //at end of user.c

    led_counter=0;
    spk_bit=0;  //what are the spk_bits ???
    led_bit=0;

    LCDInit();
    LCDClear();
    gotoXY(1,11);   //(1,11) is about halfway down
    LCDString("PIC 16LF1786");
    
    while(1)
    {
        /* TODO <INSERT USER APPLICATION CODE HERE> */
	if(spk_bit==1)
	{
	    if((spk_enable==1)&&(spk_enable2==1))
	    LATBbits.LATB6=1;  //B6 is the clk in for uploading program to PIC
	}else LATBbits.LATB6=0; 
    }

}
Beispiel #15
0
int main(int argc, const char *argv[])
{
	unsigned char i;
	LCDInit(LS_NONE);
	LCDClear();

	// Initialize usart
	init_usart(BAUDRATE, TRANSMIT_RATE, DATA_BITS, STOP_BITS, PARITY_BITS);

	char recipe_name[RECIPE_NAME_LENGTH];

    eeprom_read_block((void*)&recipe_name, (const void*)0x00, RECIPE_NAME_LENGTH);
    
	LCDWriteString("Recipe Name:");
	LCDWriteStringXY(0,1,recipe_name);

	for(i=0;i<25;i++) _delay_loop_2(0);
	
	// Clear second row
	LCDWriteStringXY(0,1,"                ");
    eeprom_read_block((void*)&recipe_name, (const void*)0x76, RECIPE_NAME_LENGTH);

	LCDWriteString("Recipe Name:");
	LCDWriteStringXY(0,1,recipe_name);

	return 0;
}
Beispiel #16
0
// Run the IHK line
void runLine(){

	LCDClear();

	static const uint8_t forwardDirection = 0;
	
	// Start speed, current speed.
	uint8_t currentSpeed = SPEED_CREEP;

	setDirectionMotorL(forwardDirection);
	setDirectionMotorR(forwardDirection);

	// Run until end of track.
	while(stopFlag == FLAG_NOT_SET)
	{
		if(getSensorUpdateFlag())
		{
			// When a line is lost after driving straight, go in search mode
			if(lostLineFlag == FLAG_SET)
			{
				searchMode();
				lostLineFlag = FLAG_NOT_SET;
			}

			// When line is found, make a Right turn
			// Increase speed and follow the line.
			if(foundLineFlag == FLAG_SET)
			{
				go(150,DIRECTION_RIGHT,SPEED_CREEP);
				setDirectionMotorL(forwardDirection);
				setDirectionMotorR(forwardDirection);
				currentSpeed = SPEED_CREEP;
				foundLineFlag = FLAG_USED;
			}
		
			// When following the line,
			// if front sensor detects obstacle,
			// exit line following loop
			if (foundLineFlag == FLAG_USED)
			{
				uint16_t distance = AdcConvert(1);
				
				if (distance > (uint16_t)500)
				{
					setStopFlag(FLAG_SET);
				}
			}

			// Calculate and set new duty cycle.
			calcDuty(currentSpeed, calcFloorErrorAndFlagControl());

			clearSensorUpdateFlag();
		}
	}

	// Stop the robot at end mark.
	setDutyCycleMotorL(0);
	setDutyCycleMotorR(0);
}
void loop(void) {
  LCDClear();
  LCDBitmap(SFEFlame);
  delay(1000);

  LCDClear();
  LCDBitmap(SFEFlameBubble);
  delay(1000);

  LCDClear();
  LCDBitmap(awesome);
  delay(1000);

  LCDClear();
  LCDString("Hello World!");
  delay(1000);
}
Beispiel #18
0
void init_lcd(void)
{
	LCDInit(LS_NONE);
	LCDClear();

	LCDWriteString("    Mr. Pour    ");
	LCDWriteStringXY(0,1," Senior Project");
}
Beispiel #19
0
void LCDSample(void)
{
    LCDClear();
    gotoXY(7,1);
    LCDString("Nokia 5110");
    gotoXY(4,2);
    LCDString("Scroll Demo");

}
Beispiel #20
0
/* FUNCTIILE DE OUTPUT PE LED,BUZZER*/
void view_MORSE(char* msg, char* msg2)
{
	int i;
	LCDClear();
	LCDWriteString(msg2);
	for (i=0;i<strlen(msg);i++) {
		if (msg[i]=='s') S();
		else if (msg[i]=='o') O();
	}
}
void Check_SD(void){
unsigned char x,y;
int delay;

x=CardIsPresent();
while(x==1){
LCDClear();
LCDStr(0,"Put SD Card",0);
for(delay=0;delay<50000;delay++){
}
x=CardIsPresent();
}

y=CardIsProtected();
if(y==1){
LCDClear();
LCDStr(0,"Card is",0);
LCDStr(1,"protected",0);
}
else MSD_Write_Block(Data,0x00,512);
}
Beispiel #22
0
void update_LCD_screen(int view)
{
	/* Switch view on LCD */
	if (view == LCD_CURRENT_TEMP) {
		/* Create string to display on LCD */
		sprintf(lcd_string, "     %1.1f F", (double)g_current_temp);

		/* Print update to LCD */
		LCDClear();
		LCDWriteString(" Internal Temp  ");
		LCDWriteStringXY(0, 1, lcd_string);
	} 
	if (view == LCD_DEFINED_TEMP) {
		/* Create string to display on LCD */
		sprintf(lcd_string, "     %1.1f F", (double)g_defined_temp);

		/* Print update to LCD */
		LCDClear();
		LCDWriteString("  Desired Temp");
		LCDWriteStringXY(0, 1, lcd_string);
	}
}
void Format_Data(char buf, uint8_t* line, uint8_t* column)
{
  
    if(buf == '\r' || buf == '\n')
    {
      if(*line == 7)
      {
        *line = 1;
        LCDClear();
      }
      else
        (*line)++;
    }
    else if ( buf >= 'a'  || buf <= 'z' || buf >='A' || buf <= 'Z' 
                || buf >= '1' || buf <= '9')
    {
        LCDPrintf(*line,*column,"%c",buf);
        if(*column == 16)
        {
          if(*line == 7)
          {
            *line = 1;
            LCDClear();
          }
          else 
            (*line)++;
          *column = 0;
        }
        else
          (*column)++;
    }
    else if ( buf == SPI_CHAR_IDLE);
    else
    {
      LCDPrintf(8,0,"Invalid Char");
    }
}
Beispiel #24
0
int main(void)
{
	int timer = 0;
	int x;
	int y;

	char str1[16];
	char str2[16];
	
	clear_bit(DDRD,5);
	clear_bit(DDRD,4);
	
	set_bit(DDRB,7);
	
	set_bit(PORTD,5);
	set_bit(PORTD,4);
	set_bit(PORTB,7);

	LCDInit();
	ADCInit();

	sei();

	LCDClear();

    while(1)
    {

		timer ++;

		if (timer >= 1000) {

			timer = 0;

			if(!check_bit(PIND,5))
			{

			}

			if(!check_bit(PIND,4))
			{

			}			

		}

	}

}
Beispiel #25
0
void  Main (void){
	INT16U freq;
	S3C_SysInit();

	OSInit();	
	
	LCDInit();
	LCDString(0x00,"     Bitman\n  Spartan 117");
	delay(10);
	
	for(freq = 10;freq < 300;freq += 10){
		S3C_SetPWMBuzzer(freq,freq/2);
		delay(1);
	}
	
	
	LCDClear();
	delay(8);
	LCDString(0,"   Bitman Lab\n   Log System.");
	S3C_SetPWMBuzzer(650,10);
	S3C_StartPWMBuzzer();
	delay(3);
	S3C_StopPWMBuzzer();
	delay(1);
	S3C_StartPWMBuzzer();
	delay(3);
	S3C_StopPWMBuzzer();
	delay(10);
	
	
	
	
	
	Sem_UART0Tx = OSSemCreate(1);
	Sem_UART1Tx = OSSemCreate(1);

	Mbox_UART0Rx = OSMboxCreate((void *)0);
	Mbox_UART0Tx = OSMboxCreate((void *)0);
	Mbox_LEDMAN  = OSMboxCreate((void *)0);
	Mbox_BEEPMAN = OSMboxCreate((void *)0);
	Mbox_LCDMAN  = OSMboxCreate((void *)0);
	
	
	iOPcode = TYPE_DEFAULT;


	OSTaskCreate(TaskStart,(void *)0,&Stk_TaskStart[99],10);
	OSStart();
}
Beispiel #26
0
int main(void) {
    /*****************
     * boot sequence *
     *****************/
    
    bootARM();           	// ARM boot sequence
    vs1002Mute();           // mute volume during start up

    // start of code
    ledRedOn();         // red LED indicates powering up
    LCDInit();          // initialize LCD
    LCDClear(black);   

    return 0;
}
void DisplaySavedGlucoReading(void)
{
    float read_mgdl=0;
    int read_mgdl_int = 0;

    read_mgdl = gYmmolRead + (gYmmolDecimalRead/10);
    read_mgdl = read_mgdl*18;
    read_mgdl_int = (int)read_mgdl;

    LCDClear();
//    LCDString("%3dmg/dl%02d/%02d/%02d", read_mgdl_int, gMonthRead, gDaysRead, gYearRead);
    gotoXY(0,1);
//    LCDString(".%d.%dmmol/l %02d:%02d", gYmmolRead, gYmmolDecimalRead, gHoursRead, gMinutesRead);
    NOP();
}
Beispiel #28
0
int main()
{
	int i;
	float angle;
	float rate;
	float acc_x;
	float acc_y;
	float acc_z;
	char aux_buffer[200];
	
	//Create a structure that will store the LCD information
	LCD my_lcd;
	//Initialize and clear screen
	dLcdInit(my_lcd.Lcd);
	LCDClear(my_lcd.Lcd);

	if(!init_xg1300l_gyro())
		return -1;

	for(i = 0;i<MAX_SAMPLES;i++)
	{ //Print the direct outp from the XG1300L device
		get_xg1300l_gyro(&angle, &rate, &acc_x, &acc_y, &acc_z);
		sprintf(aux_buffer,"Angle: %0.2f [deg]   ", angle);
		dLcdDrawText(my_lcd.Lcd, FG_COLOR, 1, 20, NORMAL_FONT, (signed char *)aux_buffer);
		printf("%s\n", aux_buffer);
		sprintf(aux_buffer, "Rate:  %0.2f [deg/s]   ", rate);
		dLcdDrawText(my_lcd.Lcd, FG_COLOR, 1, 40, NORMAL_FONT, (signed char *)aux_buffer);
		printf("%s\n", aux_buffer);
		sprintf(aux_buffer, "AccX:  %0.2f [m/s^2]   ", acc_x);
		dLcdDrawText(my_lcd.Lcd, FG_COLOR, 1, 60, NORMAL_FONT, (signed char *)aux_buffer);
		printf("%s\n", aux_buffer);
		sprintf(aux_buffer, "AccY:  %0.2f [m/s^2]   ", acc_y);
		dLcdDrawText(my_lcd.Lcd, FG_COLOR, 1, 80, NORMAL_FONT, (signed char *)aux_buffer);
		printf("%s\n", aux_buffer);
		sprintf(aux_buffer, "AccZ:  %0.2f [m/s^2]   ", acc_z);
		dLcdDrawText(my_lcd.Lcd, FG_COLOR, 1, 100, NORMAL_FONT, (signed char *)aux_buffer);
		printf("%s\n\n", aux_buffer);
		dLcdUpdate(&my_lcd);
		sleep(1);
	}

	//Close devices
	close_xg1300l_gyro();
	dLcdExit(); 
	return 1;
}
Beispiel #29
0
void _init(){
	/******************* Pin Configuration ***********************/
	DDRA = 0xff;		// PORTA = output
	DDRB = 0x1;			// PORTB.0 = output (backlight)
	
	BUTTON_PORT = 0x13;		// pins 0,1,4 of BUTTON_PORT (portE) are pulled high
	
	
	/******************* ADC Setup / Temperature first *********************/
	ADCSRA = (1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);		// ADC Prescaler = Fck/128
	ADCSRA |= (1<<ADFR)|(1<<ADEN)|(1<<ADIE);		// Free-running mode, enabling ADC and ADC Interrupt
	
	
	/******************* PWM Setup *********************/
	//DDRB |= (1<<PB7);
	//OCR2 = 64;
	//TCCR2 = (1<<WGM21)|(1<<WGM20)|(1<<COM21)|(1<<CS20)|(1<<CS21);
	
	
	/******************* LCD Setup *********************/
	InitLCD(0);
	LCDClear();
	LCDWriteStringXY(CLOCK_CURSOR_POSITION,0,"00:00");
	LCDWriteStringXY(0,1,"T=00.0");
	LCDByte(0b11011111, 1);		// Scrive il carattere °: dalla tabella 4 del datasheet HD44780.pdf vediamo che il carattere è 11011111;
								// lo mandiamo come byte (LCDByte()) sapendo che dobbiamo mettere RS a 1 (dato!)
	LCDWriteStringXY(HUM_CURSOR_POSITION-4, 1, "C_H=88%");
	LCDWriteStringXY(ZONE_CURSOR_POSITION-1,1,"_1");
	
	
	/******************* RTC Setup *********************/
	TCCR0 |= (1<<CS02)|(1<<CS01)|(1<<CS00);			// clock: F_CPU / 1024
	TCCR0 |= (1<<WGM01)|(0<<WGM00);					// Clear Timer on Compare
	TIMSK |= (1<<OCIE0);							// Output compare match interrupt enable
	OCR0 = 156;										// Interrupt every 10ms
	
	/******************* Timer2 setup: backlight *********************/
	//TCCR2 |= (1<<CS22)|(0<<CS21)|(1<<CS20);		// clock: F_CPU / 1024
	TCCR2 |= (1<<WGM21)|(0<<WGM20);					// Clear Timer on Compare
	TIMSK |= (1<<OCIE2);							// Output compare match interrupt enable
	OCR2 = 156;										// Interrupt every 10ms
	
		
	sei();
	ADCSRA |= 1<<ADSC;		// ADC Start Conversion
}
Beispiel #30
0
void displayStatus()
{
   	LCDClear();
	LCDWriteStringXY(0, 0, bm_cfg.ProfileName);
	uint8_t sel_antenna_Id = bm_cfg.AntSelBandCfg[BandSelected];
	const char * msg = bm_cfg.AntLongNames[sel_antenna_Id];
	if (sel_antenna_Id == NO_ANTENNA)
	{
		msg = err_no_ant;
	}
	else if (isPeerAntConflict(sel_antenna_Id))
	{
		msg = err_ant_conflict;
	}
	uint8_t len = strLen(msg);
	uint8_t x = 7 + (10 - len) / 2;		
	LCDWriteStringXY(x, 0, msg);

	LCDWriteStringXY(18, 0, band_str[BandSelected]);

	// display antennas to select:
	for (uint8_t i = 0; i < MAX_ANT_PER_BAND; i++)
	{
		uint8_t antenna_Id = bm_cfg.AntAvailBandCfg[BandSelected][i];
		if (antenna_Id == NO_ANTENNA)
		{
			displayAntShort(i, "", "-");
		}
		else
		{
			const char* decor = " ";
			if (antenna_Id == sel_antenna_Id)
			{
				decor = "*";
			}
			if (isPeerAntConflict(antenna_Id))
			{
				decor = "X";
			}

			displayAntShort(i, bm_cfg.AntShortNames[antenna_Id], decor);		
		}
	}
}