<?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 with C51 v5.5 and Atmel Dual Pointers</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/14021/problem-with-c51-v5-5-and-atmel-dual-pointers</link><description> Hi, all. 
 
I seem to have a problem with C51 
(DOS) v5.50 and the Atmel AT89S53. 
 
The program is all C (no assembler) and 
accesses different parts of XDATA memory 
from both the normal main program and 
also from an interrupt function. It 
appears</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Problem with C51 v5.5 and Atmel Dual Pointers</title><link>https://community.arm.com/thread/131723?ContentTypeID=1</link><pubDate>Sat, 17 Feb 2001 05:10:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cab86cb7-af98-4981-8a86-581247619be0</guid><dc:creator>Roman Horvath</dc:creator><description>&lt;p&gt;When you push dpl and dph at the begin of interrupt routine, altough dps is set to use dptr1, problems will occur. For ex. INC DPTR will do it.&lt;br /&gt;
Roman&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with C51 v5.5 and Atmel Dual Pointers</title><link>https://community.arm.com/thread/129658?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2001 18:44:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7f5c6ec8-8f41-4664-85ba-56ed5c188304</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;&lt;i&gt;When you say, &amp;quot;second data pointer,&amp;quot; does that actually mean, &amp;quot;the currently non-selected data pointer?&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Yep, that&amp;#39;s right.&lt;br /&gt;
&lt;br /&gt;
Note that if an interrupt uses DPTR (whichever one is currently selected) it saves it.&lt;br /&gt;
&lt;br /&gt;
The only problem is when you call a routine inside an ISR that was compiled with MODA2 that subsequently calls strcpy or strcmp.  In that case, the ISR is compiled without dual data pointer support, however, it calls another function that was compiled WITH dual data pointer support.&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: Problem with C51 v5.5 and Atmel Dual Pointers</title><link>https://community.arm.com/thread/121561?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2001 17:52:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c2c26724-201d-4ff6-b0c3-ac0228401d09</guid><dc:creator>Andrew Neil</dc:creator><description>&lt;p&gt;When you say, &lt;i&gt;&amp;quot;&lt;b&gt;second&lt;/b&gt; data pointer,&amp;quot;&lt;/i&gt; does that actually mean, &lt;i&gt;&amp;quot;&lt;b&gt;the currently non-selected&lt;/b&gt; data pointer?&amp;quot;&lt;/i&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with C51 v5.5 and Atmel Dual Pointers</title><link>https://community.arm.com/thread/109781?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2001 11:36:25 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c7fb328a-3016-445a-b875-be5a4f45a374</guid><dc:creator>Keil Support</dc:creator><description>&lt;p&gt;Sure... :-)&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Make sure that your interrupts are saving both data pointers as well as the datapointer selector register&lt;/i&gt; &lt;b&gt;but only if your interrupt service routine (or one of the routines it calls) changes the second data pointer.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If your interrupt service routines have no effect on the second data pointer, it is not necessary (of course) to save it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with C51 v5.5 and Atmel Dual Pointers</title><link>https://community.arm.com/thread/94720?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2001 03:12:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8dcc0bf6-a1b6-423c-910c-6ec13ee190e6</guid><dc:creator>Andrew Neil</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;make sure that the #pragma MODA2 is specified before the ISR&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Could you square that advice (which seems sensible) with the following from p120 of the C51 User&amp;#39;s Guide 03.2000 (which sounds dubious):&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;quot;To conserve stack space, you may compile interrupt functions with the&lt;br /&gt;
NOMODP2 directive. The C51 compiler does not use the second data pointer when this directive is used.&amp;quot;&lt;/i&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with C51 v5.5 and Atmel Dual Pointers</title><link>https://community.arm.com/thread/53530?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2001 15:09:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c4cdbfd1-81e7-42d0-94b0-ffe19ea0262c</guid><dc:creator>Keil Support</dc:creator><description>&lt;p&gt;Make sure that your interrupts are saving both data pointers as well as the datapointer selector register.&lt;br /&gt;
&lt;br /&gt;
To make sure this happens, make sure that the #pragma MODA2 is specified before the ISR.  That&amp;#39;s what causes the C compiler to generate code that saves the DPTRs.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with C51 v5.5 and Atmel Dual Pointers</title><link>https://community.arm.com/thread/37253?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2001 13:29:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:05d960de-55cb-4b8a-aaa8-0ffadcdc9f93</guid><dc:creator>Andrew Neil</dc:creator><description>&lt;p&gt;I believe that it&amp;#39;s &lt;i&gt;&lt;b&gt;only&lt;/b&gt;&lt;/i&gt; library functions like strcopy which make any use of the 2nd DPTR.&lt;br /&gt;
&lt;br /&gt;
Is your interrupt function also compiled with the 2nd DPTR enabled?&lt;br /&gt;
Could that be leaving your DPTRs in a mess?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>