<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>problem comparing signed char</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/21278/problem-comparing-signed-char</link><description> 
hi i am trying to compare the value of two signed chars. one is a
plain variable currentval while the other is a signed char inside an
array of type signed char called spectrumarray.for some reason it
doesnt work. 

 
xdata signed char spectrumarray</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/112595?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2007 02:24:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6b08ce09-29f6-4488-8d47-c4bd6736690d</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;i kept telling myself...&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
So, the lesson to learn here is: &lt;b&gt;assume nothing!&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&lt;b&gt;Always&lt;/b&gt;&lt;/i&gt; verify your assumptions; test your
theories.&lt;/p&gt;

&lt;p&gt;
As already mentioned, this chip has on-chip debug - &lt;b&gt;use
it!&lt;/b&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/98831?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2007 21:50:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:60dec3f2-5fd8-4f27-91e5-64ad8ec02736</guid><dc:creator>viren ramrekersingh</dc:creator><description>&lt;p&gt;&lt;p&gt;
ok im sorry i realized my error. it was pretty stupid i cut an
paste the code from another function i made and i initialized the
array in the wrong place. and i kept telling myself i didnt do that
arr sorry ppl&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/74728?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2007 15:09:41 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:30c5fb6c-c220-43f8-aa62-4d24445f101f</guid><dc:creator>viren ramrekersingh</dc:creator><description>&lt;p&gt;&lt;p&gt;
Umm it seems when i took those variables out of xdata and just
placed them in normal memory it works now. the array is however still
in xdata.When i print it after i intialize it it says -128 and after
i put stuff in it it holds sensible values, so it works now.The
memory model i used was small but i put the array in xdata as it was
large.&lt;br /&gt;
Im now wondering exactly why that worked so that i dont make
that/those mistake(s) again. Also thanks for the help b4 ppl.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/88128?ContentTypeID=1</link><pubDate>Sat, 13 Jan 2007 18:01:43 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e37e8b81-645c-4049-a3ad-dc9448deefb7</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;You&amp;#39;ve got a mix of explicit xdata objects and objects in the
default memory space. What memory model are you using?&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Also, does this chip needs any specific setup to enable XDATA?&lt;br /&gt;
If so, have you done it?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/47588?ContentTypeID=1</link><pubDate>Sat, 13 Jan 2007 18:00:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1e58a459-5ba1-4979-a379-693c97570c1d</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;microcontroller in use is the Silabs C8051F320.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
That has on-chip debug, doesn&amp;#39;t it?&lt;/p&gt;

&lt;p&gt;
Rather than mess about with printf (which could introduce bugs of
its own), have you single-stepped through the code and examined
what&amp;#39;s actually happening in the chip at eah step?&lt;/p&gt;

&lt;p&gt;
Have you tried your code in the simulator?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/47587?ContentTypeID=1</link><pubDate>Sat, 13 Jan 2007 17:26:27 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7ee1e407-9bbf-4876-ae69-3a4549cbc3a1</guid><dc:creator>Dan Henry</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;yet when i print out the whole array it only holds -128 for
every value except the last.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
You should probably also show us the code to print the whole
array.&lt;/p&gt;

&lt;p&gt;
You&amp;#39;ve got a mix of explicit xdata objects and objects in the
default memory space. What memory model are you using?&lt;/p&gt;

&lt;p&gt;
Sometimes it&amp;#39;s useful to compile to assembly source or to look at
the assembly listing to see if the generated code is doing what you
intended and if not, that will point to what&amp;#39;s wrong.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/74729?ContentTypeID=1</link><pubDate>Sat, 13 Jan 2007 14:56:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e75fe286-46e9-433b-877a-d34cf496ea99</guid><dc:creator>viren ramrekersingh</dc:creator><description>&lt;p&gt;&lt;p&gt;
oh yea the (signed char) cast, i was just frustrated and was just
trying random stuff didnt make any diff tho.umm i printed it out
right after each comparison to see what it was i.e right after the
second for loop. the values were all more than -128. By doesn&amp;#39;t work
i mean the value at that postion in the array should be made equal to
the value of &lt;i&gt;currentval&lt;/i&gt; if it is less than
&lt;i&gt;currentval&lt;/i&gt;.however it doesn&amp;#39;t change.im sorry if i wasnt too
clear&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/47589?ContentTypeID=1</link><pubDate>Sat, 13 Jan 2007 14:49:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a42df3f2-83ed-46ff-b3d4-9efefbca3199</guid><dc:creator>Dan Henry</dc:creator><description>&lt;p&gt;&lt;p&gt;
We have no way of knowing what &amp;quot;doesn&amp;#39;t work&amp;quot; means to you. What
does it mean?&lt;/p&gt;

&lt;p&gt;
What happens if you get rid off all the superfluous (signed char)
casts?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem comparing signed char</title><link>https://community.arm.com/thread/47585?ContentTypeID=1</link><pubDate>Sat, 13 Jan 2007 14:41:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c6f5ae65-4269-4b3f-bb2a-40e6ec4b45b8</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;pre&gt;
&lt;i&gt;if((signed char)spectrumarray[channel] &amp;lt; (signed char)currentval)&lt;/i&gt;
&lt;/pre&gt;

&lt;p&gt;
Those (signed char) casts are quite totally pointless.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;I am sure the currentval values are more than what is inside
the array when they are compared,&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
What makes you so sure?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>