2023-08-23 16:31:55 +03:00
|
|
|
//###########################################################################
|
|
|
|
//
|
|
|
|
// FILE: epwm_test.c
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//###########################################################################
|
|
|
|
//
|
|
|
|
|
|
|
|
//###########################################################################
|
|
|
|
|
|
|
|
//
|
|
|
|
// Included Files
|
|
|
|
//
|
|
|
|
#include "f28x_project.h"
|
|
|
|
#include "init_perif.h"
|
|
|
|
#include"frm_uart.h"
|
2023-09-06 17:01:47 +03:00
|
|
|
#include "spi_init.h"
|
2023-08-23 16:31:55 +03:00
|
|
|
//
|
|
|
|
// Main
|
|
|
|
//
|
2023-09-04 09:40:41 +03:00
|
|
|
volatile uint16_t test=0x1234;
|
|
|
|
volatile uint16_t test1=0x6789;
|
|
|
|
volatile uint16_t counter=0 ;
|
|
|
|
volatile uint16_t counter1=0 ;
|
|
|
|
volatile uint16_t counter2=0 ;
|
2023-08-23 16:31:55 +03:00
|
|
|
|
2023-09-06 17:01:47 +03:00
|
|
|
|
|
|
|
uint16_t sdata = 0; // sent data
|
|
|
|
uint16_t rdata = 0; // received data
|
|
|
|
uint16_t error = 0;
|
|
|
|
|
|
|
|
|
2023-08-23 16:31:55 +03:00
|
|
|
void main(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
InitPerif();
|
|
|
|
FRMUartInit();
|
|
|
|
//
|
|
|
|
// IDLE loop. Just sit and loop forever (optional):
|
|
|
|
//
|
|
|
|
for(;;)
|
|
|
|
{
|
2023-09-06 17:01:47 +03:00
|
|
|
asm (" NOP");
|
|
|
|
|
|
|
|
transmitData(sdata);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Wait until data is received
|
|
|
|
//
|
|
|
|
while(SpiaRegs.SPIFFRX.bit.RXFFST != 1)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Check against sent data
|
|
|
|
//
|
|
|
|
rdata = SpiaRegs.SPIRXBUF;
|
|
|
|
if(rdata != sdata)
|
|
|
|
{
|
|
|
|
error++;
|
|
|
|
}
|
|
|
|
sdata++;
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-04 09:40:41 +03:00
|
|
|
|
|
|
|
if(FMSTR_is_enable()) {
|
|
|
|
if(counter < 100) counter++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
counter = 0;
|
|
|
|
if(counter1 < 100) counter1++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
counter1=0;
|
|
|
|
counter2++;
|
|
|
|
}
|
|
|
|
}
|
2023-08-23 16:31:55 +03:00
|
|
|
FMSTR_Poll();
|
2023-09-04 09:40:41 +03:00
|
|
|
FMSTR_Recorder();
|
|
|
|
FMSTR_enable_clr();
|
|
|
|
}
|
2023-08-23 16:31:55 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// End of file
|
|
|
|
//
|