MAX31855熱電偶轉換器開發流程
一、??準備硬件和相關知識
1.???硬件:一塊開發板、邏輯分析儀、熱電偶(常用的K型熱電偶)、杜邦線等;
2.???相關知識:VHDL基礎、SPI通信;
二、??max31855datasheet編程用到的部分:
1.電路連接圖
2.串行接口時序特性
3 .串口時序
4.引腳分配
5.熱電偶溫度格式
三、程序編寫
/**
******************************************************************************
* @file???????????: max31855.c
* @brief??????????: MAX31855 cold-junction compensated thermocouple-to-digital
*???????????????????converter program body.
******************************************************************************
*
* Copyright (c) respeke, www.etdev.net
* All rights reserved.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "max31855.h"
#include "stm32f1xx_hal.h"
/* External variables --------------------------------------------------------*/
SPI_HandleTypeDef hspi1;
/* Private variables ---------------------------------------------------------*/
float tcTemp = 0, cjTemp = 0;
bool tcError = false;
/* Private function prototypes -----------------------------------------------*/????????????????????????????????
/**
* @brief?Delay about 11ns per NOP (72MHz*1.25MIPS/MHz=90MIPS)
* @param?None
* @retval None
*/
static void SPI_Delay(uint32_t counter)
{
for(int i=0; i
{
__NOP();
}
}
………………………………………………
四、編程中注意的問題
把握時序圖,嚴格核準。
五、波形圖分析(室溫約為20攝氏度)
熱電偶輸出,是以高位先輸出。
評論