/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    volatile uint32_t w_count;
    
    PIOR0 = 0x00U;
    PIOR1 = 0x00U;
    R_CGC_Create();
    R_PORT_Create();
    R_SAU0_Create();
    R_ADC_Create();
    R_TAU0_Create();
    R_RTC_Create();
    R_PCLBUZ0_Create();
    R_INTC_Create();
    R_TMR_RJ0_Create();
    R_TMR_RD0_Create();
    IAWCTL = 0x00U;
    /* Start data flash control */
    DFLEN = 1U;
    for (w_count = 0U; w_count < 6U; w_count++)
    {
        NOP();
    }
    /* End data flash control */
}
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    /* Enable writing to registers related to operating modes, LPC, CGC and software reset */
    SYSTEM.PRCR.WORD = 0xA50FU; 

    /* Enable writing to MPC pin function control registers */
    MPC.PWPR.BIT.B0WI = 0U;    
    MPC.PWPR.BIT.PFSWE = 1U;

    /* Initialize non-existent pins */
    PORT0.PDR.BYTE = 0x6BU;
    PORT3.PDR.BYTE = 0xD8U;
    PORT4.PDR.BYTE = 0xA0U;
    PORT5.PDR.BYTE = 0x80U;
    PORT9.PDR.BYTE = 0xF8U;
    PORTD.PDR.BYTE = 0xE0U;
    PORTF.PDR.BYTE = 0x3FU;
    PORTJ.PDR.BYTE = 0x32U;

    /* Set peripheral settings */
    R_CGC_Create();
    R_PORT_Create();
    R_SCI1_Create();

    /* Disable writing to MPC pin function control registers */
    MPC.PWPR.BIT.PFSWE = 0U;    
    MPC.PWPR.BIT.B0WI = 1U;     

    /* Enable protection */
    SYSTEM.PRCR.WORD = 0xA500U;  
}
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    DI();

    /* Enable writing to registers related to operating modes, LPC, CGC and ATCM */
    SYSTEM.PRCR.LONG = 0x0000A50BU;

    /* Enable writing to MPC pin function control registers */
    MPC.PWPR.BIT.B0WI = 0U;
    MPC.PWPR.BIT.PFSWE = 1U;

    r_set_exception_handler();

    /* Set peripheral settings */
    R_CGC_Create();
    R_ICU_Create();
    R_PORT_Create();
    R_TPU_Create();
    R_RSPI1_Create();
    R_MPC_Create();
	R_SCIFA2_Create();

    /* Disable writing to MPC pin function control registers */
    MPC.PWPR.BIT.PFSWE = 0U;
    MPC.PWPR.BIT.B0WI = 1U;

    /* Enable protection */
    SYSTEM.PRCR.LONG = 0x0000A500U;
    EI();
}
Exemplo n.º 4
0
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    PIOR = 0x00U;
    R_CGC_Get_ResetSource();
    R_PORT_Create();
    R_CGC_Create();
    CRC0CTL = 0x00U;
    IAWCTL = 0x00U;
}
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    PIOR0 = 0x00U;
    PIOR1 = 0x00U;
    R_CGC_Create();
    R_PORT_Create();
    R_SAU0_Create();
    R_TAU0_Create();
    IAWCTL = 0x00U;
}
Exemplo n.º 6
0
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    PIOR0 = 0x00U;
    PIOR1 = 0x00U;
    R_CGC_Get_ResetSource();
    R_PORT_Create();
    R_CGC_Create();
    R_IT_Create();
    R_INTC_Create();
    CRC0CTL = 0x00U;
    IAWCTL = 0x00U;
    PMS = 0x00U;
}
Exemplo n.º 7
0
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    PIOR0 = 0x1FU;
    PIOR1 = 0x07U;
    R_CGC_Get_ResetSource();
    R_PORT_Create();
    R_CGC_Create();
    R_SAU0_Create();
    R_IICA0_Create();
    R_WDT_Create();
    CRC0CTL = 0x00U;
    IAWCTL = 0x00U;
    PMS = 0x00U;
}
Exemplo n.º 8
0
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    PIOR0 = 0x00U;
    PIOR1 = 0x00U;
    R_PORT_Create();
    R_CGC_Create();
    R_SAU1_Create();
    R_ADC_Create();
    R_TAU0_Create();
    R_IT_Create();
    CRC0CTL = 0x00U;
    IAWCTL = 0x00U;
    PMS = 0x00U;
}
Exemplo n.º 9
0
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    PIOR = 0x00U;
    R_CGC_Get_ResetSource();
    R_PORT_Create();
    R_CGC_Create();
    R_TAU0_Create();
    R_TAU1_Create();
    DMAC0_Create();
    DMAC1_Create();
    DMAC2_Create();
    DMAC3_Create();
    R_INTC_Create();
    
    R_SAU0_Create();
    R_UART1_Create();
    
    CRC0CTL = 0x00U;
    IAWCTL = 0x00U;
}
Exemplo n.º 10
0
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description  : This function initializes every macro.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
    /* Enable writing to registers related to operating modes, LPC, LPT, LVD, CGC and software reset */
    SYSTEM.PRCR.WORD = 0xA50FU; 

    /* Enable writing to MPC pin function control registers */
    MPC.PWPR.BIT.B0WI = 0U;
    MPC.PWPR.BIT.PFSWE = 1U;

    /* Set peripheral settings */
    R_CGC_Create();
    R_ICU_Create();
    R_PORT_Create();

    /* Disable writing to MPC pin function control registers */
    MPC.PWPR.BIT.PFSWE = 0U;    
    MPC.PWPR.BIT.B0WI = 1U;     

    /* Enable protection */
    SYSTEM.PRCR.WORD = 0xA500U;  
}
Exemplo n.º 11
0
/***********************************************************************************************************************
* Function Name: main
* Description  : This function implements main function.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void main(void)
{
    R_MAIN_UserInit();
    /* Start user code. Do not edit comment generated here */

    int transmit_count = 0;
	R_UART2_Create();
	R_UART2_Start();
	uart2Status = R_UART2_Receive(&uart2RxBuf[0],1);	// Prime UART2 Rx

	R_TAU0_Create();
	R_TAU0_Channel0_Start();

	R_PORT_Create();

	R_ADC_Create();

	while (1U)
	{
		if(oneSec)
		{
			if(transmit)
				uart2Status = R_UART2_Send(uart2TxBuf, 1);

			counter++;
			oneSec = !oneSec;
		}

		if(uart2RxFlag)
		{
			uart2RxFlag = 0U;

			if(uart2RxBuf[0] == 'b')
			{
				uart2TxBuf[0] = counter;
				transmit_count = convertToNum(uart2TxBuf); //convert the ASCII symbols to integers instead.
				uart2Status = R_UART2_Send(uart2TxBuf, transmit_count);
			}
			else
			if(uart2RxBuf[0] == 'l')
				P7_bit.no7 = !P7_bit.no7;
			else
			if(uart2RxBuf[0] == 'a')
			{
				uint8_t adcvalue = 0;
				R_ADC_Start();
				while(!adc_done_flag); //wait for interrupt
				adc_done_flag = 0;
				R_ADC_Get_Result_8bit(&adcvalue);
				uart2TxBuf[0] = adcvalue;
				transmit_count = convertToNum(uart2TxBuf); //convert the ASCII symbols to integers instead.
				R_ADC_Stop();
				uart2Status = R_UART2_Send(uart2TxBuf, transmit_count);
			}
			else
			if(uart2RxBuf[0] == 't')
				transmit = !transmit;
			else
				uart2TxBuf[0] = uart2RxBuf[0];

			// Prime UART2 Rx
			uart2Status = R_UART2_Receive(uart2RxBuf, 1);
		}

		//If a character has been transmitted
		if (uart2TxFlag)
		{
			// End of UART2 transmit
			uart2TxFlag = 0U;   // clear tx flag
		}
	}

	R_UART2_Stop();
	R_TAU0_Channel0_Stop();
	//R_ADC_Stop();
	/* End user code. Do not edit comment generated here */
}