<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>8-bit Microcontrollers中的主题 Re: Using the SHT11 with HC908GP32</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125837#M780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Dear Mac , I don't know how to thank you. It seems it's working ok, after your advices the led turns on&amp;nbsp; and it takes 8 seconds.&lt;BR /&gt;So know i tryed to put a check of 40 degrees, i thought a function but it's not working correct, the led turn's on without warm up the sensor.&lt;/DIV&gt;&lt;DIV&gt;I put the function&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void heat(void)&lt;BR /&gt;{ short t_C;&lt;BR /&gt;&amp;nbsp;if (t_C &amp;gt; 40) led();&lt;BR /&gt;}&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;to the main() after the &amp;lt; calc_sth11(&amp;amp;humi_val.s,&amp;amp;temp_val.s);&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So i would like to thank you again for spending your time with me.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Jim&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Mar 2007 23:54:55 GMT</pubDate>
    <dc:creator>damitsi</dc:creator>
    <dc:date>2007-03-12T23:54:55Z</dc:date>
    <item>
      <title>Using the SHT11 with HC908GP32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125834#M777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN style=": ; font-size: 2;"&gt;Hello to everyone, I'm a student and i'm working on a project. I started to learn C language two months ago so i don't have enough experience with this.I want to use the SHT11 sensor .&lt;BR /&gt;&amp;nbsp;I'm using the microcontroller HC908GP32 and ICC08 from ImageCraft as a C-compiler and ICS08GPGTZ(Win IDE development environment) to input the &amp;lt; .S19&amp;gt; files to the device.&lt;BR /&gt;The development board which I'm using is non a commercial board.&lt;BR /&gt;&amp;nbsp;Relative to the programming part I considered to put a led inside the code to help me find the error, when the led is on&amp;nbsp; it means that the code runs ok until led. I believe that the error must be in the function &amp;lt;&amp;lt;char s_read_statusreg(unsigned char *p_value, unsigned char *p_checksum)&amp;gt;&amp;gt; or in the function &amp;lt;&amp;lt;char s_write_statusreg(unsigned char *p_value)&amp;gt;&amp;gt;&lt;BR /&gt;&amp;nbsp;The purpose of the project is to check the temp and humi. If temp get over the 40 degrees of celsius a funcooler must be start and something similar with&amp;nbsp; the value of humidity. I will attach the codes below first the prototype one from sensirion's web site and second the incorrect one.&lt;BR /&gt;I would be very grateful on any advice with this.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; font-size: 2;"&gt;&lt;BR /&gt;Regards Jim.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Mar 2007 21:55:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125834#M777</guid>
      <dc:creator>damitsi</dc:creator>
      <dc:date>2007-03-11T21:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using the SHT11 with HC908GP32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125835#M778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Jim,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I can see a couple of obvious problems with your code -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Firstly the data_read() function does not return a value - I assume it should do so, and the following code&amp;nbsp;would return a value.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;unsigned char data_read (void)&lt;BR /&gt;{&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;DDRE = 0x00;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return (PTE &amp;amp; 0x01);&lt;BR /&gt;}&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;There is also a problem with the following function -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;char s_read_byte(unsigned char ack)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;unsigned char i,val=0;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;data1();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// release DATA line&lt;BR /&gt;&amp;nbsp;&amp;nbsp;for (i = 0x80; i &amp;gt; 0; i /= 2) {&amp;nbsp; // shift bit for masking&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sck1();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // clk for SENSIBUS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;input();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (PTE)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;val = (val|i); //read bit&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sck0();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;if ((ack &amp;amp; 0x01) == 1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data0();&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;// in case of "ack==1" pull down DATA Line&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;sck1();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // clk #9 for ack&lt;BR /&gt;&amp;nbsp;&amp;nbsp;delayus(6); // pulswith approx. 5 us&lt;BR /&gt;&amp;nbsp;&amp;nbsp;sck0();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;data1();&amp;nbsp;&amp;nbsp;&amp;nbsp; //release DATA line&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return val;&lt;BR /&gt;}&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;You are actually testing the state of all bits of PTE - I don't think this what you want.&amp;nbsp; To test only the bit used for the serial data, the line should read -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;if (PTE &amp;amp; 0x01)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I will also make some other comments about the code, although these&amp;nbsp;will not affect the present operation.&amp;nbsp; In many of your functions you require to set or clear a single bit associated with a port or its DDR.&amp;nbsp; However, you are actually affecting all eight bits within the port.&amp;nbsp; Unless specifically a&amp;nbsp;function to initialise all bits within a port, generally a function should only alter those bits that it uses.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Consider if you decided to use another bit of the same port for a different purpose - you would have to find all instances where that bit was affected in the existing code.&amp;nbsp; This would involve a lot of modification, and would be prone to error, or perhaps a missed occurrance.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The approach I might usually take is to initialise all bits within a port,&amp;nbsp;its associated DDR, and perhaps the&amp;nbsp;other registers associated with&amp;nbsp;that port.&amp;nbsp;&amp;nbsp;This code would reside in an initialisation function that is called only once whenever the program executes (for example your init() function).&amp;nbsp; This can easily be edited as circumstances change.&amp;nbsp; The various functions called would then set or clear only the bits they were concerned with, and not affect any other bit.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The following macros for example -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;#define DATA_0&amp;nbsp; (DDRE |= 0x01)&amp;nbsp; // Set DDRE0 bit&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;#define DATA_1&amp;nbsp; (DDRE &amp;amp;= 0xFE)&amp;nbsp; // Clear DDRE0 bit&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;#define SCLK_0&amp;nbsp; (PTA &amp;amp;= 0x7F)&amp;nbsp;&amp;nbsp; // Clear PTA7 bit&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;#define SCLK_1&amp;nbsp; (PTA |= 0x80)&amp;nbsp;&amp;nbsp; // Set PTA7 bit&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 12:18:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125835#M778</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-03-12T12:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using the SHT11 with HC908GP32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125836#M779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello again,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I have just noticed another problem.&amp;nbsp; In addition to the &lt;FONT face="Courier New"&gt;data_read()&lt;/FONT&gt; function returning a value, the &lt;FONT face="Courier New"&gt;s_write_byte()&lt;/FONT&gt; function will also need to be modified to use the return value, similarly to the original sample code from Sensiron.&amp;nbsp; I notice you have omitted the local variable &lt;FONT face="Courier New"&gt;error&lt;/FONT&gt; &lt;FONT face="Arial"&gt;- this would need to be reinstated.&amp;nbsp; The final part of the function would then be as follows -&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;data1();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // release DATA line&lt;BR /&gt;&amp;nbsp;&amp;nbsp;sck1();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// clk #9 for ACK&lt;BR /&gt;&amp;nbsp;&amp;nbsp;error = data_read(); // check ACK (DATA pulled down by SHT11)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;sck0();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return error&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Return 1 if no ACK&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Within the &lt;FONT face="Courier New"&gt;s_read_byte()&lt;/FONT&gt; function, I also notice that&amp;nbsp;use of&amp;nbsp;the &lt;FONT face="Courier New"&gt;input()&lt;/FONT&gt; function is unnecessary, since the DATA line had&amp;nbsp;previously been released.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;You could also replace the modification I suggested in the previous post&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (PTE &amp;amp; 0x01) ...&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;with a variation that will operate in an equivalent manner&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (data_read()) ...&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;It makes more sense to re-use the function you have already created.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 14:33:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125836#M779</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-03-12T14:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using the SHT11 with HC908GP32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125837#M780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Dear Mac , I don't know how to thank you. It seems it's working ok, after your advices the led turns on&amp;nbsp; and it takes 8 seconds.&lt;BR /&gt;So know i tryed to put a check of 40 degrees, i thought a function but it's not working correct, the led turn's on without warm up the sensor.&lt;/DIV&gt;&lt;DIV&gt;I put the function&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void heat(void)&lt;BR /&gt;{ short t_C;&lt;BR /&gt;&amp;nbsp;if (t_C &amp;gt; 40) led();&lt;BR /&gt;}&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;to the main() after the &amp;lt; calc_sth11(&amp;amp;humi_val.s,&amp;amp;temp_val.s);&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So i would like to thank you again for spending your time with me.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Jim&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 23:54:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125837#M780</guid>
      <dc:creator>damitsi</dc:creator>
      <dc:date>2007-03-12T23:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using the SHT11 with HC908GP32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125838#M781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Jim,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;After the function &lt;FONT face="Courier New"&gt;calc_sth11()&lt;/FONT&gt; has completed, the temperature value will reside in the variable &lt;FONT face="Courier New"&gt;temp_val.s&amp;nbsp;&lt;FONT face="Arial"&gt;(for a temperature of 40C, this should actually contain the value 400, since the temperature is expressed in 0.1C increments)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Arial"&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The new &lt;FONT face="Courier New"&gt;heat()&lt;/FONT&gt; function will require to use a parameter so that the temperature value may be passed to it, and not a local variable as you currently have.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;void heat(short t_C)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;if (t_C &amp;gt; 400)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;led();&lt;BR /&gt;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2007 07:46:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125838#M781</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-03-13T07:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using the SHT11 with HC908GP32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125839#M782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Dear Mac, i ask from you to be more specific with your previous post relative to&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;lt;The new heat() function will require to use a &lt;STRONG&gt;parameter&lt;/STRONG&gt; so that the temperature value may be passed to it, and not a local variable as you currently have.&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As you can see i'm still having problem with this.&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;The code&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2007 06:16:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125839#M782</guid>
      <dc:creator>damitsi</dc:creator>
      <dc:date>2007-03-14T06:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using the SHT11 with HC908GP32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125840#M783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Jim,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;We are getting to some of the fundamental aspects of the C language.&amp;nbsp; I think you should&amp;nbsp;consult a basic C tutorial, that will explain these issues much better than I can.&amp;nbsp; If you do a Google search on the topic of "C programming" or "C tutorial", you should be able to obtain plenty of appropriate material.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Some of the areas in which you currently seem to have difficulty -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The visibility of variables within a program.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Function parameters, and the passing of data to a function.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The return of data from a function.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Nested if-else statements.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;To explain why your heat() function does not work - you do not pass the temperature value to the function.&amp;nbsp; You have actually defined a new (and unnecessary) local variable within main(), and attempt to pass its uninitialised value to the function.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2007 11:53:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Using-the-SHT11-with-HC908GP32/m-p/125840#M783</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-03-16T11:53:50Z</dc:date>
    </item>
  </channel>
</rss>

