Not applicable
Apr 23, 2017
10:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 23, 2017
10:42 PM
How to make, when receiving a parcel on the UART, MANCHESTER_SW_0 moved one parcel and waited for the next request for sending?
MANCHESTER_SW_0 code sends data constantly, when resending from UART 0x01 MANCHESTER_SW_0 stops responding to subsequent messages.
MANCHESTER_SW_0 code sends data constantly, when resending from UART 0x01 MANCHESTER_SW_0 stops responding to subsequent messages.
#include//Declarations from DAVE Code Generation (includes SFR declaration)
#include
#define UART_RX P1_3
#define UART_TX P1_2
uint16_t ReceiveData = 0;
/* Pins configuration */
XMC_GPIO_CONFIG_t uart_tx;
XMC_GPIO_CONFIG_t uart_rx;
/* UART configuration */
const XMC_UART_CH_CONFIG_t uart_config =
{
.data_bits = 8U,
.stop_bits = 1U,
.baudrate = 9600
};
/**
* @brief main() - Application entry point
*
* Details of function
* This routine is the application entry point. It is invoked by the device startup code. It is responsible for
* invoking the APP initialization dispatcher routine - DAVE_Init() and hosting the place-holder for user application
* code.
*/
int main(void)
{
DAVE_STATUS_t status;
status = DAVE_Init(); /* Initialization of DAVE APPs */
uart_tx.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7;
uart_rx.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
//led.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;
/* Configure UART channel */
XMC_UART_CH_Init(XMC_UART0_CH1, &uart_config);
XMC_UART_CH_SetInputSource(XMC_UART0_CH1, XMC_UART_CH_INPUT_RXD,USIC0_C1_DX0_P1_3);
/* Start UART channel */
XMC_UART_CH_Start(XMC_UART0_CH1);
/* Configure pins */
XMC_GPIO_Init(UART_TX, &uart_tx);
XMC_GPIO_Init(UART_RX, &uart_rx);
//NVIC_SetPriority(USIC0_1_IRQn,3U);
//NVIC_EnableIRQ(USIC0_1_IRQn);
if(status != DAVE_STATUS_SUCCESS)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */
XMC_DEBUG("DAVE APPs initialization failed\n");
while(1U)
{
}
}
/* Placeholder for user application code. The while loop below can be replaced with user application code. */
uint32_t temp1 = 0;
while(1U)
{
// for(int i=0;i<100;i++){
// MANCHESTER_SW_0.encoder->data=i; // update manchester_sw encoder data 10101010 01100101
// MANCHESTER_SW_Encode(&MANCHESTER_SW_0); //transmit manchester_sw data
// while(MANCHESTER_SW_0.encoder->status !=0);
// }
ReceiveData = XMC_UART_CH_GetReceivedData(XMC_UART0_CH1);
ReceiveData=1;
if(ReceiveData == 1){
MANCHESTER_SW_0.encoder->data = ReceiveData;
//MANCHESTER_SW_0.decoder->status = 0U;
MANCHESTER_SW_Encode(&MANCHESTER_SW_0);
temp1 = MANCHESTER_SW_0.encoder->status;
while(MANCHESTER_SW_0.encoder->status != 1);
}
ReceiveData = 0;
XMC_UART_CH_Transmit(XMC_UART0_CH1, ReceiveData);
ReceiveData = 0;
}
}
- Tags:
- IFX
- manchester_sw
0 Replies