Beispiel #1
0
void update_screen(UART_instance_t * this_uart, int deg, float kp, float ki, float kd, float digit, k_value_t k_value)
{
	// Print the pendulum
	print_degrees(this_uart, deg);

	// Print the constants
	set_x(this_uart, 32);
	set_y(this_uart, 16);
	delay();
	char buffer[64];
	sprintf(buffer, "%07.3f\r\n%07.3f\r\n%07.3f", kp, ki, kd);
	UART_polled_tx_string( this_uart, (const uint8_t *)&buffer);

	// Clear the digit block
	erase_block(this_uart, 112, 16, 159, 56);

	// Print the digit increment/decrement
	set_x(this_uart, 112);
	delay();
	char digit_buffer[16];
	sprintf(digit_buffer, "%07.3f", digit);
	if (k_value == KP)
	{
		set_y(this_uart, 16);
	} else if (k_value == KI) {
		set_y(this_uart, 24);
	} else {
		set_y(this_uart, 32);
	}
	UART_polled_tx_string( this_uart, (const uint8_t *)&digit_buffer);
}
Beispiel #2
0
int main()
{
	MSS_UART_init
	(
		&g_mss_uart1,
	    MSS_UART_115200_BAUD,
	    MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT
	);

	clear_screen();

	float x = -90;
	while (1)
	{
		print_degrees(x);

		//Busy
		int i;
		for (i = 0; i < 1000000; i++)
		{
		}

		x += 10;

		if (x > 90)
			x = -90;
	}



	return 0;
}