MotorControlModuleSDFM_TMS3.../Projects/epwm_test/epwm_test.c
2023-09-12 16:09:57 +03:00

122 lines
2.4 KiB
C

//###########################################################################
//
// FILE: epwm_test.c
//
//
//
//###########################################################################
//
//###########################################################################
//
// Included Files
//
#include "f28x_project.h"
#include "init_perif.h"
#include"frm_uart.h"
#include "i2c_init.h"
#include "BL25CM1A.h"
#include "GD25Q16ETIGR.h"
#include "ZD24C02A.h"
//
// Main
//
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 ;
uint16_t sendNow = 0;
uint16_t TestADR = 0;
uint16_t NByte = 16;
uint16_t WriteI2C = 0;
uint16_t Adr = 0;
Uint16 MainTimerTimeouts = 0;
void MainTimerBaseTimeoutInc(void)
{
MainTimerTimeouts++;
}
uint16_t ArrayForTests[MAX_BUFFER_SIZE] = {0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xA0};
uint16_t ArrayMax[256];
void main(void)
{
InitPerif();
FRMUartInit();
// GD25Q16ETIGR_en();
// Bl25cm1a_en();
//
// IDLE loop. Just sit and loop forever (optional):
//
for(;;)
{
asm (" NOP");
if(sendNow)
{
// Bl25cm1a_write();
// GD25Q16ETIGR_write();
if(WriteI2C)
{
for(Adr = 0; Adr < 255; Adr+=15)
{
ArrayForTests[0] = Adr;
ZD24C02A_write(NByte, ArrayForTests);
MainTimerTimeouts=0;
while(MainTimerTimeouts<1000);
while(!GpioDataRegs.GPADAT.bit.GPIO1);
}
}
else
{
ArrayMax[0] = Adr;
NByte = 254;
ZD24C02A_read(NByte, ArrayMax);
}
sendNow = 0;
}
if(TestADR)
{
ZD24C02A_test(ArrayForTests);
TestADR = 0;
}
if(FMSTR_is_enable()) {
if(counter < 100) counter++;
else
{
counter = 0;
if(counter1 < 100) counter1++;
else
{
counter1=0;
counter2++;
}
}
FMSTR_Poll();
FMSTR_Recorder();
FMSTR_enable_clr();
}
}
}
//
// End of file
//