STM32F407+MAX31855 +K型热电偶进行测温方案二
2.2MAX31855的初始化 图2.时序图void MAX31855_Init(){ GPIO_InitTypeDefGPIO_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 scGPIO_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;} 图3.位加权和功能
图4.热电偶温度格式 根据datasheet可以知道,在data的32位数据中,为14位带符号的热电偶温度,为12位带符号的内部温度。14位的数据表示是热电偶远端,即你想测量的物体的温度。而12位的数据则代表与电路板接触的那一端的热电偶的温度,通常这个温度是固定不变的,与室温接近。
有完整代码不 你们是做美信芯片的代理吗 ?有的话请联系我13727316328
页:
[1]