目录
简介:
ADS1263.c:
ADS1263.h:
测试结果:
简介:
主控:STM32H7B0VBT6
平台:STM32CubeIDE
ADS1263一片:
SPI配置:时钟极性和相位不要配错,时钟速率直接拉到数据手册规定的最大值8MHz:
文章来源:https://www.toymoban.com/news/detail-850213.html
ADS1263.c:
/********************************Copyright (c)**********************************\
**
** (c) Copyright 2023, Main, China, 被钢琴支配的悲惨大学生.
** All Rights Reserved
**
** By(被钢琴支配的悲惨大学生 personally owned)
** https://blog.csdn.net/m0_71226271?type=blog
**
**----------------------------------文件信息------------------------------------
** 文件名称: ADS1263.c
** 创建人员: 被钢琴支配的悲惨大学生
** 创建日期: 2023-09-04
** 文档描述:基于STM32H7B0VBT6的HAL库ADS1263驱动源码,使用硬件NSS
\********************************End of Head************************************/
#include "main.h"
#include "ADS1263.h"
#include "SPI.h"
/*************************************************************************************************
* 函 数 名: ADS1263_WREG
* 入口参数: Register_Address寄存器地址,Data_Byte写入的字节
* 返回值:无
* 函数功能: 对寄存器写入数据
* 说 明: 无
*************************************************************************************************/
void ADS1263_Write_Register(uint8_t Register_Address, uint8_t Data_Byte)
{
uint8_t SPI_Transmit_Data[3];
SPI_Transmit_Data[0]=0x40 | (Register_Address & 0x1F);//发送寄存器地址
SPI_Transmit_Data[1]=0x00;//发送需要更改的寄存器数量
SPI_Transmit_Data[2]=Data_Byte;//发送要写入寄存器的值
HAL_SPI_Transmit(&hspi2,SPI_Transmit_Data,3,HAL_MAX_DELAY);
}
/*************************************************************************************************
* 函 数 名: ADS1263_RREG
* 入口参数: Register_Address寄存器地址
* 返回值:读取到的寄存器的值
* 函数功能: 对寄存器读出数据
* 说 明: 无
*************************************************************************************************/
uint8_t ADS1263_Read_Register(uint8_t Register_Address)
{
uint8_t SPI_Transmit_Data[3];
uint8_t SPI_Receive_Data[3];
SPI_Transmit_Data[0]=0x20 | (Register_Address & 0x1F);
SPI_Transmit_Data[1]=0x00;
SPI_Transmit_Data[2]=0x00;
HAL_SPI_TransmitReceive(&hspi2,SPI_Transmit_Data,SPI_Receive_Data,3,HAL_MAX_DELAY);
return SPI_Receive_Data[2]; //返回读出的数据
}
/*************************************************************************************************
* 函 数 名: ADS1263_Conveision_Start_ADC1
* 入口参数: 无
* 返回值:无
* 函数功能: 启动ADC1的转换
* 说 明: 无
*************************************************************************************************/
void ADS1263_Conveision_Start_ADC1()
{
uint8_t SPI_Transmit_Data[1];
SPI_Transmit_Data[0]=ADS1263_CMD_START_ADC1;//发送ADC1开始转换数据命令
HAL_SPI_Transmit(&hspi2,SPI_Transmit_Data,1,HAL_MAX_DELAY);
}
/*************************************************************************************************
* 函 数 名: ADS1263_Conveision_Start_ADC2
* 入口参数: 无
* 返回值:无
* 函数功能: 启动ADC2的转换
* 说 明: 无
*************************************************************************************************/
void ADS1263_Conveision_Start_ADC2()
{
uint8_t SPI_Transmit_Data[1];
SPI_Transmit_Data[0]=ADS1263_CMD_START_ADC2;//发送ADC2开始转换数据命令
HAL_SPI_Transmit(&hspi2,SPI_Transmit_Data,1,HAL_MAX_DELAY);
}
/*************************************************************************************************
* 函 数 名: ADS1263_Config_Init
* 入口参数: 无
* 返回值:无
* 函数功能: ADS1263寄存器配置初始化
* 说 明: 请根据不同的应用场景更改函数内容
*************************************************************************************************/
void ADS1263_Config_Init()
{
//GPIO测试
/*ADS1263_WREG(ADS1263_GPIO_Connection,0x01);
ADS1263_WREG(ADS1263_GPIO_Direction,0x00);
ADS1263_WREG(ADS1263_GPIO_Data,0x01); */ //AIN3输出5V
//电流源测试
//ADS1263_WREG(ADS1263_IDACMUX,ADS1256_IDAC2_NO_CONNECTION|ADS1263_MUXN_AIN4);//IDAC1连接到AIN0
//ADS1263_WREG(ADS1263_IDACMAG,ADS1256_IDAC2_CURRENT_OFF|ADS1256_IDAC1_CURRENT_3000uA);//IDAC1输出3000uA
//TDAC测试
//ADS1263_WREG(ADS1263_TDACP_CONTROL,ADS1263_TDACP_OUTPUT_TO_AIN6|ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_75);//AIN6输出2.75V
//ADS1263_WREG(ADS1263_TDACN_CONTROL,ADS1263_TDACN_OUTPUT_TO_AIN7|ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_25);//AIN7输出2.25V
//通用配置
ADS1263_Write_Register(ADS1263_Mode_0,ADS1263_Chop_Mode_Enable);//开启输入切割模式(牺牲转换时间来增加信噪比),进入连续转换模式
ADS1263_Write_Register(ADS1263_Mode_1,ADS1263_SINC1_MODE);//使用SINC1滤波器,不同滤波器下的采样噪声会不同(使用SINC4滤波,在2.5SPS下转换延时是1600ms(见数据手册P63))
ADS1263_Write_Register(ADS1263_Mode_2,ADS1263_PGA_BYPASS|ADS1263_DATA_RATE_2_5_SPS);//PGA被旁路(否则转换数据值会偏小),数据速率2.5SPS
ADS1263_Write_Register(ADS1263_INTERFACE,ADS1263_STAUS_BYTE_ENABLE|ADS1263_CHECK_SUM_BYTE_DISABLE);//打开状态字节,关闭冗余校验
//ADC1配置
ADS1263_Write_Register(ADS1263_REFMUX,ADS1263_INTERNAL_2_5_REF_P|ADS1263_INTERNAL_2_5_REF_N);//使用内部基准
ADS1263_Write_Register(ADS1263_MUX_ADC1,ADS1263_MUXP_AIN1|ADS1263_MUXN_AINCOM);//AIN1正极输入,AINCOM负极输入
//ADC2配置
ADS1263_Write_Register(ADS1263_ADC2_CONFIGURATION,ADS1263_DATA_RATE_ADC2_10_SPS|ADS1263_INTERNAL_REF|ADS1263_PGA_GAIN_ADC2_1);//ADC2数据速率10SPS,使用内部基准,PGA=1
ADS1263_Write_Register(ADS1263_MUX_ADC2,ADS1263_MUXP_AIN1|ADS1263_MUXN_AINCOM);//AIN1正极输入,AINCOM负极输入
//启动转换
ADS1263_Conveision_Start_ADC1();//启动ADC(连续转换模式下,只启动一次)
ADS1263_Conveision_Start_ADC2();//启动ADC2转换
}
/*************************************************************************************************
* 函 数 名: ADS1263_ReadData_ADC1
* 入口参数: 无
* 返回值:无
* 函数功能: 读取ADC1的转换数据
* 说 明:以阻塞方式读取一个通道的数据,读取通道在ADS1263_Config_Init函数内部更改
*************************************************************************************************/
uint32_t ADS1263_ReadData_ADC1()
{
while(1)//轮询
{
uint8_t SPI_Transmit_Data[2];
uint8_t SPI_Receive_Data[2];
SPI_Transmit_Data[0]=ADS1263_CMD_RDATA_ADC1;//发送ADC1读取转换数据命令
SPI_Transmit_Data[1]=0x00;//垫零字节
HAL_SPI_TransmitReceive(&hspi2,SPI_Transmit_Data,SPI_Receive_Data,2,HAL_MAX_DELAY);//读取状态字节
if((SPI_Receive_Data[1]&0x40)>>6==1)//检查状态字节的bit6是否为1(为1代表接下来的ADC1数据是最新的,否则是旧的)
{
uint8_t SPI_Transmit_Data[6];
uint8_t SPI_Receive_Data[6];
SPI_Transmit_Data[0]=ADS1263_CMD_RDATA_ADC1;//发送ADC1读取转换数据命令
SPI_Transmit_Data[1]=0x00;//垫零字节
HAL_SPI_TransmitReceive(&hspi2,SPI_Transmit_Data,SPI_Receive_Data,6,HAL_MAX_DELAY);//直接读取6个字节
uint32_t Conveision_Data=(SPI_Receive_Data[2]<<24)|
(SPI_Receive_Data[3]<<16)|
(SPI_Receive_Data[4]<<8)|
(SPI_Receive_Data[5]<<0);//读取到的6字节数据的低4位拼凑成转换数据
return Conveision_Data;
}
}
}
/*************************************************************************************************
* 函 数 名: ADS1263_ReadData_ADC2
* 入口参数: 无
* 返回值:无
* 函数功能: 读取ADC2的转换数据
* 说 明:以阻塞方式读取一个通道的数据,读取通道在ADS1263_Config_Init函数内部更改
*************************************************************************************************/
uint32_t ADS1263_ReadData_ADC2()
{
while(1)//轮询
{
uint8_t SPI_Transmit_Data[2];
uint8_t SPI_Receive_Data[2];
SPI_Transmit_Data[0]=ADS1263_CMD_RDATA_ADC2;//发送ADC1读取转换数据命令
SPI_Transmit_Data[1]=0x00;//垫零字节
HAL_SPI_TransmitReceive(&hspi2,SPI_Transmit_Data,SPI_Receive_Data,2,HAL_MAX_DELAY);//读取状态字节
if((SPI_Receive_Data[1]&0x80)>>7==1)//检查状态字节的bit6是否为1(为1代表接下来的ADC1数据是最新的,否则是旧的)
{
uint8_t SPI_Transmit_Data[6];
uint8_t SPI_Receive_Data[6];
SPI_Transmit_Data[0]=ADS1263_CMD_RDATA_ADC2;//发送ADC1读取转换数据命令
SPI_Transmit_Data[1]=0x00;//垫零字节
HAL_SPI_TransmitReceive(&hspi2,SPI_Transmit_Data,SPI_Receive_Data,6,HAL_MAX_DELAY);//直接读取6个字节
uint32_t Conveision_Data=(SPI_Receive_Data[2]<<16)|
(SPI_Receive_Data[3]<<8)|
(SPI_Receive_Data[4]);
return Conveision_Data;
}
}
}
ADS1263.h:
/********************************Copyright (c)**********************************\
**
** (c) Copyright 2023, Main, China, 被钢琴支配的悲惨大学生.
** All Rights Reserved
**
** By(被钢琴支配的悲惨大学生 personally owned)
** https://blog.csdn.net/m0_71226271?type=blog
**
**----------------------------------文件信息------------------------------------
** 文件名称: ADS1263.h
** 创建人员: 被钢琴支配的悲惨大学生
** 创建日期: 2023-09-04
** 文档描述:
\********************************End of Head************************************/
#include "main.h"
extern SPI_HandleTypeDef hspi2;
/*******寄存器地址列表************/
#define ADS1263_MUX_ADC1 0x06
#define ADS1263_MUX_ADC2 0x16
#define ADS1263_INTERFACE 0x02
#define ADS1263_Mode_0 0x03
#define ADS1263_Mode_1 0x04
#define ADS1263_Mode_2 0x05
#define ADS1263_REFMUX 0x0F
#define ADS1263_GPIO_Connection 0x12
#define ADS1263_GPIO_Direction 0x13
#define ADS1263_GPIO_Data 0x14
#define ADS1263_TDACP_CONTROL 0x10
#define ADS1263_TDACN_CONTROL 0x11
#define ADS1263_ADC2_CONFIGURATION 0x15
#define ADS1263_IDACMUX 0x0D
#define ADS1263_IDACMAG 0x0E
/*******寄存器数据列表************/
#define ADS1263_PGA_ENABLE 0x00
#define ADS1263_PGA_BYPASS 0x80
#define ADS1263_PGA_GAIN_1 0x00
#define ADS1263_PGA_GAIN_2 0x10
#define ADS1263_PGA_GAIN_4 0x20
#define ADS1263_PGA_GAIN_8 0x30
#define ADS1263_PGA_GAIN_16 0x40
#define ADS1263_PGA_GAIN_32 0x50
#define ADS1263_DATA_RATE_2_5_SPS 0x00
#define ADS1263_DATA_RATE_5_SPS 0x01
#define ADS1263_DATA_RATE_10_SPS 0x02
#define ADS1263_DATA_RATE_16_6_SPS 0x03
#define ADS1263_DATA_RATE_20_SPS 0x04
#define ADS1263_DATA_RATE_50_SPS 0x05
#define ADS1263_DATA_RATE_60_SPS 0x06
#define ADS1263_DATA_RATE_100_SPS 0x07
#define ADS1263_DATA_RATE_400_SPS 0x08
#define ADS1263_DATA_RATE_1200_SPS 0x09
#define ADS1263_DATA_RATE_2400_SPS 0x0A
#define ADS1263_DATA_RATE_4800_SPS 0x0B
#define ADS1263_DATA_RATE_7200_SPS 0x0C
#define ADS1263_DATA_RATE_14400_SPS 0x0D
#define ADS1263_DATA_RATE_19200_SPS 0x0E
#define ADS1263_DATA_RATE_38400_SPS 0x0F
#define ADS1263_DATA_RATE_ADC2_10_SPS 0x00
#define ADS1263_DATA_RATE_ADC2_100_SPS 0x40
#define ADS1263_DATA_RATE_ADC2_400_SPS 0x80
#define ADS1263_DATA_RATE_ADC2_800_SPS 0xC0
#define ADS1263_INTERNAL_REF 0x00
#define ADS1263_INTERNAL_AIN0_1 0x08
#define ADS1263_INTERNAL_AIN2_3 0x10
#define ADS1263_INTERNAL_AIN4_5 0x18
#define ADS1263_INTERNAL_VDD_VSS 0x20
#define ADS1263_PGA_GAIN_ADC2_1 0x00
#define ADS1263_PGA_GAIN_ADC2_2 0x01
#define ADS1263_PGA_GAIN_ADC2_4 0x02
#define ADS1263_PGA_GAIN_ADC2_8 0x03
#define ADS1263_PGA_GAIN_ADC2_16 0x04
#define ADS1263_PGA_GAIN_ADC2_32 0x05
#define ADS1263_PGA_GAIN_ADC2_64 0x06
#define ADS1263_PGA_GAIN_ADC2_128 0x07
#define ADS1263_Chop_Mode_Enable 0x10
#define ADS1263_CONTINUOUS_CONVERSION 0x00
#define ADS1263_PULSE_CONVERSION 0x40
#define ADS1263_STAUS_BYTE_DISABLE 0x00
#define ADS1263_STAUS_BYTE_ENABLE 0x04
#define ADS1263_CHECK_SUM_BYTE_DISABLE 0x00
#define ADS1263_SINC1_MODE 0x00
#define ADS1263_SINC2_MODE 0x20
#define ADS1263_SINC3_MODE 0x40
#define ADS1263_SINC4_MODE 0x60
#define ADS1263_FIR_MODE 0x80
#define ADS1263_INTERNAL_2_5_REF_P 0x00
#define ADS1263_ENTERNAL_AIN0_P 0x08
#define ADS1263_ENTERNAL_AIN2_P 0x10
#define ADS1263_ENTERNAL_AIN4_P 0x18
#define ADS1263_INTERNAL_ANALOG_SUPPLY_P 0x20
#define ADS1263_INTERNAL_2_5_REF_N 0x00
#define ADS1263_ENTERNAL_AIN1_N 0x01
#define ADS1263_ENTERNAL_AIN3_N 0x02
#define ADS1263_ENTERNAL_AIN5_N 0x03
#define ADS1263_INTERNAL_ANALOG_SUPPLY_N 0x04
#define ADS1263_MUXP_AIN0 0x00
#define ADS1263_MUXP_AIN1 0x10
#define ADS1263_MUXP_AIN2 0x20
#define ADS1263_MUXP_AIN3 0x30
#define ADS1263_MUXP_AIN4 0x40
#define ADS1263_MUXP_AIN5 0x50
#define ADS1263_MUXP_AIN6 0x60
#define ADS1263_MUXP_AIN7 0x70
#define ADS1263_MUXP_AIN8 0x80
#define ADS1263_MUXP_AIN9 0x90
#define ADS1263_MUXP_AINCOM 0xA0
#define ADS1263_TEMPERATURE_SENSOR_MONITOR_P 0xB0
#define ADS1263_ANALOG_POWER_SUPPLY_MONITOR_P 0xC0
#define ADS1263_DIGITAL_POWER_SUPPLY_MONITOR_P 0xD0
#define ADS1263_TDAC_TEST_SIGNAL_P 0xE0
#define ADS1263_FLOAT_P 0xF0
#define ADS1263_MUXN_AIN0 0x00
#define ADS1263_MUXN_AIN1 0x01
#define ADS1263_MUXN_AIN2 0x02
#define ADS1263_MUXN_AIN3 0x03
#define ADS1263_MUXN_AIN4 0x04
#define ADS1263_MUXN_AIN5 0x05
#define ADS1263_MUXN_AIN6 0x06
#define ADS1263_MUXN_AIN7 0x07
#define ADS1263_MUXN_AIN8 0x08
#define ADS1263_MUXN_AIN9 0x09
#define ADS1263_MUXN_AINCOM 0x0A
#define ADS1263_TEMPERATURE_SENSOR_MONITOR_N 0x0B
#define ADS1263_ANALOG_POWER_SUPPLY_MONITOR_N 0x0C
#define ADS1263_DIGITAL_POWER_SUPPLY_MONITOR_N 0x0D
#define ADS1263_TDAC_TEST_SIGNAL_N 0x0E
#define ADS1263_FLOAT_N 0x0F
#define ADS1263_TDACP_OUTPUT_NO_CONNECTION 0x00
#define ADS1263_TDACP_OUTPUT_TO_AIN6 0x80
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_4_5 0x09
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_3_5 0x08
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_3 0x07
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_75 0x06
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_625 0x05
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_5625 0x04
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_53125 0x03
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_515625 0x02
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_5078125 0x01
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_5 0x00
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_4921875 0x11
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_484375 0x12
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_46875 0x13
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_4375 0x14
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_375 0x15
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2_25 0x16
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_2 0x17
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_1_5 0x18
#define ADS1263_TDACP_MAGP_OUTPUT_MAGNITUDE_0_5 0x19
#define ADS1263_TDACN_OUTPUT_NO_CONNECTION 0x00
#define ADS1263_TDACN_OUTPUT_TO_AIN7 0x80
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_4_5 0x09
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_3_5 0x08
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_3 0x07
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_75 0x06
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_625 0x05
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_5625 0x04
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_53125 0x03
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_515625 0x02
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_5078125 0x01
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_5 0x00
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_4921875 0x11
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_484375 0x12
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_46875 0x13
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_4375 0x14
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_375 0x15
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2_25 0x16
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_2 0x17
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_1_5 0x18
#define ADS1263_TDACN_MAGN_OUTPUT_MAGNITUDE_0_5 0x19
#define ADS1263_IDAC2_NO_CONNECTION 0xB0
#define ADS1263_IDAC1_NO_CONNECTION 0x0B
#define ADS1263_IDAC2_CURRENT_OFF 0x00
#define ADS1263_IDAC2_CURRENT_50uA 0x10
#define ADS1263_IDAC2_CURRENT_100uA 0x20
#define ADS1263_IDAC2_CURRENT_250uA 0x30
#define ADS1263_IDAC2_CURRENT_500uA 0x40
#define ADS1263_IDAC2_CURRENT_750uA 0x50
#define ADS1263_IDAC2_CURRENT_1000uA 0x60
#define ADS1263_IDAC2_CURRENT_1500uA 0x70
#define ADS1263_IDAC2_CURRENT_2000uA 0x80
#define ADS1263_IDAC2_CURRENT_2500uA 0x90
#define ADS1263_IDAC2_CURRENT_3000uA 0xA0
#define ADS1263_IDAC1_CURRENT_OFF 0x00
#define ADS1263_IDAC1_CURRENT_50uA 0x01
#define ADS1263_IDAC1_CURRENT_100uA 0x02
#define ADS1263_IDAC1_CURRENT_250uA 0x03
#define ADS1263_IDAC1_CURRENT_500uA 0x04
#define ADS1263_IDAC1_CURRENT_750uA 0x05
#define ADS1263_IDAC1_CURRENT_1000uA 0x06
#define ADS1263_IDAC1_CURRENT_1500uA 0x07
#define ADS1263_IDAC1_CURRENT_2000uA 0x08
#define ADS1263_IDAC1_CURRENT_2500uA 0x09
#define ADS1263_IDAC1_CURRENT_3000uA 0x0A
/************************指令************************/
#define ADS1263_CMD_NOP 0x00
#define ADS1263_CMD_RESET 0x06
#define ADS1263_CMD_RDATA_ADC1 0x12
#define ADS1263_CMD_RDATA_ADC2 0x14
#define ADS1263_CMD_START_ADC1 0x08
#define ADS1263_CMD_START_ADC2 0x0C
#define ADS1263_CMD_STOP_ADC1 0x0A
#define ADS1263_CMD_STOP_ADC2 0x0E
#define ADS1263_CMD_SYOCAL_ADC1 0x16
#define ADS1263_CMD_SYGCAL_ADC1 0x17
#define ADS1263_CMD_SFOCAL_ADC1 0x19
#define ADS1263_CMD_SYOCAL_ADC2 0x1B
#define ADS1263_CMD_SYGCAL_ADC2 0x1C
#define ADS1263_CMD_SFOCAL_ADC2 0x1E
//量化单位//(请校准自己的电压基准)
#define MIN_Unit_ADC1 2.4985/2147483648//先使用别的校准好的高精度万用表测量ADS1263的基准,再把值填入这里
#define MIN_Unit_ADC2 2.4985/8388608
/*************************API***********************/
void ADS1263_Write_Register(uint8_t Register_Address, uint8_t Data_Byte);
uint8_t ADS1263_RREG(uint8_t regaddr);
void ADS1263_Conveision_Start_ADC1(void);
void ADS1263_Conveision_Start_ADC2(void);
void ADS1263_Config_Init(void);
uint32_t ADS1263_ReadData_ADC1(void);
uint32_t ADS1263_ReadData_ADC2(void);
测试结果:
使用校准器校准后(代码还没来得及更新校准功能),输出2.048V直流电压,采样速度2.5SPS,滤波器SINC4,测得的数据还是很稳定的文章来源地址https://www.toymoban.com/news/detail-850213.html
到了这里,关于STM32 ADS1263驱动源码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!