<?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>keil STM32 and bit operation</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/27448/keil-stm32-and-bit-operation</link><description> 
Im from slovakia so please excuse my english 

 
im newbie in programic mcu 
i need to write if clause where i wat to do something if pin is in
high level. 

 
for example 
if ((P1^1)==1{ 
something to do 
}; 

 
but it wont work 
how can i do this</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: keil STM32 and bit operation</title><link>https://community.arm.com/thread/66188?ContentTypeID=1</link><pubDate>Sat, 15 Jan 2011 10:28:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f8c8caa5-940f-40fd-b00b-a7b0ccc8303a</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Note that P1^1 means two different things &lt;b&gt;if using the C51
compiler, i.e. 8051 code.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
If used to declare a bit variable, it will tell which pin of the
P1 port the variable is associated with.&lt;/p&gt;

&lt;p&gt;
If used inside the program, then the ^ operator is the standard
xor bit operator available in C. So your code in this case takes the
8-bit value from P1 and xor with the 8-bit value 0x01 and then check
if the result is 1. That means that the == will depend on the 7 other
pins of P1...&lt;/p&gt;

&lt;p&gt;
In your case, you have specified the ARM architecture, in which
case ^ only has a meaning as xor operator. But for the ARM chips, you
may not even have a P1 port - the name used to read values from the
port depends on what specific ARM chip you have.&lt;/p&gt;

&lt;p&gt;
So if you do use an 8051 chip - do check the manual for the C51
compiler how to declare bit variables.&lt;/p&gt;

&lt;p&gt;
And if you do use an ARM chip - make sure you use the correct
register name for your specific processor and then just do:&lt;/p&gt;

&lt;pre&gt;
if (PROCESSOR_PORT &amp;amp; 0x00000001) { ... }
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>