Exemplo n.º 1
0
void main(void)
{
	// M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts
	// Insert your main routine code here.
	PWM8_1_Start();
	LCD_1_Start();
	LCD_1_Init();
	LCD_1_Position(0,0);
	LCD_1_PrHexByte(PWM8_1_PULSE_WIDTH);
	while(1)
	{
		while((INT_CLR0 & 0x40)==0)//wait till set
		{
		}
		INT_CLR0 &= ~0x40;//Clear
		
		
		bSwitchState<<=1;
		bSwitchState&=0x70;
		bSwitchState|=(PRT1DR &0x08);
		
		if(bSwitchState==0x38)
		{
			PWM8_1_WritePulseWidth((PWM8_1_bReadPulseWidth()+ 1));
			LCD_1_Position(0,0);
			LCD_1_PrHexByte(PWM8_1_bReadPulseWidth());
		}
	}
}
Exemplo n.º 2
0
void main(void)
{
	char LCDBuffer[15];
	
	LCD_1_Start();
	
	// Initialise le buffer d'envoi et de réception
    UART_1_CmdReset(); 
	
	// Autorisation des interruptions globales
	M8C_EnableGInt;
    
    //Autorise les interruptions sur RX
    UART_1_IntCntl(UART_1_ENABLE_RX_INT);       
   
	// Paramétrage pour aucun bit de parité
    UART_1_Start(UART_1_PARITY_NONE);
	
	// Démarrage du Timer au vu d'ajouter une deuxième caméra
	Timer32_1_Start();
	
	// Autorisation des interruptions pour le timer
	Timer32_1_EnableInt();
	
	LED1_PWM_Start();
	LED2_PWM_Start();
	
	SPIM_1_Start(SPIM_1_SPIM_MODE_0 | SPIM_1_SPIM_MSB_FIRST);  
	SPIM_2_Start(SPIM_2_SPIM_MODE_0 | SPIM_2_SPIM_MSB_FIRST); 
	
	
	while (1){
		}
}
Exemplo n.º 3
0
void main(void)
{	
    // Enable Global Interrupts
    M8C_EnableGInt;      
   
    // Start baud rate generator
    Counter8_1_Start();       
   
    LCD_1_Start();
	
    // Load the receiver configuration
    LoadConfig_Receiver();
	
	RX8_2_Start(RX8_2_PARITY_NONE);
	
	while (1)
	{	
	typedef
		enum
		{
			PARSE_STATE_INIT,
			PARSE_STATE_WIFI,
			PARSE_STATE_LAT,
			PARSE_STATE_LONG
		} states;

	int str_ptr;
	char wifi_str[32];
	char lat[32];
	char lon[32];
	char newchar;
	
	states state = PARSE_STATE_INIT;
		// new char
		newchar = RX8_2_cGetChar();
		
		switch (state)
		{
			case (PARSE_STATE_INIT):
				if (newchar == ';')
				{
					state = PARSE_STATE_WIFI;
					str_ptr = 0;
				}
				break;
			
			case (PARSE_STATE_WIFI):
				while(newchar != ':')
				{
					wifi_str[str_ptr++] = newchar;
				}
				state = PARSE_STATE_LAT;
				LCD_1_Position(0,0);
				LCD_1_PrString(wifi_str);
				str_ptr = 0;
				break;
				
			case (PARSE_STATE_LAT):
				while(newchar != '!')
				{
					lat[str_ptr++] = newchar;
				}
				state = PARSE_STATE_LONG;
				LCD_1_Position(0,7);
				LCD_1_PrString(lat);
				str_ptr = 0;
				break;
				
			case (PARSE_STATE_LONG):
				while(newchar != '#')
				{
					lon[str_ptr++] = newchar;
				}
				state = PARSE_STATE_INIT;
				LCD_1_Position(1,7);
				LCD_1_PrString(lon);
				str_ptr = 0;
				break;
		}
		
	}
}