• 大小: 1.37MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-10-25
  • 语言: 其他
  • 标签:   28377  

资源简介

DSP28377s的完整标准程序,已经在装置上运行,系统设置/ADC/PWM/定时器/GPIO/UART/IIC/SPI所有接口齐全,仿照就能用!

资源截图

代码片段和文件信息

//###########################################################################
// FILE:   F2837xS_Adc.c
// title:  F2837xS Adc Support Functions.
//###########################################################################
// $TI Release: F2837xS Support Library v191 $
// $Release Date: Fri Mar 11 15:58:35 CST 2016 $
// $Copyright: Copyright (C) 2014-2016 Texas Instruments Incorporated -
//             http://www.ti.com/ ALL RIGHTS RESERVED $
//###########################################################################

#include “F2837xS_device.h“     // F2837xS Headerfile Include File
#include “F2837xS_Examples.h“   // F2837xS Examples Include File

/* 
* Set the resolution and signalmode for a given ADC. This will ensure that
* the correct trim is loaded. 
*/
void AdcSetMode(Uint16 adc Uint16 resolution Uint16 signalmode)
{
Uint16 adcOffsetTrimOTPIndex; //index into OTP table of ADC offset trims
Uint16 adcOffsetTrim; //temporary ADC offset trim

//re-populate INL trim
CalAdcINL(adc);

if(0xFFFF != *((Uint16*)0x0703AC)){
//offset trim function is programmed into OTP so call it

//calculate the index into OTP table of offset trims and call
//function to return the correct offset trim
adcOffsetTrimOTPIndex = 4*adc + 2*resolution + 1*signalmode;
adcOffsetTrim = (*GetAdcOffsetTrimOTP)(adcOffsetTrimOTPIndex);
}
else {
//offset trim function is not populated so set offset trim to 0
adcOffsetTrim = 0;
}

//Apply the resolution and signalmode to the specified ADC.
//Also apply the offset trim and if needed linearity trim correction.
switch(adc){
case ADC_ADCA:
AdcaRegs.ADCCTL2.bit.RESOLUTION = resolution;
AdcaRegs.ADCCTL2.bit.SIGNALMODE = signalmode;
AdcaRegs.ADCOFFTRIM.all = adcOffsetTrim;
if(ADC_RESOLUTION_12BIT == resolution){

//12-bit linearity trim workaround
AdcaRegs.ADCINLTRIM1 &= 0xFFFF0000;
AdcaRegs.ADCINLTRIM2 &= 0xFFFF0000;
AdcaRegs.ADCINLTRIM4 &= 0xFFFF0000;
AdcaRegs.ADCINLTRIM5 &= 0xFFFF0000;
}
break;
case ADC_ADCB:
AdcbRegs.ADCCTL2.bit.RESOLUTION = resolution;
AdcbRegs.ADCCTL2.bit.SIGNALMODE = signalmode;
AdcbRegs.ADCOFFTRIM.all = adcOffsetTrim;
if(ADC_RESOLUTION_12BIT == resolution){

//12-bit linearity trim workaround
AdcbRegs.ADCINLTRIM1 &= 0xFFFF0000;
AdcbRegs.ADCINLTRIM2 &= 0xFFFF0000;
AdcbRegs.ADCINLTRIM4 &= 0xFFFF0000;
AdcbRegs.ADCINLTRIM5 &= 0xFFFF0000;
}
break;
case ADC_ADCC:
AdccRegs.ADCCTL2.bit.RESOLUTION = resolution;
AdccRegs.ADCCTL2.bit.SIGNALMODE = signalmode;
AdccRegs.ADCOFFTRIM.all = adcOffsetTrim;
if(ADC_RESOLUTION_12BIT == resolution){

//12-bit linearity trim workaround
AdccRegs.ADCINLTRIM1 &= 0xFFFF0000;
AdccRegs.ADCINLTRIM2 &= 0xFFFF0000;
AdccRegs.ADCINLTRIM4 &= 0xFFFF0000;
AdccRegs.ADCINLTRIM5 &= 0xFFFF0000;
}
break;
case ADC_ADCD:
AdcdRegs.ADCCTL2.bit.RESOLUTION = resolution;
AdcdRegs.ADCCTL2.bit.SIGNALMODE = signalmode;
AdcdRegs.ADCOFFTRIM.all = adcOffsetT

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-07-26 17:27  TjIsolationCubicle\
     文件         560  2017-07-26 17:30  TjIsolationCubicle\.ccsproject
     文件       23817  2017-07-29 13:05  TjIsolationCubicle\.cproject
     目录           0  2017-07-26 17:27  TjIsolationCubicle\.launches\
     文件       10415  2017-07-29 19:24  TjIsolationCubicle\.launches\TjIsolationCubicle.launch
     文件         848  2017-07-13 08:16  TjIsolationCubicle\.project
     目录           0  2017-07-13 08:22  TjIsolationCubicle\.settings\
     文件          62  2017-07-13 08:16  TjIsolationCubicle\.settings\org.eclipse.cdt.codan.core.prefs
     文件         123  2017-07-13 08:16  TjIsolationCubicle\.settings\org.eclipse.cdt.debug.core.prefs
     文件         477  2017-07-13 08:22  TjIsolationCubicle\.settings\org.eclipse.core.resources.prefs
     文件        6743  2017-07-31 14:32  TjIsolationCubicle\28377S_FLASH_lnk.cmd
     目录           0  2017-07-31 14:22  TjIsolationCubicle\Debug\
     文件       68997  2017-07-31 14:22  TjIsolationCubicle\Debug\TjIsolationCubicle.map
     文件      474100  2017-07-31 14:22  TjIsolationCubicle\Debug\TjIsolationCubicle.out
     文件      315014  2017-07-31 14:22  TjIsolationCubicle\Debug\TjIsolationCubicle_linkInfo.xml
     文件        1338  2017-07-31 14:21  TjIsolationCubicle\Debug\ccsObjs.opt
     目录           0  2017-07-13 08:22  TjIsolationCubicle\Debug\lib\
     文件         289  2017-07-29 13:06  TjIsolationCubicle\Debug\lib\subdir_rules.mk
     文件         458  2017-07-29 13:06  TjIsolationCubicle\Debug\lib\subdir_vars.mk
     文件        7429  2017-07-31 14:21  TjIsolationCubicle\Debug\makefile
     文件         346  2017-07-29 13:06  TjIsolationCubicle\Debug\objects.mk
     目录           0  2017-07-29 13:34  TjIsolationCubicle\Debug\source\
     文件       28187  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_Adc.obj
     文件        7379  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_Adc.pp
     文件        1572  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_CodeStartBranch.obj
     文件        5889  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_CpuTimers.obj
     文件        7721  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_CpuTimers.pp
     文件        1202  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_DBGIER.obj
     文件       50529  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_DefaultISR.obj
     文件        7778  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_DefaultISR.pp
     文件       55881  2017-07-29 13:34  TjIsolationCubicle\Debug\source\F2837xS_Dma.obj
............此处省略198个文件信息

评论

共有 条评论