[STM32] STM32F407+MAX31855 +K型热电偶进行测温方案二

[复制链接]
 楼主| maximQ820270087 发表于 2022-4-27 09:15 | 显示全部楼层 |阅读模式
2.2MAX31855的初始化
图2.时序图

[mw_shl_code=c,true]
void MAX31855_Init()
{
       GPIO_InitTypeDef  GPIO_InitStructure;
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);
       RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
       GPIO_InitStructure.GPIO_Pin = GPIOA_MAX31855_SCK;//max31855 sck
  GPIO_InitStructure.GPIO_Mode= GPIO_Mode_OUT;//普通输出模式
  GPIO_InitStructure.GPIO_OType= GPIO_OType_PP;
  GPIO_InitStructure.GPIO_Speed= GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_PuPd= GPIO_PuPd_UP;
  GPIO_Init(GPIOA,&GPIO_InitStructure);
       GPIO_InitStructure.GPIO_Pin = GPIOC_MAX31855_CS;//max31855 cs
  GPIO_InitStructure.GPIO_Mode= GPIO_Mode_OUT;//普通输出模式
  GPIO_InitStructure.GPIO_OType= GPIO_OType_PP;
  GPIO_InitStructure.GPIO_Speed= GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_PuPd= GPIO_PuPd_UP;
  GPIO_Init(GPIOC,&GPIO_InitStructure);
       GPIO_InitStructure.GPIO_Pin = GPIOC_MAX31855_SC;//max31855 sc
  GPIO_InitStructure.GPIO_Mode= GPIO_Mode_IN;//注意读数据的端口要设置为普通输入模式
  GPIO_InitStructure.GPIO_Speed= GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_PuPd= GPIO_PuPd_UP;
  GPIO_Init(GPIOC,&GPIO_InitStructure);
        
       GPIOA_MAX31855_SCK_L;
       GPIOC_MAX31855_CS_H;
}
[/mw_shl_code]
图3.位加权和功能

图4.热电偶温度格式
根据datasheet可以知道,在data32位数据中,[31:18]14位带符号的热电偶温度,[15:4]12位带符号的内部温度。14位的数据表示是热电偶远端,即你想测量的物体的温度。而12位的数据则代表与电路板接触的那一端的热电偶的温度,通常这个温度是固定不变的,与室温接近。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
duanyh166 发表于 2023-12-3 20:10 | 显示全部楼层
有完整代码不
zwsam 发表于 2024-1-2 09:02 | 显示全部楼层
浚凡小子 发表于 2025-7-24 10:28 | 显示全部楼层
你们是做美信芯片的代理吗 ?有的话请联系我13727316328
您需要登录后才可以回帖 登录 | 注册

本版积分规则

37

主题

219

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部