Beispiel #1
0
void test_i2c_at24c256_flash(void)
{
  U8 i=0;
  U8 status=1;
  U8 buf[128];

  for(i=0;i<sizeof(buf);i++)
    buf[i] = i;
  
  m24xx_write(EEPROM_24XX256, 0 , 0 , (char *)buf , sizeof(buf));

  for(i=0;i<sizeof(buf);i++)
    buf[i] = 0;

  m24xx_read(EEPROM_24XX256, 0 , 0 , (char *)buf , sizeof(buf));

  for(i=0;i<sizeof(buf);i++)
  {
    if(buf[i] != i)
    {
      status = 0;
      break;
    }    
  }

  if(status == 1)
  {
    lcd_putstring(LINE2,"I2C FLASH PASS");
  }
  else
  {
    lcd_putstring(LINE2,"I2C FLASH FAIL");
  }
}
Beispiel #2
0
 void vTaskLcdDisplay(void *pvParameters)
{
	int i=0;
	int disp2Counter = 0;
	UARTInit(115200);
	while(1)
	{
		itoa(i, displayLine1, 10);


		int i = 0;
		for (i = 0; i < UARTCount; i++)
		{
			displayLine2[disp2Counter++%16] = UARTBuffer[i];
		}
		UARTCount = 0;

		lcd_putstring(0, displayLine1);
		lcd_putstring(1, displayLine2);

		//UARTSend(displayLine1, 16);


        i++;
        vTaskDelay(configTICK_RATE_HZ * 1);
	}
}
Beispiel #3
0
void setSpeed (uint8_t level,uint8_t *working,uint8_t *stopping){

	cli();
		switch (level) {
		case HIGH:
			*working=5;
			*stopping=0;
			lcd_pos(4,9);
			lcd_putstring("H");
			break;
		case MED:
			*working=3;
			*stopping=2;
			lcd_pos(4,9);
			lcd_putstring("M");
			break;
		case LOW:
			*working=2;
			*stopping=3;
			lcd_pos(4,9);
			lcd_putstring("L");
			break;
		case OFF:
			*working=0;
			*stopping=5;
			lcd_pos(4,9);
			lcd_putstring("O");
			break;
		}
	sei();
}
Beispiel #4
0
/*
 * @brief Rational addition of a safe 2 line write to the LCD
 * @params *string1: Pointer to the string to be written to line 1
 *         *string2: Pointer to the string to be written to line 2
 * @retval None
 */
