• 大小: 15.3MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-21
  • 语言: 其他
  • 标签: ads1118  tm4c  

资源简介

这里包括基于tm4c的ads1118的程序,可以发射还能测试电压,还能测量一些其他的东西,还有tm4c的工程模板!

资源截图

代码片段和文件信息

#include “Ads1118Driver.h“

#define ADS1118DELAYUS(x)       SysCtlDelay(x*120)

void ADS1118Init()
{
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

GPIOPinTypeGPIOOutput(GPIO_PORTE_baseGPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2);
  GPIOPinTypeGPIOInput(GPIO_PORTE_baseGPIO_PIN_3);
  ADS1118TxRxDataMODE32Bits(ADC_MODE|CONTINUOUS_CONVERSION_MODE|DATA_RATE_860_SPS|AIN0_P_AND_GND_N|DOUT_DRDY_PIN_PULL_UP_ENABLE|VALID_DATA|FULL_SCALE_SIGNED_4_096V0);
}


//Note:This Function can‘t read back the CONFIG REGISTER

/*
uint16_t ADS1118TxRxDataMODE16Bits(uint16_t TxDatabool RxOrTX)
{
uint16_t RxData;
int i;
ADS1118_SCLK_L;
ADS1118_CS_H;
  ADS1118_CS_L;

   if(RxOrTX)
{
while(ADS1118READBIT()!=0);
}

 for(i=0;i<16;i++)
{   

if(TxData&(0x8000>>i))
{
 ADS1118_DIN_H;
}
else 
{
 ADS1118_DIN_L;   
}
ADS1118_SCLK_H; 
if(ADS1118READBIT()!=0)
{
RxData|= ((uint32_t)(0x00000001))<<(15-i);
}
ADS1118DELAYUS(2000);
       ADS1118_SCLK_L;
ADS1118DELAYUS(2000);
   }
ADS1118_CS_H;
ADS1118DELAYUS(2000);
return RxData;
}

*/


uint32_t ADS1118TxRxDataMODE32Bits(uint16_t TxDatabool RxOrTX)
{
uint32_t RxData;
int ij;
ADS1118_SCLK_L;
ADS1118_CS_H;
  ADS1118_CS_L;
    if(RxOrTX)
{
for(j=0;j<10000;j++)
     {
if(ADS1118READBIT()!=0)
{

}
else
{

break;
}
     }
}
 for(i=0;i<16;i++)
{   

if(TxData&(0x8000>>i))
{
 ADS1118_DIN_H;
}
else 
{
 ADS1118_DIN_L;   
}
ADS1118_SCLK_H;
ADS1118DELAYUS(2000);
if(ADS1118READBIT()!=0)
{
RxData|= ((uint32_t)(0x00000001))<<(31-i);
}
ADS1118_SCLK_L;
ADS1118DELAYUS(2000);
}

 for(i=0;i<16;i++)
{   

if(TxData&(0x8000>>i))
{
 ADS1118_DIN_H;
}
else 
{
 ADS1118_DIN_L;   
}
ADS1118_SCLK_H;
ADS1118DELAYUS(2000);
if(ADS1118READBIT()!=0)
{
RxData|= ((uint32_t)(0x00000001))<<(15-i);
}
      ADS1118_SCLK_L;
ADS1118DELAYUS(2000);
   }


ADS1118_CS_H;
return RxData;
}





double ADS1118ValGet(uint16_t fullScaleSignedMallocdouble fullScale)
{

static uint32_t sRecData;
static uint16_t sADSData;
//uint16_t ADSReg;
double sVol;

  /*RecData=ADS1118TxRxDataMODE32Bits(ADC_MODE|CONTINUOUS_CONVERSION_MODE|DATA_RATE_860_SPS|AIN0_P_AND_GND_N|DOUT_DRDY_PIN_PULL_UP_ENABLE|VALID_DATA|fullScaleSignedMalloc1);*/
sRecData=ADS1118TxRxDataMODE32Bits(ADC_MODE|CONTINUOUS_CONVERSION_MODE|DATA_RATE_860_SPS|AIN0_P_AND_GND_N|DOUT_DRDY_PIN_PULL_UP_ENABLE|VALID_DATA|fullScaleSignedMalloc1);
sADSData=(sRecData&0xFFFF0000)>>16;
sVol=(sADSData<=0X7FFF)?((sADSData/32768.0)*fullScale):((-(0XFFFF-sADSData)/32767.0)*fullScale);
//  ADSReg=(RecData&0x0000ffff);

 return sVol;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2904  2019-07-17 12:29  ads\ads1118 (1)\application\Ads1118Driver.c

     文件       3197  2019-07-17 12:29  ads\ads1118 (1)\application\Ads1118Driver.h

     文件       9390  2015-07-18 10:20  ads\ads1118 (1)\application\drivers\ascii1608.h

     文件      13794  2016-05-28 00:14  ads\ads1118 (1)\application\drivers\ili9341_driver_tm4c.c

     文件       3585  2016-05-07 10:47  ads\ads1118 (1)\application\drivers\ili9341_driver_tm4c.h

     文件       4147  2016-05-27 18:39  ads\ads1118 (1)\application\drivers\ps2_driver_tm4c.c

     文件       1029  2016-05-04 19:25  ads\ads1118 (1)\application\drivers\ps2_driver_tm4c.h

     文件       2545  2016-05-03 12:47  ads\ads1118 (1)\application\drivers\ps2_keyboardtable.h

     文件        767  2019-07-17 15:26  ads\ads1118 (1)\application\main.C

     文件      15759  2016-04-19 17:17  ads\ads1118 (1)\application\startup_rvmdk.S

     文件     173102  2019-07-17 19:46  ads\ads1118 (1)\project\ads1118.uvguix.beautiful window

     文件     169878  2016-07-27 13:48  ads\ads1118 (1)\project\ads1118.uvguix.xc

    .......     71097  2019-07-19 18:43  ads\ads1118 (1)\project\ads1118.uvguix.yanliang

    .......     10248  2019-07-19 18:43  ads\ads1118 (1)\project\ads1118.uvoptx

    .......     16676  2019-07-19 18:43  ads\ads1118 (1)\project\ads1118.uvprojx

     文件        339  2019-07-17 19:38  ads\ads1118 (1)\project\EventRecorderStub.scvd

     文件      47640  2019-07-17 19:37  ads\ads1118 (1)\project\Listings\ads1118.map

     文件      42897  2019-07-17 19:37  ads\ads1118 (1)\project\Listings\startup_rvmdk.lst

     文件      29488  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ads1118.axf

     文件       1785  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ads1118.build_log.htm

     文件      14733  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ads1118.htm

     文件        486  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ads1118.lnp

     文件        479  2016-07-19 23:01  ads\ads1118 (1)\project\objects\ads1118.sct

     文件      48779  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ads1118driver.crf

     文件        505  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ads1118driver.d

     文件      46648  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ads1118driver.o

     文件       4882  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ads1118_Target 1.dep

     文件         19  2019-07-17 19:46  ads\ads1118 (1)\project\objects\ExtDll.iex

     文件     161526  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ili9341_driver_tm4c.crf

     文件        645  2019-07-17 19:37  ads\ads1118 (1)\project\objects\ili9341_driver_tm4c.d

............此处省略1099个文件信息

评论

共有 条评论