Ejemplo n.º 1
0
/******************************************************************************
* Function name: main
* Description  : Main program function
* Arguments    : none
* Return value : none
******************************************************************************/
void main(void)
{
    /* Used to pace toggling of the LED */
    uint32_t led_counter;
    
    /* Initialize LCD */
    YRDKRX62N_RSPI_Init();
    lcd_initialize();
    
    /* Clear LCD */
    lcd_clear();
    
    /* Display message on LCD */
    lcd_display(LCD_LINE1, "  RENESAS   ");
    lcd_display(LCD_LINE2, " YRDKRX62N  ");

    /* 
        STDOUT is routed through the virtual console window tunneled through the JTAG debugger.
        Open the console window in HEW to see the output 
    */
    printf("This is the debug console\r\n");
    
    /* The three pushbuttons on the YRDK board are tied to interrupt lines, set them up here */
    switches_initialize();
    
    /* This is the main loop.  It does nothing but toggle LED4 periodically */
    while (1)
    {
        for (led_counter = 0; led_counter < 1000000; led_counter++)
        {
        }
        LED4 = ~LED4;
    }
}
void main()
{
   init_pic();

     initialDisplay();
     t = read_adc();

   OUTPUT_HIGH(PIN_C0);
   OUTPUT_HIGH(PIN_C2);
   OUTPUT_LOW(PIN_C3);
       while(1)
       {
       //  if(number_changed)
      //   {
            lcd_display(noOfPeople,14,1);
      //      number_changed = 0;
      //   }
         read_temperature();
         if(temp_changed)
         {
            lcd_display(temperature,13,2);
            temp_changed = 0;
         }

       //  phaseControl();

       }
}
Ejemplo n.º 3
0
void display_init(void)
{
    lcd_init();
    lcd_fill(0);
    //int i;
    //for(i=0;i<30;i++){
    //    lcd_setPixel(i,i,true);
    //}
    //font_render('\\', 0, 0);
    //font_renders("foo bar", 20, 0);
    lcd_display();
    //while(1);
#if 0
    //static uint8_t r = 0;
    while(1){
        //if( r == 0 )
        //    r = 0xff;
        //else
        //    r = 0;
        //lcd_fill(r);
        lcd_fill(0xAA);
        lcd_display();
        //lcdhal_delayms(500);
        //lcd_startStream();

        //while(x--)
        //    lcd_stream(r,0,0);
        //lcd_stopStream();
    }
#endif
}
Ejemplo n.º 4
0
/******************************************************************************
* Função: Tarefa4
* Descrição  : Função da quarta tarefa
* Parâmetros    : nenhum
* Retorno : nenhum
*******************************************************************************/
void Tarefa4(void)
{
	ToogleLinha4 = ~ToogleLinha4;

	if (ToogleLinha4)
		lcd_display(LCD_LINE4, "TASK 2000ms ");
	else
		lcd_display(LCD_LINE4, "            ");
}
Ejemplo n.º 5
0
/******************************************************************************
* Função: Tarefa3
* Descrição  : Função da terceira tarefa
* Parâmetros    : nenhum
* Retorno : nenhum
*******************************************************************************/
void Tarefa3(void)
{
	ToogleLinha3 = ~ToogleLinha3;

	if (ToogleLinha3)
		lcd_display(LCD_LINE3, "TASK 1500ms ");
	else
		lcd_display(LCD_LINE3, "            ");
}
Ejemplo n.º 6
0
/******************************************************************************
* Função: Tarefa2
* Descrição  : Função da segunda tarefa
* Parâmetros    : nenhum
* Retorno : nenhum
*******************************************************************************/
void Tarefa2(void)
{
	ToogleLinha2 = ~ToogleLinha2;

	if (ToogleLinha2)
		lcd_display(LCD_LINE2, "TASK 1000ms ");
	else
		lcd_display(LCD_LINE2, "            ");
}
Ejemplo n.º 7
0
/******************************************************************************
* Função: Tarefa1
* Descrição  : Função da primeira tarefa
* Parâmetros    : nenhum
* Retorno : nenhum
*******************************************************************************/
void Tarefa1(void)
{
	ToogleLinha1 = ~ToogleLinha1;

	if (ToogleLinha1)
		lcd_display(LCD_LINE1, "TASK  500ms ");
	else
		lcd_display(LCD_LINE1, "            ");
}
/*
*********************************************************************************************************
*                                           UI_Update()
*
* Description : Updates LCD with Cloud status messages
*
* Argument(s) : message          Index into const message array.
*
* Return(s)   : none.
*
* Caller(s)   : CloudData_Task
*
* Note(s)     : none.
*********************************************************************************************************
*/
static void UI_Update (CPU_CHAR message)
{
static CPU_CHAR display_status = 0;

    display_status = 1;
    if (display_status) {
        lcd_display(LCD_LINE8, (uint8_t *)msg_status[MSG_BLANK]);
        lcd_display(LCD_LINE8, (uint8_t *)msg_status[message]);
    }
}
Ejemplo n.º 9
0
void Fallback() {
	lcd_display(LCD_LINE2, "  Fallback  ");
	lcd_display(LCD_LINE3, " condition! ");
	/* Turno off motors */
	Motor_Write_us(MOTOR_UPPER, 0);
	Motor_Write_us(MOTOR_BOTTOM, 0);
	Motors_Off();
	/* Turn off servos */
	Servo_Write_deg(SERVO_PITCH, (SERVO_MAX_BOUND_DEG+SERVO_MIN_BOUND_DEG)/2);
	Servo_Write_deg(SERVO_ROLL, (SERVO_MAX_BOUND_DEG+SERVO_MIN_BOUND_DEG)/2);
	Servos_Off();
}
Ejemplo n.º 10
0
void main()
{
	unsigned int i,j,k,l,m,n;
	PINSEL0=0X00000000;
	PINSEL1=0X00000000;
	IO0DIR=0XFFFFFFFF;
	lcd_init();
	init_rtc();
	lcd_str("CLOCK:- 24");
	cmd(0xc0);
	lcd_str("00:00:00");
	while(1)
	{ 
	        if(flag)
	        {
			flag=0;
			lcd_pos(2,0);
			lcd_display(HOUR/10 + '0');
			lcd_display(HOUR%10 + '0'); 
			lcd_display(':') ;
			lcd_display(MIN/10 + '0');
			lcd_display(MIN%10 + '0');
			lcd_display(':') ;
			lcd_display(SEC/10 + '0');
		        lcd_display(SEC%10 + '0');
	        }
	}

}
void main()
{
   init_pic();

   initialDisplay();

      /* only if the number of people changes the value shown in lcd is changed.
      And temperature is updated when counter_for_temp overflows.*/
       while(1)
       {
         phaseControl();
         if(number_changed)
         {
            lcd_display(noOfPeople,14,1);
            number_changed = 0;
         }

         if(counter_for_temp == 65535)
         {
            lcd_display_temperature();
            counter_for_temp=0;
         }
         counter_for_temp++;
       }
}
Ejemplo n.º 12
0
void  lcd_string(unsigned char* name)
{
	while(*name!='\0')
	{
		lcd_display(*name);
		name++;
	}		   		
}
Ejemplo n.º 13
0
void lcd_str(unsigned char *x)
{
	while(*x!='\0')
	{
	     lcd_display(*x);
	     x++;
	}
}
Ejemplo n.º 14
0
/******************************************************************************
* Função: Tarefa5
* Descrição  : Função da quinta tarefa
* Parâmetros    : nenhum
* Retorno : nenhum
*******************************************************************************/
void Tarefa5(void)
{
	uint16_t LeituraADC;
	char LeituraADCString[10];

	LeituraADC = S12ADC_read();
	sprintf(LeituraADCString,"ADC: %04ld",LeituraADC);
	lcd_display(LCD_LINE6, LeituraADCString);
}
Ejemplo n.º 15
0
void display_init(void)
{
    char buf[64];
    lcd_init();
    lcd_fill(0);
    sprintf(buf, "Tisch: %u", TABLE_NUMBER + 1); font_renders(buf, 0, 0);
    sprintf(buf, "Zeit:"); font_renders(buf, 0, 16);
    lcd_display();
}
Ejemplo n.º 16
0
void main( void )
{
	lcd_initialize();
	lcd_display( LCD_LINE1, "FreeRTOS" );

	/* The configCREATE_LOW_POWER_DEMO setting is described in FreeRTOSConfig.h. */
	#if configCREATE_LOW_POWER_DEMO == 1
	{
		lcd_display( LCD_LINE2, "LP Demo" );
		main_low_power();
	}
	#else
	{
		lcd_display( LCD_LINE2, "Ful Demo" );
		main_full();
	}
	#endif
}
void main()
{

 /*  setup_adc_ports(AN0);
   setup_adc(ADC_CLOCK_DIV_32);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_counters( RTCC_INTERNAL, RTCC_DIV_1 | RTCC_8_BIT);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_RTCC);
   enable_interrupts(INT_EXT);
   enable_interrupts(GLOBAL);

   EXT_INT_EDGE(L_TO_H);

   OUTPUT_B(0);
   OUTPUT_C(0);

   SET_TRIS_B(0b00000111);   //pins B0, B1 and B2 are set to give inputs. b0 is the external interuupt pin
   SET_TRIS_C(0b00000000);
   SET_TRIS_D(0b00000000);

   set_adc_channel(0); */           //the next read_adc call will read channel 0

   init_pic();

     initialDisplay();
    // OUTPUT_HIGH(PIN_C0);
    // OUTPUT_LOW(PIN_C1);

   OUTPUT_HIGH(PIN_C0);
   OUTPUT_HIGH(PIN_C2);
   OUTPUT_LOW(PIN_C3);

       while(1)
       {
           phaseControl();
         if(number_changed)
         {
            lcd_display(noOfPeople,14,1);
            number_changed = 0;
         }

         if(counter_for_temp == 10000)
         {
            lcd_display_temperature();
            counter_for_temp=0;
         }
         counter_for_temp++;

       }

}
Ejemplo n.º 18
0
void main()
{

	lcd_ini();
	lcd_command(0x80);
	lcd_display('D');
	lcd_display('I');
	lcd_display('P');
	lcd_display('A');
	lcd_display('K');

while(1)

{
	 lcd_command(0x80);
	 lcd_string("HELLO WORLD");
}

}
//Switch 2 is an interrupt that controls stop motion
void sw2_callback(void)
{
	lcd_display(LCD_LINE4, "  STOPPED   ");
	//Forward=0;
	Enable=0;
	//Backward=0;
	sci_put_string("Stop\n\r");
	LastDir=0;

} 
Ejemplo n.º 20
0
main()
{

 	lcd_ini();
	
	lcd_command(0x80);
    
	lcd_display('D');
	lcd_display('I');
	lcd_display('P');
	lcd_display('A');
	lcd_display('K');

	while(1)
	{
		lcd_command(0x80);
		lcd_string("Hello world");
	}

}
Ejemplo n.º 21
0
void main( void )
{
	/* Call the Renesas provided setup. */
	vHardwareSetup();
	lcd_initialize();
	lcd_display( LCD_LINE1, "FreeRTOS" );

	/* The configCREATE_LOW_POWER_DEMO setting is described in FreeRTOSConfig.h. */
	#if configCREATE_LOW_POWER_DEMO == 1
	{
		lcd_display( LCD_LINE2, "LP Demo" );
		main_low_power();
	}
	#else
	{
		lcd_display( LCD_LINE2, "Ful Demo" );
		main_full();
	}
	#endif
}
//Switch 3 is an interrupt that controls the reverse motion
void sw3_callback(void)
{
	
	Forward=0;
	Enable=1;
	Backword=1;
	if(inloop==0){
	sci_put_string("Reverse\n\r");
	lcd_display(LCD_LINE4, "  REVERSE  ");}
	LastDir=-1;
}
//Switch 1 is an interrupt that will control forward motion
void sw1_callback(void)
{
	
	Forward=1;
	Enable=1;
	Backword=0;
	if(inloop==0){
	sci_put_string("Forward\n\r");
	lcd_display(LCD_LINE4, "  FORWARD ");}
	LastDir=1;
}
Ejemplo n.º 24
0
/*******************************************************************************
* Function name: sw2_function
* Description  : Switch 2. Shows test frame CAN TxID. 
* Arguments    : None
* Return Value : None
*******************************************************************************/
void sw2_function(void)
{
	if ( state == 1 )
	{
		if ( --dig1 < 65 ){ dig1 = 90; } /*  Rollover condition for state1 in  SW2*/
		sprintf((char *)IST, "%c%c%c",dig1,95,95);       
    	lcd_display(LCD_LINE1, IST);
	}		
	if ( state == 2 )
	{
		if ( --dig2 < 65 ){ dig2 = 90; } /*  Rollover condition for state1 in  SW2*/
		sprintf((char *)IST, "%c%c%c", dig1, dig2,95 );            
    	lcd_display(LCD_LINE1, IST);
	}
	if ( state == 3 )
	{
		if ( --dig3 < 65 ){ dig3 = 90; } /*  Rollover condition for state1 in  SW2*/
		sprintf((char *)IST, "%c%c%c", dig1, dig2, dig3 );            
    	lcd_display(LCD_LINE1, IST);
	}
}/*  End of function sw2_function(). */
Ejemplo n.º 25
0
void screen_type_setup(Screen *scr, TxProfile *txp)
{
    lcd_clear();
    lcd_write("TYPE:");

    lcd_display(0b101); // cursor off but blinking

    input_init(_type_inputs, _type_inputs_size);
    input_assign(0, &txp->tx_mode);
    input_assign(1, &txp->swash[0]);
    input_assign(2, &txp->swash[1]);
    input_assign(3, &txp->swash[2]);
}
Ejemplo n.º 26
0
/*******************************************************************************
* Function name: sw1_function
* Description  : Switch 1. Transmits a test CAN frame.
*                A-D Demo.
* Arguments    : None
* Return Value : None               
*******************************************************************************/
void sw1_function(void)
{
	if ( state == 1 ) 
	{  
		if ( ++dig1 > 90 ){ dig1 = 65; } /*  Rollover condition for state1 in  SW1*/
		sprintf((char *)IST, "%c%c%c",dig1,95,95);            
    	lcd_display(LCD_LINE1, IST);
	}		
	if ( state == 2 )
	{
		if ( ++dig2 > 90 ){ dig2 = 65; } /*  Rollover condition for state2 in  SW1*/
		sprintf((char *)IST, "%c%c%c", dig1, dig2,95 );            
    	lcd_display(LCD_LINE1, IST);
	}
	if ( state == 3 )
	{
		if ( ++dig3 > 90 ){ dig3 = 65; } /*  Rollover condition for state3 in  SW1*/
		sprintf((char *)IST, "%c%c%c", dig1, dig2, dig3 );            
    	lcd_display(LCD_LINE1, IST);
	}
	
 } /*  End of function sw1_function(). */
