資源簡介
F28335+CPLD
代碼片段和文件信息
/*-----------------------包含頭文件-----------------------------*/
//#define?extern
#include?“DSP28x_Project.h“
#include?“function.h“
#include?“ADS8588.h“
#include?“DSP2833x_I2c_defines.h“
//#include?“Common.h“
//#include?“stdlib.h“
//#include?“IQmathLib.h“
/*-----------------------參數(shù)定義-----------------------------*/
#define?DELAY?1000000L
#define?Channel_AD2_Port???????????????????????????????????0x180001?//?(0x2061)
#define?Channel_AD1_Port???????????????????????????????????0x180000?//?(0x2061)
/*-----------------------變量聲明-----------------------------*/
extern?Uint16?RamfuncsLoadStart;
extern?Uint16?RamfuncsRunStart;
extern?Uint16?RamfuncsLoadSize;
Uint16?*recb;
Uint16?sys_state?=?0;
int16???TEST[16];
unsigned?int?fault_flag;
unsigned?int?Int_Switch_Flag;
char?ReceivedChar;
Uint16?duty?=?500;
int16?*msg;
int??i=0;
int16?l_temp?=?0;
Uint32?*ADREAD?=?(Uint32*)0x180001;
struct?I2CMSG?I2cMsgIn1;
Uint16?time[7];
struct?TIME?Stime;
struct?TIME?Ntime;
Uint16?tempw[100];
Uint16?tempr[100];
//extern?char?RecCharb[16];
char?recbyebrecbyectestbye;
?char?SendCharb[16];
?char?para[100][16]state[100][8]command[20][8];
?Uint8?value;
//?extern?Uint8?count;
?Uint8?oldcount=0;
?Uint8?newcount=0;
?Uint8?flag=0;
?Uint8?len=0;
?Uint8?Intcount=0;
?Uint8?scibflag=0;
/*-----------------------函數(shù)聲明-----------------------------*/
//SCIB-485
//__interrupt?void?epwm1_isr(void);
__interrupt?void?xint1_isr(void);
__interrupt?void?tzint_isr(void);
__interrupt?void?epwm1_isr(void);
void?main(void)
{
????char?SendCharc[16];
????char?RecCharc[16];
????char?readdin1;
????char?readdin2;
????char?readdin3;
????char?readdin4;
????Uint16?testspi;
????Uint16?temp;
????char?i;
????Stime.Second=0x00;
????Stime.Minute=0x00;
????Stime.Hour=0x00;
????Stime.Day=0x01;
????Stime.Date=0x06;
????Stime.Month=0x03;
????Stime.Year=0x17;
???InitSysCtrl();//系統(tǒng)初始化
???memcpy(&RamfuncsRunStart?&RamfuncsLoadStart?(Uint32)&RamfuncsLoadSize);//程序從flash搬到ram
???InitFlash();
???DINT;
???InitPieCtrl();
???IER?=?0x0000;
???IFR?=?0x0000;
???InitPieVectTable();
???EALLOW;??//?This?is?needed?to?write?to?EALLOW?protected?registers
???PieVectTable.EPWM1_INT?=?&epwm1_isr;//pwm中斷
???PieVectTable.XINT1?=?&xint1_isr;//AD轉(zhuǎn)換完成中斷
???PieVectTable.EPWM1_TZINT?=?&tzint_isr;//TZ?中斷
???EDIS;????//?This?is?needed?to?disable?write?to?EALLOW?protected?registers
???Initial();
???PieCtrlRegs.PIECTRL.bit.ENPIE?=?1;//?Enable?the?PIE?block
???PieCtrlRegs.PIEIER3.bit.INTx1?=?1;//
???PieCtrlRegs.PIEIER1.bit.INTx4?=?1;//
???PieCtrlRegs.PIEIER2.bit.INTx1?=?1;//
???IER?|=?M_INT1;??????????????????????????????//?Enable?CPU?int1
???IER?|=?M_INT2;??????????????????????????????//?Enable?CPU?int1
???IER?|=?M_INT3;??????????????????????????????//?Enable?CPU?int3
//?Enable?global?Interrupts?and?higher?priority?real-time?debug?events:
???EINT;???//?Enable?Global?interrupt?INTM
???ERTM;???//?Enable?Global?realtime?interrupt?DBGM
/*???AD_RST_HIGH;
???DELAY_US(1);
???AD_RST_HIGH;
???DELAY_US(10);*/
???Set_Time(&Stime);
?
- 上一篇:PV操作的實現(xiàn)源代碼+報告
- 下一篇:AE真正的合成復(fù)制腳本教程
評論
共有 條評論