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

📄 ads8364.c.bak

📁 c6713的源代码
💻 BAK
字号:
#include "IMU_GW.h"

/*******************************************************************************
 FUNC	: hardware_init__adc
 DESC	: Prepare the DSK/EVM for the ADC conversions. Initialize the McBSP1 port
          as GPIO, issue the Software COnfiguration command.  See ADS8364.h
 *******************************************************************************/
void software_init_ADC()
{
	//adc_ready   = 0;       // Initialize vars
	software_cfig(CMD1);   //CMD1=0x0086
    //adc_readNdx = 0;
    //adc_ready   = 1;
}

/*******************************************************************************
 FUNC	: software_init_ADC()
 DESC	: Software Configruation command - see ADS8364.h for CMD1 value
 ARGS	: cmd1 = configuration command value
 *******************************************************************************/
void software_cfig(unsigned short cmd1)
{
   *(unsigned volatile short *)ADC_Base = cmd1;// Initialize 
}

/*******************************************************************************
 FUNC	: software_cnvt()
 DESC	: Software Conversion command - see ADS8364.h for CMD0 value
 ARGS	: cmd0 = configure conversion command
 *******************************************************************************/
void software_cnvt(unsigned short cmd0, unsigned short reset)
{
	if(reset) 
	{
		*(unsigned volatile short *)ADC_Base = GBL_Reset;// Reset GBL_Reset=0x0007
	}
	*(unsigned volatile short *)ADC_Base = cmd0;// Start a Conversion
}

/*******************************************************************************
 FUNC	: software_read()
 DESC	: Software Read routines for the ADS8364 EVM
 ARGS	: Set Cycle Mode
 *******************************************************************************/
void software_read()
{
  	/*
	float tempF;  	 
	delay(1);
	if (ADD_Mode)
	{
		ADC_address[0] = (*(unsigned volatile short *)ADC_Base);
	}
	A0_temp[adc_readNdx] = (*(volatile short *)ADC_Base);
	tempF = (float)(A0_temp[adc_readNdx]*0.000076+2.5);
	*((float *)pAddr++) = tempF;

	if (ADD_Mode)
	{
		ADC_address[1] = (*(unsigned volatile short *)ADC_Base);
	}
	A1_temp[adc_readNdx] = (*(volatile short *)ADC_Base);
	tempF = (float)(A1_temp[adc_readNdx]*0.000076+2.5);
	*((float *)pAddr++) = tempF;

	if (ADD_Mode)
	{
		ADC_address[2] = (*(unsigned volatile short *)ADC_Base);
	}
	B0_temp[adc_readNdx] = (*(volatile short *)ADC_Base);
	tempF = (float)(B0_temp[adc_readNdx]*0.000076+2.5);
	*(pAddr++) = tempF;
	
	if (ADD_Mode)
	{
		ADC_address[3] = (*(unsigned volatile short *)ADC_Base);
	}
	B1_temp[adc_readNdx] = (*(volatile short *)ADC_Base);
	tempF = (float)(B1_temp[adc_readNdx]*0.000076+2.5);
	*(pAddr++) = tempF;

	if (ADD_Mode)
	{
		ADC_address[4] = (*(unsigned volatile short *)ADC_Base);
	}
	C0_temp[adc_readNdx] = (*(volatile short *)ADC_Base);
	tempF = (float)(C0_temp[adc_readNdx]*0.000076+2.5);
	*(pAddr++) = tempF;
	
	if (ADD_Mode)
	{
		ADC_address[5] = (*(unsigned volatile short *)ADC_Base);
	}
	C1_temp[adc_readNdx] = (*(volatile short *)ADC_Base);
	tempF = (float)(C1_temp[adc_readNdx]*0.000076+2.5);
	*(pAddr++) = tempF;

	adc_readNdx = adc_readNdx+1;
	adc_ready = 1;
	*/
}

/*******************************************************************************
 FUNC	: ext5_isr()
 DESC	: EXT5 interrupt routine. Called when ADS8364 generates the EOC pulse.
 ARGS	: void
 RET	: void
 *******************************************************************************/
interrupt void ext5_isr()
{
   	/*
	if((adc_totalNdx-1)%3==0)//error int!
	{
   		software_read();	
   	}
   	adc_totalNdx++;
    if(adc_readNdx == ADC_SAMPLE_SIZE)
    {
		adc_readNdx = 0;      // Sample loop finished?
		//software_cnvt(0, 1);  // Reset ADC
		//software_cfig(CMD1);  // Re-Configure ADC
	}
	*/
	/*
	if(adc_totalNdx==14400)
	{
		pAddr = (float*)(SDRAM_ADDR+0x200000);
	}
	*/
}  

/****************************************************************/
/* init_timer0                                                  */
/* This sets the DSP timer 0                                    */
/****************************************************************/
void init_timer0(void)
{
    *(unsigned volatile int *)TIMER1_CTRL  |= 0x303; 	// CPU CLK/4, 50% PLS, INV
    *(unsigned volatile int *)TIMER1_PRD 	= 25;       // pulse width 
    *(unsigned volatile int *)TIMER1_COUNT 	= 0;	    // Set counter 0
    *(unsigned volatile int *)TIMER1_CTRL = 0x03c3;
} 

⌨️ 快捷键说明

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