⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 自己编写的dsp2812的小程序,大家看看,希望对大家有帮助.
💻 C
字号:
//###########################################################################
//
// FILE:    Main.c
//
// TITLE:   Wheel Abrasion Detection Program for Using TMS320F2812.
//
// ASSUMPTIONS:
//
//          This program requires some relative header files.  
//          As supplied, this project is configured for "boot to ZONE2" operation.
//
//          Other then boot mode configuration, no other hardware configuration
//          is required.   
//
// DESCRIPTION:
//
//          This is an example for detecting abrasion of train. And it will be 
//          used in spot running. The main purpose is that the measurement data
//          are obtained by the program for reasearching the characteristic of
//          abrasion of wheel.
//
//
//###########################################################################
//  Ver | dd  mmm  yyyy |  Who  | Description of changes
// =====|=============|=======|===============================================
//  1.00| 27  Aug. 2004 | Y.Z.Y | Third Version V1.5
//###########################################################################
#include  "F2812reg.h"
#include  "Main.h"
#include  "DSP281x_PieVect.h"
#include  "DSP281x_ECan.h"

uint16 EdgeRecord1[20];
uint16 EdgeRecord2[20];
//===========================================================================
//---------------------------------------------------------------------------
//Function name: Main
//Description: Implementing the main task of the project
//Input: No
//Output: No
//Extern Variables: No
//Called Model:
//Author: Zhiyi You
//Date: 12/Mar./2004
//---------------------------------------------------------------------------
//Modified Author:
//Date:
//Description:
//---------------------------------------------------------------------------
//===========================================================================
main()
{   
    int i;
    
    DisableDog();
    InitSysCtrl();
    XintfInit();
    GpioInit();
    EvInit();
    SciInit();
    AdcInit();
    InitPieCtrl();
    InitPieVectTable();
    ConfigCpuTimers();
    SpiInit();
    ECanInit();
    ECanConfig();
    EnableInterrupts();

	for( i = 0; i < 20; i++)
	{
		EdgeRecord1[i] = 0;
		EdgeRecord2[i] = 0;
	}
	STARTGPT1;
	STARTGPT2;
    while(1)
    {
    /*	for(i = 0; i < 20; i++)
    	{
    		EdgeRecord1[i] = i;
    	}*/
    } 
}
void PerformEvTimer1( void )
{
	static uint16 flag = 0;
	static uint16 count = 0;
	count ++;
	if( count >= 3)
	{
		count = 0;
		if(flag != 0)
		{
			GPACLEAR = 0x0001;
			flag = 0;
		}else
		{
			GPASET = 0x0001;
			flag ++;
		}
	}
} 
void PerformEvTimer2( void )
{
	static uint16 count = 0;
	count ++;
	
}
void PerformEvCap1( void )
{
	static int16 count1 = 0;
	static int16 count = 0;
	EdgeRecord1[count1] = CAP1FIFO;
	EdgeRecord1[count1 + 1] = CAP1FIFO;
	count1 += 2;   
	count ++;
	if(count1 >= 20)
	{
		count1 = 0;
	}
}
void PerformEvCap2( void )
{
	static int16 count2 = 0;
	
	EdgeRecord2[count2] = CAP2FIFO;
	EdgeRecord2[count2 + 1] = CAP2FBOT;
	count2 += 2;
	if(count2 >= 20)
	{
		count2 = 0;
	}
}
//end main function!

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -