/**
 * \brief The main application
 *
 * This application will initialize the UART, send a character and then receive
 * it and check if it is the same character as was sent.
 *
 * \note The RX and TX pins should be externally connected in order to pass the
 * test.
 */
int main(void)
{
	uint8_t data;
	uint8_t cnt;
	cli();
	uart_init();
	sei();

	// Send the test string
	for (cnt = 0; cnt < strlen(test_string); cnt++) {
		uart_putchar(test_string[cnt]);
	}

	// Check if we have received the string we sent
	cnt = 0;
	do {
		// Wait for next character
		while (!uart_char_waiting());
		data = uart_getchar();
		// Compare to what we sent
		Assert (data == test_string[cnt++]);
	} while (cnt < strlen(test_string));

	while (true);
}
Example #2
0
/**
 * \brief The main application
 *
 * This application will initialize the UART, send a character and then receive
 * it and check if it is the same character as was sent.
 *
 * \note The RX and TX pins should be externally connected in order to pass the
 * test.
 */
int main(void)
{
	uint8_t data;
	uint8_t cnt;
	uint16_t cntout = 0;
	cli();
	uart_init();
	sei();

	// Send the test string
	for (cnt = 0; cnt < strlen(test_string); cnt++) {
		uart_putchar(test_string[cnt]);
	}
    // output a counter
	do {
		itoa(cntout, num_string, 10);
		for (cnt = 0; cnt < strlen(num_string); cnt++) {
			uart_putchar(num_string[cnt]);
		}
		uart_putchar('\n');
		delay_ms(1000);
		cntout++;
		
	} while (cntout < 65500);
	// Check if we have received the string we sent
	cnt = 0;
	do {
		// Wait for next character
		while (!uart_char_waiting());
		data = uart_getchar();
		// Compare to what we sent
//		Assert (data == test_string[cnt++]);
	} while (cnt < strlen(test_string));

	while (1);
}