TestDeUart para MATLAB

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

#include <stdio.

h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "MK64F12.h"
#include "fsl_debug_console.h"
#include "fsl_uart.h"

#include <DSP/Include/arm_math.h>

/* TODO: insert other include files here. */


#include "fsl_gpio.h"
#include "fsl_common.h"
#include "stdbool.h"
#include "stdint.h"

#define BUFFER_SIZE 1024

q15_t buffer[BUFFER_SIZE];

int main(void) {
/* Init board hardware. */
uart_config_t config;

UART_GetDefaultConfig(&config);
config.baudRate_Bps = 115200;
UART_Init(UART0, &config, CLOCK_GetFreq(kCLOCK_CoreSysClk));

BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();

#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
/* Init FSL debug console. */
BOARD_InitDebugConsole();
#endif

int i;
for (i = 0; i < BUFFER_SIZE; i++) {
buffer[i] = i;
}

while (1) {
for (i = 0; i < BUFFER_SIZE; i++) {
// env�a "Resultado:" seguido del valor de la variable y un salto de
l�nea
char buffer_string[8];
sprintf(buffer_string, "%d\n", buffer[i]);
int j;
for (j = 0; j < strlen(buffer_string); j++)
{
UART_WriteByte(UART0, buffer_string[j]);
}
SDK_DelayAtLeastUs(1000, SystemCoreClock);
}
}
return 0;
}

You might also like