/*******************************************************************************
* Function name: display_results
* Description  : Converts ADC counts to volts value and shows both on the LCD
* Arguments    : uint16_t adc_counts: current reading from ADC
* Return value : none
*******************************************************************************/
void display_results (uint16_t adc_counts)
{
    /* For converting the reading to volts */
    float adc_volts;
    /* String to display */
    char result_string[20];
    
    /* Convert to a string */
    sprintf(result_string, "Reading=%4d", adc_counts);

    /* Update the display */
    lcd_display(LCD_LINE7, (const uint8_t *)result_string);

    /* Convert S12ADC counts to volts and display */    
    adc_volts = ((float) adc_counts) / MAX_COUNTS * (VREFH - VREFL);

    /* Convert to a string */
    sprintf(result_string, "Volts  =%4.2f", adc_volts);

    /* Update the display */
    lcd_display(LCD_LINE8, (const uint8_t *)result_string);
} /* End function display_results() */
Ejemplo n.º 28
0
void display_tick(void)
{
    static uint32_t s = 0;
    char buf[64];

    s++;
    if(s == 10) {
        s = 0;
        struct time *t = time_getTime();
        time_format(t, buf);
        font_renders(buf, 0, 32);
        lcd_display();
    }
}
Ejemplo n.º 29
0
/*******************************************************************************
* Function name: switches_initialize
* Description  : Initializes push button switches I/O ports. 
* Arguments    : None
* Return Value : None
*******************************************************************************/
void switches_initialize(void)
{
    /* Set switch input ports to GPIO input mode. */ 
    SW1_PMR = 0;
    SW1_PDR = 0;
    
    SW2_PMR = 0;
    SW2_PDR = 0;

    SW3_PMR = 0;
    SW3_PDR = 0;
	
  	lcd_display(LCD_LINE1, "A__");
    
}  /* End of function switches_initialize(). */
Ejemplo n.º 30
0
void display()
{
key++;
number=number+input_port;
if(key==11)
{
number=number/key;
number=number*10;
number=number/25;
humidity=number-3;
lcd_display(humidity);
key=0;
number=0;
}
}