<?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>(Probably simple) syntax error</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/17287/probably-simple-syntax-error</link><description> I&amp;#39;ve written my first program in Keil uVision2 just to toggle a led with my 8052 microcontroller. 
 
Code looks like this: 
 
#define P3 *(volatile unsigned int *)0x00B0; 
//I/O pin to be toggled 
 
 
 
void main (void) 
{ 
//declarations 
unsigned int</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: (Probably simple) syntax error</title><link>https://community.arm.com/thread/110773?ContentTypeID=1</link><pubDate>Wed, 25 Feb 2004 01:46:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2c5572b5-6428-4ed1-96af-cd7563846ef8</guid><dc:creator>Gerard Akse</dc:creator><description>&lt;p&gt;Forgive me my stubborness.&lt;br /&gt;
&lt;br /&gt;
I&amp;#39;ll try to get things to work with your suggestions, by declaring a SFR.&lt;br /&gt;
&lt;br /&gt;
Thank you all for your support!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: (Probably simple) syntax error</title><link>https://community.arm.com/thread/96144?ContentTypeID=1</link><pubDate>Tue, 24 Feb 2004 14:07:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5e6eb8ae-ad9a-4cce-af35-50512a003571</guid><dc:creator>Dan Henry</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;However, I do believe that I can set/reset the i/o pin using the pointer, I intend to find out ASAP...&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
OK, for some, experience is the best teacher.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: (Probably simple) syntax error</title><link>https://community.arm.com/thread/96140?ContentTypeID=1</link><pubDate>Tue, 24 Feb 2004 12:29:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1de5b7da-08bc-4708-81a6-5ea6c1d412cb</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;&lt;i&gt;However, I do believe that I can set/reset the i/o pin using the pointer, I intend to find out ASAP, I&amp;#39;ll let you know what I find out.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
If it&amp;#39;s the standard 8051 P3 that is at SFR address 0xB0, you can&amp;#39;t use a pointer to access it.  This is clearly presented in the Intel 8051 data book.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: (Probably simple) syntax error</title><link>https://community.arm.com/thread/96143?ContentTypeID=1</link><pubDate>Tue, 24 Feb 2004 07:54:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d8ad1f0f-b8c9-4d52-9e94-193f72199455</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;I do believe that I can set/reset the i/o pin using the pointer&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
You need to define it as an &lt;b&gt;sfr&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Take a look at the standard header file recommended for this part:&lt;a href="http://www.keil.com/dd/chip/3479.htm"&gt;http://www.keil.com/dd/chip/3479.htm&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;quot;I&amp;#39;ve written my first program in Keil uVision2 just to toggle a led with my 8052 microcontroller.&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Before you did that, did you follow the  &lt;b&gt;Standard Advice&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;First&lt;/b&gt;&lt;/i&gt;, you need to read the uVision &lt;i&gt;Getting Started&lt;/i&gt; guide, and work through the example projects in it.&lt;br /&gt;
&lt;br /&gt;
You need to read the following documents - commonly referred to as &amp;quot;the bible&amp;quot; for the 8051:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf" target="_blank"&gt;http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf" target="_blank"&gt;http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf" target="_blank"&gt;http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Are you also a newbie to &amp;#39;C&amp;#39; programming in general?&lt;br /&gt;
If so, you&amp;#39;ll also need a good &amp;#39;C&amp;#39; textbook.&lt;br /&gt;
&lt;br /&gt;
Here are some other introductory &amp;amp; reference materials:&lt;br /&gt;
&lt;a href="http://www.keil.com/books/8051books.asp"&gt;http://www.keil.com/books/8051books.asp&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.8052.com/books.phtml" target="_blank"&gt;http://www.8052.com/books.phtml&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.8052.com/tutorial.phtml" target="_blank"&gt;http://www.8052.com/tutorial.phtml&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You will need to read the &lt;b&gt;Manuals&lt;/b&gt; for the C51 Compiler, A51 Assembler, etc, etc,...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: (Probably simple) syntax error</title><link>https://community.arm.com/thread/72308?ContentTypeID=1</link><pubDate>Tue, 24 Feb 2004 07:39:57 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f868211b-6ef9-477c-a712-73161d044d3e</guid><dc:creator>Gerard Akse</dc:creator><description>&lt;p&gt;Thanks for your fast answer!&lt;br /&gt;
The &amp;quot;;&amp;quot; in the define statement was the cause of my problem.&lt;br /&gt;
&lt;br /&gt;
However, I do believe that I can set/reset the i/o pin using the pointer, I intend to find out ASAP, I&amp;#39;ll let you know what I find out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: (Probably simple) syntax error</title><link>https://community.arm.com/thread/41776?ContentTypeID=1</link><pubDate>Tue, 24 Feb 2004 07:29:35 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:48a776ac-884b-447c-b65c-ac1fdddfc1a4</guid><dc:creator>Dan Henry</dc:creator><description>&lt;p&gt;A few things pop out immediately.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Delete the semicolon (;) at the end of your P3 #define.&lt;/li&gt;
&lt;li&gt;That define dereferences a constant pointer to location 0xB0 in the MCU&amp;#39;s &lt;b&gt;internal RAM&lt;/b&gt;, probably not the IO you want.  If the IO is mapped as external memory, qualify the pointer as xdata.  If it is an MCU port pin, you can&amp;#39;t access it through a pointer, only via SFRs.&lt;/li&gt;
&lt;li&gt;P3 is also a port name, so if you are including an 805x register header file, you&amp;#39;ll probably want to change your define name to something else.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>