Home > other >  How can I get stc8h1k28 microcontroller the cycle a? NTC temperature measurement
How can I get stc8h1k28 microcontroller the cycle a? NTC temperature measurement

Time:11-08


 

#include

Under-16 temperature;//expand 10 times the temperature of the
U8 Zhengfu_Display=71;
U8 jixian_Display;
//u8 the up and down;

//# define TEMPMAX 4097
//# define TEMPMIN 0



Under-16 code NTC_Table [202], [2]=
{
{962964}, {960961}, {958961}, {956957}, {955957}, {953954}, {951954}, {949950},//7
{948950}, {945947}, {944946}, {941943}, {939942}, {937938}, {935938}, {932934},//15
{931933}, {928930}, {926929}, {923925}, {921924}, {918920}, {916919}, {913915},//23
{911914}, {908910}, {906909}, {903905}, {900903}, {897899}, {894898}, {891893},//31
{888892}, {885887}, {882886}, {879881}, {876879}, {872875}, {869873}, {865868},
{862866}, {858861}, {855859}, {851854}, {848851}, {844847}, {840844}, {836839},
{832836}, {829831}, {824828}, {820823}, {816820}, {812815}, {808812}, {804807},
{799803}, {795798}, {790794}, {786789}, {781785}, {777780}, {772776}, {768771},
{762766}, {758761}, {753757}, {749752}, {743747}, {739742}, {733737}, {729732},
{722726}, {718721}, {712716}, {708711}, {702706}, {698701}, {691695}, {687690},
{680684}, {676679}, {669673}, {665668}, {658662}, {655657}, {647651}, {644646},
{636640}, {632635}, {625628}, {621624}, {614617}, {610613}, {602606}, {599601},//95
{591594}, {588590}, {579583}, {576578}, {568571}, {565567}, {557560}, {554556},//103
{545548}, {543544}, {534537}, {531533}, {523525}, {520522}, {512515}, {509511}, 20 degrees//
{500503}, {498499}, {489492}, {487488}, {478481}, {475477}, {467470}, {464466},
{457460}, {453456}, {446449}, {443445}, {435439}, {432434}, {425428}, {421424},
{414418}, {411413}, {404408}, {401403}, {394398}, {391393}, {384388}, {381383},
{375378}, {371374}, {365369}, {361364}, {356359}, {352355}, {346350}, {342345},
{337341}, {333336}, {328332}, {324327}, {319323}, {315318}, {311315}, {307310},
{302306}, {298301}, {294298}, {290293}, {286290}, {282285}, {278282}, {274277},
{270274}, {266269}, {263267}, {259262}, {255259}, {251254}, {248252}, {244247},
{241245}, {237240}, {234238}, {230233}, {228232}, {224227}, {221225}, {217220},
{215219}, {211214}, {209213}, {205208}, {203207}, {199202}, {197201}, {193196},//183
{191195}, {187190}, {185189}, {182184}, {180184}, {176179}, {175179}, {171174},//191
{170173}, {166169}, {165168}, {161164}, {160164}, {156159}, {155159}, {152154},//199
{151154}, {147150}



};

Void Get_Temperature_Value ()
{
The static under-16 z;

Under-16 Temp.
//u8 up=down=0;
//under-16 Max.
Temp=moniliang;
//Max=moniliang;

/* if (Temp1 & lt; 147)//higher than 70 degrees
{
Temp1=147;
The up=1;
The down=0;
Temperature=700;



}
If (Temp1 & gt; (964)//below 30 -
{
Temp1=964;

The up=0;
The down=1;
Temperature=300;
Zhengfu_Display=74;//temperature display in front of the "-" symbols,


} */

If (Temp & gt;=NTC_Table [100] [1])//{579583}, {576578}, {568571}, {565567}, {557560}, {554556},
{
//query 0 ~ 100 corresponding is 30 degrees to 20 degrees below zero, 567
For (z=0; Z<=100; Z++)
{
If ((Temp & gt;=NTC_Table [z] [0]) & amp; & (Temp & lt;=NTC_Table [z] [1]))
{
break;
}
Delayus (1);
}
//break;
}

The else

{
For (z=101; Z<=201; Z++)
{

If ((Temp & gt;=NTC_Table [z] [0]) & amp; & (Temp & lt;=NTC_Table [z] [1]))
{
break;
}
Delayus (1);

}
}
//if ((z - Max) & gt; 30)
//z=Max;
Temperature=z;

/*
If (z & gt;=60)
{
Zhengfu_Display=71;//in front of the temperature doesn't show any sign,
If ((z % 2)==1)
{
Temperature=((z - 1)/2) - 30;
Temperature=temperature * 10 + 5;
}
The else
{
Temperature=(z/2) - 30;
Temperature=temperature * 10;
}

}

The else
{
Zhengfu_Display=75;//temperature display in front of the "-" symbols,
If (z % 2)
{
Temperature=30 - ((z - 1)/2);
Temperature=temperature * 10 + 5;
}
The else
{
Temperature=(30 - (z/2));
Temperature=temperature * 10;
}
}
*/


//temperature=z;
}



This "Z" value sometimes display normal (probably more than one hundred points) sometimes it 201 or 202, bosses, what is this excuse me??
  • Related