static void lcd_put2String(uint8_t *string1, uint8_t *string2) {
  lcd_command(CURSOR_HOME);
  lcd_command(CLEAR);
  lcd_putstring(string1);
  lcd_command(LINE_TWO);
  lcd_putstring(string2);
}
Beispiel #5
0
/**
*******************************************************************
	Funtion Name : test_sd_card()

	Description  : 

	Input        : 

	Output       : None

	Note         :
*****************************************************************
*/
void test_sd_card(void)
{
  if(!fs_init())
  {
    set_file_system_status(TRUE);
    lcd_clear();
    lcd_putstring(LINE1,"SD card - PASS");
  }
  else
  {
    lcd_clear();
    lcd_putstring(LINE1,"SD card - FAIL");
  }
}
Beispiel #6
0
void init_lcd( void )
{
  set_lcd_port_output();
  delay(100*100);
  lcd_command_write(0x28);     /*   (Function Set) 4-bit interface, two line, 5X8 dots.        */
  lcd_clear() ;                /*   LCD clear                                   */
  lcd_command_write(0x02);     /*   cursor home                                 */
  lcd_command_write(0x06);     /*   (Entry Mode) Increment, Display Shift off   */
  lcd_command_write(0x0C) ;    /*   display on, Cursor & Blink off     */
  lcd_gotoxy(0, 0);
  lcd_clear();	
  lcd_putstring(0," JRM Technologies");
  lcd_putstring(1,"  SAIRAM JAIRAM ");
}
Beispiel #7
0
/**
********************************************************************************************
  Function Name :	init_lcd()
  
  Description   :	
  
  Input         :	
  
  Output        :	Void
  
  Note          :
********************************************************************************************
*/
void init_lcd( void )
{
  set_lcd_port_output();
  delay(100*100);
  delay(100*100);
	
  lcd_command_write(0x28);     /*   4-bit interface, two line, 5X7 dots.        */
  lcd_clear() ;                /*   LCD clear                                   */
  lcd_command_write(0x02);     /*   cursor home                                 */
  lcd_command_write(0x06);     /*   cursor move direction                       */
  lcd_command_write(0x0C) ;    /*   display on      */
  lcd_gotoxy(0, 0);
  lcd_clear();	
  lcd_putstring(0,"     N G X   ");
  lcd_putstring(1,"  TECHNOLOGIES ");
}
Beispiel #8
0
//====================================================================
// MAIN FUNCTION
//====================================================================
void main (void){
	init_LCD();
	init_GPIO();
	//Get operating CLK freq
	RCC_ClocksTypeDef CLK;
	RCC_GetClocksFreq(&CLK);
	sysclock= (CLK.SYSCLK_Frequency)/((float)(pow(10,6)));
	//Sys clocks in MHz
	sprintf(lcdstring,"CLK %d MHz",sysclock);
	lcd_putstring(lcdstring);
	lcd_command(LINE_TWO);
	lcd_putstring("Servo Step Test, SW0");
	//Init procedure waits for SW0
	while(GPIO_ReadInputData(GPIOA)&GPIO_IDR_0){}
	lcd_command(CLEAR);
	init_ADC();
	init_EXTI();
	init_USART1();
	init_TIM2();
	init_TIM3();
	init_TIM14();
	init_TIM17();
	for(;;){
		while(TIM3OC2<=3800){
			TIM3OC2++;
			TIM_SetCompare2(TIM3,TIM3OC2);
			for(int x=0;x<=255;x++){
				for(int y=0;y<=255;y++){}
			}
		}
		lcd_command(CURSOR_HOME);
		sprintf(lcdstring,"ADC:%d     ",(int) ADCval);
		lcd_putstring(lcdstring);
		lcd_command(LINE_TWO);
		sprintf(lcdstring,"TIM:%d     ",(int) TIM2->CCR3);//TIMcmp);
		//TIM_SetCompare2(TIM3,(int)(64000*((0.9+1.1*ADCval/2047.0)/20.0)));
		lcd_putstring(lcdstring);
	}
}											// End of main
Beispiel #9
0
/* *
********************************************************************************************
  Function Name :	lcd_line_clear()
  
  Description   :	
  
  Input         :	
  
  Output        :	Void
  
  Note          :
********************************************************************************************
*/
void lcd_line_clear(unsigned char line)
{
  char temp_buf[MAX_CHAR_IN_ONE_LINE];
  int i=0;

  if(line > 1)
    return;

  for(i=0; i<MAX_CHAR_IN_ONE_LINE; i++)
    temp_buf[i] = ' ';

  lcd_putstring( line, temp_buf );
}
Beispiel #10
0
/*
 * @brief Display the specified data on the screen
 * @params displayType: What to display on the screen
 *         ...: Data to display for the given type
 * @retval None
 */
void display(displayType_t displayType, float data) {
  // Switch on what needs to be displayed
  switch (displayType) {
  case DISP_BAT: {
    // Display the battery voltage on the LCD
    lcd_command(CLEAR);
    lcd_command(CURSOR_HOME);
    lcd_putstring("Battery:");
    lcd_command(LINE_TWO);

    // Generate the string with the batter voltage
    uint8_t *string = ConverttoBCD(data, 2, 3);
    lcd_putstring(string);
    lcd_putstring(" V");

    // De-allocate the memory used for the battery string
    free(string);
    break;
  }
  case DISP_RAINFALL: {
    // Display the rainfall amount on the LCD
    lcd_command(CLEAR);
    lcd_command(CURSOR_HOME);
    lcd_putstring("Rainfall:");
    lcd_command(LINE_TWO);

    // Fetch and convert the rainfall to a string
    float rain = 0.2*data;
    uint8_t *string = ConverttoBCD(rain, 4, 1);
    lcd_putstring(string);
    lcd_putstring(" mm");

    // De-allocate the memory used for the rainfall string
    free(string);
    break;
  }
  case DISP_RAIN_BUCKET:
    // Display the bucket tip notification LCD
    lcd_put2String("Rain bucket tip", "");
    break;
  case DISP_MENU:
    // Display the menu on the LCD
    lcd_put2String("Weather Station", "Press SW2 or SW3");
    break;
  case DISP_WELCOME:
    // Display the welcome on the LCD
    lcd_put2String("EEE3017W Prac 6", "Sean & Sean");
    break;
  default:
    break;
  }
}