<?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>Processor Expert Software中的主题 Re: BitIO bean return value for GetVal doesn't match specification</title>
    <link>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216170#M996</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the problem is, that ANSI C defines true&amp;nbsp; logical value as "any non-zero value" so it cannot be tested "something == TRUE".&lt;/P&gt;&lt;P&gt;When you need to check some boolean value, use if (something)... or if (!something) ...﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Generally, when Processor Expert&amp;nbsp; returns "true", it does not refer to the "TRUE" constant, but to 'true' value in the sense of ANSI C language. It's a little bit tricky because the (something== TRUE) compiles, but doesn't work as expected.&lt;/P&gt;&lt;P&gt;Please see the Processor Expert user manual where there is a section 'Typical Usage of Component in User Code﻿'&amp;nbsp; with subsection 'TRUE and FALSE Values of bool Type﻿' describing the details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for finding the typo in the AsynchroSerial , we will fix that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&lt;BR /&gt;Petr Hradsky&lt;BR /&gt;Processor Expert Support and Servicepacks Team&lt;BR /&gt;&lt;BR /&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jun 2011 19:11:33 GMT</pubDate>
    <dc:creator>ProcessorExpert</dc:creator>
    <dc:date>2011-06-22T19:11:33Z</dc:date>
    <item>
      <title>BitIO bean return value for GetVal doesn't match specification</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216167#M993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using CodeWarrior 6.3.1 Patch, Build 10105 for ColdFire V1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the auto-generated macro code for PutVal for my input SW2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;** ===================================================================&lt;BR /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp; SW2_GetVal (component BitIO)&lt;BR /&gt;**&lt;BR /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Description :&lt;BR /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This method returns an input value.&lt;BR /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a) direction = Input&amp;nbsp; : reads the input value from the&lt;BR /&gt;**&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pin and returns it&lt;BR /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b) direction = Output : returns the last written value&lt;BR /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Note: This bean is set to work in Input direction only.&lt;BR /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Parameters&amp;nbsp; : None&lt;BR /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Returns&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&lt;BR /&gt;**&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; - Input value. Possible values:&lt;BR /&gt;**&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; FALSE - logical "0" (Low level)&lt;BR /&gt;**&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; TRUE - logical "1" (High level)&lt;/P&gt;&lt;P&gt;** ===================================================================&lt;BR /&gt;*/&lt;BR /&gt;#define SW2_GetVal() ( \&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (bool)((getReg8(PTGD) &amp;amp; 0x40))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Return port data */ \&lt;BR /&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* END SW2. *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I am seeing is that it is NOT returning the values of TRUE&amp;nbsp; when the input is at a logical high level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I write code like the following, it doesn't work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x= 0;&lt;/P&gt;&lt;P&gt;if (SW_GetVal() == TRUE)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;x = 1;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of x always remains zero.&amp;nbsp; Stepping with the debugger, I can see that this is because the macro for SW_GetVal() actually returns a value of 0x40 when the input is ON, which is not equal to the macro definition of TRUE which is 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I'm left to re-write my code as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x= 0;&lt;/P&gt;&lt;P&gt;if (SW_GetVal() != FALSE)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;x = 1;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please fix the bug in the code generation for the BitIO bean's GetVal() function.&amp;nbsp; Either change the documentation, or change the way the code is generated.&amp;nbsp; They have to be consistent, otherwise by simply believing the "Returns" values as shown in the auto-generated function header, a programmer gets led down the wrong path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Processor Expert's auto-generated code *MUST* be implemented better than this !!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slightly frustrated&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2011 20:40:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216167#M993</guid>
      <dc:creator>armistej</dc:creator>
      <dc:date>2011-06-20T20:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: BitIO bean return value for GetVal doesn't match specification</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216168#M994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;U&gt;I don't know enough to technically answer this in detail, but let me make sure it does get a follow up.&lt;/U&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2011 01:19:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216168#M994</guid>
      <dc:creator>jimtrudeau</dc:creator>
      <dc:date>2011-06-22T01:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: BitIO bean return value for GetVal doesn't match specification</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216169#M995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jim !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am an old hand at writing embedded code, but a newbie when it comes to using Processor Expert.&amp;nbsp; I expect that the quality of the auto-generated code has to equal my own standard of what constitutes "good code", otherwise using a tool like Processor Expert becomes an exercise in frustration and futility.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also noticed a typo for the AsynchroSerial bean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#ifndef __BWUserType_UART_TWRSER_TComData&lt;BR /&gt;#define __BWUserType_UART_TWRSER_TComData&lt;BR /&gt;&amp;nbsp; typedef word UART_TWRSER_TComData ;&amp;nbsp; /* User type for communication. Size of this type depends on the communication data witdh. */&lt;BR /&gt;#endif&lt;BR /&gt;﻿&lt;/P&gt;&lt;P&gt;Notice the mis-spelling of "width" as "witdh".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2011 11:01:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216169#M995</guid>
      <dc:creator>armistej</dc:creator>
      <dc:date>2011-06-22T11:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: BitIO bean return value for GetVal doesn't match specification</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216170#M996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the problem is, that ANSI C defines true&amp;nbsp; logical value as "any non-zero value" so it cannot be tested "something == TRUE".&lt;/P&gt;&lt;P&gt;When you need to check some boolean value, use if (something)... or if (!something) ...﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Generally, when Processor Expert&amp;nbsp; returns "true", it does not refer to the "TRUE" constant, but to 'true' value in the sense of ANSI C language. It's a little bit tricky because the (something== TRUE) compiles, but doesn't work as expected.&lt;/P&gt;&lt;P&gt;Please see the Processor Expert user manual where there is a section 'Typical Usage of Component in User Code﻿'&amp;nbsp; with subsection 'TRUE and FALSE Values of bool Type﻿' describing the details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for finding the typo in the AsynchroSerial , we will fix that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&lt;BR /&gt;Petr Hradsky&lt;BR /&gt;Processor Expert Support and Servicepacks Team&lt;BR /&gt;&lt;BR /&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2011 19:11:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/BitIO-bean-return-value-for-GetVal-doesn-t-match-specification/m-p/216170#M996</guid>
      <dc:creator>ProcessorExpert</dc:creator>
      <dc:date>2011-06-22T19:11:33Z</dc:date>
    </item>
  </channel>
</rss>

