单片机编程,需要程序流程图
#include"ds18b20.h"#include"uart.h"#include<stdio.h>unsignedcharcodeDs18b20com1[]={0x...
#include "ds18b20.h"
#include "uart.h"
#include <stdio.h>
unsigned char code Ds18b20com1[]={0x28,0xff,0x7f,0x25,0x40,0x17,0x04,0x69};
unsigned char code Ds18b20com2[]={0x28,0xff,0xd5,0x21,0x40,0x17,0x03,0x6a};
unsigned char code Ds18b20com3[]={0x28,0xff,0xa2,0x00,0x40,0x17,0x04,0x2a};
unsigned char code Ds18b20com4[]={0x28,0xff,0xd8,0x0c,0x40,0x17,0x04,0xe8};
void delay()
{
unsigned int i=5000,j=100;
while(j--)
{
for(i=5000;i>0;i--);
}
}
void main()
{
float Ds18b20Result;
UsartConfiguration();
while(1)
{
delay();
Ds18b20Result=getTemperature(&Ds18b20com1);
printf("the No1 tempture is : %3.1f\n",Ds18b20Result);
Ds18b20Result=getTemperature(&Ds18b20com2);
printf("the No2 tempture is : %3.1f\n",Ds18b20Result);
Ds18b20Result=getTemperature(&Ds18b20com3);
printf("the No3 tempture is : %3.1f\n",Ds18b20Result);
Ds18b20Result=getTemperature(&Ds18b20com4);
printf("the No4 tempture is : %3.1f\n",Ds18b20Result); 展开
#include "uart.h"
#include <stdio.h>
unsigned char code Ds18b20com1[]={0x28,0xff,0x7f,0x25,0x40,0x17,0x04,0x69};
unsigned char code Ds18b20com2[]={0x28,0xff,0xd5,0x21,0x40,0x17,0x03,0x6a};
unsigned char code Ds18b20com3[]={0x28,0xff,0xa2,0x00,0x40,0x17,0x04,0x2a};
unsigned char code Ds18b20com4[]={0x28,0xff,0xd8,0x0c,0x40,0x17,0x04,0xe8};
void delay()
{
unsigned int i=5000,j=100;
while(j--)
{
for(i=5000;i>0;i--);
}
}
void main()
{
float Ds18b20Result;
UsartConfiguration();
while(1)
{
delay();
Ds18b20Result=getTemperature(&Ds18b20com1);
printf("the No1 tempture is : %3.1f\n",Ds18b20Result);
Ds18b20Result=getTemperature(&Ds18b20com2);
printf("the No2 tempture is : %3.1f\n",Ds18b20Result);
Ds18b20Result=getTemperature(&Ds18b20com3);
printf("the No3 tempture is : %3.1f\n",Ds18b20Result);
Ds18b20Result=getTemperature(&Ds18b20com4);
printf("the No4 tempture is : %3.1f\n",Ds18b20Result); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |