日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁 > 技術(shù)學(xué)院 > 技術(shù)前線
[導(dǎo)讀]max31865模塊RTD測溫注意事項(xiàng)

max31865模塊RTD測溫注意事項(xiàng)

注意事項(xiàng)1 參考電阻

注意事項(xiàng)2 接線

注意事項(xiàng)3 電氣連接

注意事項(xiàng)4 max31865模塊重要細(xì)節(jié)

注意事項(xiàng)5 SPI時(shí)序間隔

注意事項(xiàng)6 max31865讀取不到寄存器數(shù)據(jù)的原因

參考代碼

注意事項(xiàng)1 參考電阻

The PT100 version of the breakout uses 430Ω

The PT1000 version uses 4300Ω

一般PT100選400歐姆參考電阻,但是板子上給的是4300,也就是430Ω。程序里需要設(shè)置參考電阻為430,PT1000選擇4300Ω。

#define REF_RES 430


max31865問題

注意事項(xiàng)2 接線

板子上有三個(gè)位置用于設(shè)置線的。


max31865問題


max31865問題

注意事項(xiàng)3 電氣連接

Power Pins:

Vin - this is the power pin. Since the chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V

3Vo - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like

GND - common ground for power and logic

SPI Logic pins:

All pins going into the breakout have level shifting circuitry to make them 3-5V logic level safe. Use whatever logic level is on Vin!

SCK - This is the SPI Clock pin, its an input to the chip

SDO - this is the Serial Data Out / Microcontroller In Sensor Out pin, for data sent from the MAX31865 to your processor

SDI - this is the Serial Data In / Microcontroller Out Sensor In pin, for data sent from your processor to the MAX31865

CS - this is the Chip Select pin, drop it low to start an SPI transaction. Its an input to the chip

If you want to connect multiple MAX31865’s to one microcontroller, have them share the SDI, SDO and SCK pins. Then assign each one a unique CS pin.

RDY (Ready) - is a data-ready indicator pin, you can use this pin to speed up your reads if you are writing your own driver. Our Arduino driver doesn’t use it to save a pin.

注意事項(xiàng)4 max31865模塊重要細(xì)節(jié)

SPI對其寄存器進(jìn)行讀寫,寄存器如下圖。

配置寄存器,想讀就讀0x00,想寫就寫0x80。

轉(zhuǎn)化后的RTD數(shù)值存放于0x01和0x02這2個(gè)8位寄存器。

可以設(shè)置錯(cuò)誤報(bào)警門限上限和下限,通俗來說,比如一個(gè)PT100能測溫范圍是-200℃到420℃,用戶想設(shè)置下限報(bào)警值為-180℃,上限報(bào)警值為400℃,那么當(dāng)max31865轉(zhuǎn)換RTD后,會(huì)將0x01和0x02寄存器結(jié)果與上限值和下限值比較,如果不在設(shè)置的范圍,就會(huì)產(chǎn)生錯(cuò)誤標(biāo)志。

錯(cuò)誤標(biāo)志存在0x07寄存器中。

讀取溫度過程:

(1)讀取0x07寄存器,看是不是等于0x00,即是說無錯(cuò)誤標(biāo)志。有錯(cuò)誤標(biāo)志時(shí),0x07寄存器里面某個(gè)值就是1。

錯(cuò)誤標(biāo)志可以手動(dòng)清除,但如果沒實(shí)際解決問題,下次檢測這個(gè)標(biāo)志還是會(huì)被模塊拉起。

(2)如果能過錯(cuò)誤檢測,就開始下面的過程。向0x80寫入配置,這里寫入的是說進(jìn)行一次轉(zhuǎn)換(One_Shot_Conversion ),然后等待DRDY 引腳變成低電平(意味轉(zhuǎn)換結(jié)束)。然后讀取0x01和0x02這2個(gè)8位寄存器,0x02的最低位裝的是錯(cuò)沒錯(cuò)的標(biāo)志,沒錯(cuò)的話就可以利用0x01和0x02這2個(gè)8位寄存器合成電阻數(shù)值。

4)PT100電阻變成溫度

這個(gè)就各顯神通了,有各種各樣的轉(zhuǎn)換公式。

注意事項(xiàng)5 SPI時(shí)序間隔


max31865問題

注意事項(xiàng)6 max31865讀取不到寄存器數(shù)據(jù)的原因


max31865問題


max31865問題

從機(jī)發(fā)數(shù)據(jù)也是需要主機(jī)提供時(shí)鐘信號的

參考代碼

//使用RT1052 LPSPI3

//LPSPI3:讀寫一個(gè)字節(jié)

//TxData:要寫入的字節(jié)

//返回值:讀取到的字節(jié)

uint8_t LPSPI3_ReadWriteByte(uint8_t TxData)

{

uint8_t spirxdata=0;

uint8_t spitxdata=TxData;

lpspi_transfer_t spi_tranxfer;

lpspi_master_handle_t master_handle;

spi_tranxfer.configFlags=kLPSPI_MasterPcs1|kLPSPI_MasterPcsContinuous; //PCS1

spi_tranxfer.txData=&spitxdata; //要發(fā)送的數(shù)據(jù)

spi_tranxfer.rxData=&spirxdata; //要接收到的數(shù)據(jù)

spi_tranxfer.dataSize=1; //數(shù)據(jù)長度

LPSPI_MasterTransferBlocking(LPSPI3,&spi_tranxfer); //SPI阻塞發(fā)送

// LPSPI_MasterTransferNonBlocking(LPSPI3, &master_handle, &spi_tranxfer);

return spirxdata;

}

uint8_t max31685_ReadRegister8(uint8_t addr)

{

uint8_t ret;

GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);

SysTick_DelayTicks(1U);

GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 0U);

SysTick_DelayTicks(1U);

ret = LPSPI3_ReadWriteByte(addr);

SysTick_DelayTicks(1U);

ret = LPSPI3_ReadWriteByte(0xff);

SysTick_DelayTicks(1U);

GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);

return ret;

}

uint8_t max31685_WriteRegister8(uint8_t addr, uint8_t data)

{

uint8_t ret;

GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);

SysTick_DelayTicks(1U);

GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 0U);

SysTick_DelayTicks(1U);

ret = LPSPI3_ReadWriteByte(addr | 0x80);

SysTick_DelayTicks(1U);

ret = LPSPI3_ReadWriteByte(data);

SysTick_DelayTicks(1U);

GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);

return ret;

}

void max31865_Init(void)

{

uint8_t ret; //for test

GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);

SysTick_DelayTicks(10U);

//BIAS ON,自動(dòng),三線,50Hz

max31685_WriteRegister8(MAX31856_CONFIG_REG, MAX31856_CONFIG_BIAS | MAX31856_CONFIG_MODEAUTO | MAX31856_CONFIG_3WIRE | MAX31856_CONFIG_FILT50HZ);

ret = max31685_ReadRegister8(MAX31856_CONFIG_REG);

}

uint8_t max31865_ReadFault(void)

{

}

void max31865_ClearFault(void)

{

}

void max31865_Config(uint8_t reg, uint8_t cfgValue)

{

}

uint16_t max31865_ReadRTD(void)

{

uint16_t rtd = 0;

rtd = max31685_ReadRegister8(MAX31856_RTDMSB_REG) << 8;

rtd |= max31685_ReadRegister8(MAX31856_RTDLSB_REG);

rtd = rtd >> 1;

return rtd;

}


max31865問題


本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時(shí)聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關(guān)閉