<?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>Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/25888/usage-of-data-pdata-and-xdata-simultaneously</link><description> 
Hello, 

 
is it possible to write a program with the small-memory-model, to
declare some variables as xdata and to declare an char array[256] of
pdata? 

 
Best regards, 
Stefan 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/154156?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 11:18:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:725b5918-db3f-403c-8385-f60d43166a77</guid><dc:creator>Stefan S.</dc:creator><description>&lt;p&gt;&lt;p&gt;
Okay, here the whole assembly-code:&lt;/p&gt;

&lt;pre&gt;
ASSEMBLY LISTING OF GENERATED OBJECT CODE


             ; FUNCTION main (BEGIN)
                                           ; SOURCE LINE # 35
                                           ; SOURCE LINE # 36
0000 C2AF              CLR     EA
                                           ; SOURCE LINE # 39
0002 D2E8              SETB    EUSB
                                           ; SOURCE LINE # 40
0004 900000      E     MOV     DPTR,#USBCS
0007 7404              MOV     A,#04H
0009 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 41
000A 900000      E     MOV     DPTR,#USBIRQ
000D 741E              MOV     A,#01EH
000F F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 42
0010 E4                CLR     A
0011 900000      E     MOV     DPTR,#TOGCTL
0014 F0                MOVX    @DPTR,A
0015 900000      E     MOV     DPTR,#IBNIEN
0018 F0                MOVX    @DPTR,A
0019 900000      E     MOV     DPTR,#IBNIRQ
001C F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 43
001D 900000      E     MOV     DPTR,#EPIO
0020 F0                MOVX    @DPTR,A
0021 A3                INC     DPTR
0022 740A              MOV     A,#0AH
0024 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 48
0025 D2AF              SETB    EA
                                           ; SOURCE LINE # 49
0027 D2A9              SETB    ET0
                                           ; SOURCE LINE # 50
0029 C28B              CLR     CT0
                                           ; SOURCE LINE # 51
002B C291              CLR     T0M
                                           ; SOURCE LINE # 52
002D E4                CLR     A
002E F58A              MOV     TL0,A
                                           ; SOURCE LINE # 53
0030 F58C              MOV     TH0,A
                                           ; SOURCE LINE # 54
0032 D28C              SETB    TR0
                                           ; SOURCE LINE # 56
0034 750001      R     MOV     LED_BLINK,#01H
                                           ; SOURCE LINE # 57
0037 750001      R     MOV     LED_COUNT,#01H
                                           ; SOURCE LINE # 59
003A 900000      E     MOV     DPTR,#PORTACFG
003D F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 60
003E 900000      E     MOV     DPTR,#PORTCCFG
0041 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 61
0042 900000      E     MOV     DPTR,#OEA
0045 74FF              MOV     A,#0FFH
0047 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 62
0048 900000      E     MOV     DPTR,#OEC
C51 COMPILER V8.17   MAIN                                                                  10/15/2009 20:15:02 PAGE 4

004B F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 65
004C E4                CLR     A
004D 90011B            MOV     DPTR,#var0
0050 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 66
0051 A3                INC     DPTR
0052 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 67
0053 A3                INC     DPTR
0054 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 68
0055 A3                INC     DPTR
0056 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 69
0057 A3                INC     DPTR
0058 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 70
0059 A3                INC     DPTR
005A F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 71
005B A3                INC     DPTR
005C F0                MOVX    @DPTR,A
005D         ?C0001:
                                           ; SOURCE LINE # 74
                                           ; SOURCE LINE # 75
                                           ; SOURCE LINE # 76
005D 7800        R     MOV     R0,#LOW test
005F 7405              MOV     A,#05H
0061 F2                MOVX    @R0,A
                                           ; SOURCE LINE # 77
0062 90011E            MOV     DPTR,#var3
0065 E0                MOVX    A,@DPTR
0066 04                INC     A
0067 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 93
0068 80F3              SJMP    ?C0001
006A 22                RET
             ; FUNCTION main (END)

             ; FUNCTION T0_isr (BEGIN)
0000 C0E0              PUSH    ACC
0002 C083              PUSH    DPH
0004 C082              PUSH    DPL
0006 C0D0              PUSH    PSW
0008 75D000            MOV     PSW,#00H
000B C007              PUSH    AR7
                                           ; SOURCE LINE # 102
                                           ; SOURCE LINE # 104
000D E500        R     MOV     A,LED_BLINK
000F 6011              JZ      ?C0006
                                           ; SOURCE LINE # 105
                                           ; SOURCE LINE # 106
0011 AF00        R     MOV     R7,LED_COUNT
0013 1500        R     DEC     LED_COUNT
0015 EF                MOV     A,R7
0016 700A              JNZ     ?C0006
                                           ; SOURCE LINE # 107
0018 750032      R     MOV     LED_COUNT,#032H
                                           ; SOURCE LINE # 108
001B 900000      E     MOV     DPTR,#OUTA
001E E0                MOVX    A,@DPTR
C51 COMPILER V8.17   MAIN                                                                  10/15/2009 20:15:02 PAGE 5

001F 6410              XRL     A,#010H
0021 F0                MOVX    @DPTR,A
                                           ; SOURCE LINE # 109
                                           ; SOURCE LINE # 110
                                           ; SOURCE LINE # 111
0022         ?C0006:
0022 D007              POP     AR7
0024 D0D0              POP     PSW
0026 D082              POP     DPL
0028 D083              POP     DPH
002A D0E0              POP     ACC
002C 32                RETI
             ; FUNCTION T0_isr (END)
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/153558?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 10:09:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:816c36bc-90ce-4a08-bf21-525e4e741780</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
... you can not use pdata AND xdata in the same project.&lt;/p&gt;

&lt;p&gt;
the reason could be that you do not show the whole assembly (the
complete &amp;#39;C&amp;#39; would be nice too), otherwise&lt;/p&gt;

&lt;p&gt;
Look up in the manuals if I am right &amp;quot;PDATA requires that the high
address register/port/SFR is zero THROUGHOUT the project&amp;quot;&lt;/p&gt;

&lt;p&gt;
ALSO, it seems that you have an address of yout PDATA variable
greater than 256, otherwise why the #LOW&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/152885?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 09:32:22 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:635135e3-a255-46ce-ae69-5c32cc5bf8cd</guid><dc:creator>Stefan S.</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi, i tried it with a single pdata-variable and the result is the
following:&lt;/p&gt;

&lt;pre&gt;
005D 7800        R     MOV     R0,#LOW test
005F 7405              MOV     A,#05H
0061 F2                MOVX    @R0,A
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
I&amp;#39;m not experienced in assembler, so do you think this access is
right?&lt;br /&gt;
Note: Itried it also with an array... with a char array[11] the
program works, with a char array[12] it doesn&amp;#39;t...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/152091?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 08:53:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:af068f4c-041a-48e8-b0af-55cf535e47b4</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
do a oneliner that uses one pdata variable and have a look at the
generated assembler. Then have a look in the Cypress datasheet and
see if the generated code access pdata the correct way for this
chip.&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/151320?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 08:49:25 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5780623c-86da-419c-a8a4-418dc25b7e7f</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
In that case, you need to ask &lt;b&gt;Cypress&lt;/b&gt;!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/146464?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 07:56:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bd7a6434-d942-4069-b359-ecaeec4fdd9a</guid><dc:creator>Stefan S.</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hm... I don&amp;#39;t know how to test this... I use the AN2131 from
Cypress and it has an 8151-core, maybe you know wether pdata is
supportet or not ;-)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/144747?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 05:02:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c8512d8e-fef7-48ad-8410-19dfc3112481</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
As Erik suggested, are you sure that your PDATA works
correctly?&lt;/p&gt;

&lt;p&gt;
If your PDATA isn&amp;#39;t working (properly) then, obviously, you will
get problems with anything that you place into PDATA...!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/146463?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 04:33:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:00e22954-1ef0-407b-8fb1-72f857257870</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
Many controllers with &amp;quot;internal external RAM&amp;quot; have special
addressing schemes (usually a SFR) for the high byte of movx @Ri.&lt;br /&gt;
Some of those may not be supported by the compiler.&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/142461?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 04:29:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:06155642-ecf0-4a0c-9da2-cf8987e28c60</guid><dc:creator>Stefan S.</dc:creator><description>&lt;p&gt;&lt;p&gt;
Okay, I tried it with &amp;quot;code&amp;quot; and now it works (at least it seems
to work ;-))...&lt;br /&gt;
But I still do not understand why it causes problems to declare this
array of 256 bytes an pdata. I do not need any more pdata-variables
(maybe the compiler needs morre pdata-space, but I don&amp;#39;t think
so...)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/144748?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 04:25:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d8e6a116-dc1d-41ed-99d7-0526f3ea9add</guid><dc:creator>Non Keil Related</dc:creator><description>&lt;p&gt;&lt;p&gt;
The pdata type uses the @Rn for access, so it&amp;#39;s almost certainly
going to wrap around to the start of the 256 byte block.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/142458?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 04:23:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:88ebdb19-6931-48f3-8bce-13d4d2ed42f4</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
C allows pointers to point one step past the last element of an
array. I wonter what C51 does in this case.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/139362?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 04:13:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3c9f5f32-9fe1-43f0-93da-a456c195dc1c</guid><dc:creator>Non Keil Related</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;...to declare an char array[256] of pdata?&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Yes, but in doing so, you will be consuming all of the memory
space permitted to the pdata memory class.&lt;/p&gt;

&lt;p&gt;
See:&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.keil.com/support/man/docs/c51/c51_le_pdata.htm"&gt;http://www.keil.com/support/man/docs/c51/c51_le_pdata.htm&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/135958?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 04:05:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:55fd7d12-b35c-4095-a9e2-10321d91e01f</guid><dc:creator>Non Keil Related</dc:creator><description>&lt;p&gt;&lt;p&gt;
dscrc_table is surely constant data. You should be able to declare
it as const and locate it in code space (usually rom).&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/125785?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 03:47:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e6955bfa-6b41-4078-a90e-9bd7253433c2</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
What size is the array?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/125783?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 03:46:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:514bb3fe-2407-477a-b9a5-b94b1bf373d0</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Because there&amp;#39;s a bug in your software, or&lt;br /&gt;
Because there&amp;#39;s a bug in your hardware, or&lt;br /&gt;
Both of the above!&lt;/p&gt;

&lt;p&gt;
Please post your source here - taking care to follow the
instructions - rather than some site laden with advertising
pop-ups.&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;:-(&lt;/b&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/115313?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 03:42:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c8178fba-4c26-42b9-880c-7d42861713ff</guid><dc:creator>Stefan S.</dc:creator><description>&lt;p&gt;&lt;p&gt;
But why does the following program not work?! When I choose
&amp;quot;xdata&amp;quot; for the array &amp;quot;dscrc_table&amp;quot; in the file &amp;quot;crc.c&amp;quot;, the program
works properly, but with &amp;quot;pdata&amp;quot; it doesn&amp;#39;t.&lt;/p&gt;

&lt;p&gt;
Downlooad-Link:&lt;br /&gt;
&lt;a href="http://www.fileuploadx.de/223225"&gt;www.fileuploadx.de/223225&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/103525?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2009 00:09:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7a1d63f5-094d-430e-a47b-d9021c0d2f30</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
It&amp;#39;s all in the &lt;b&gt;Manual:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.keil.com/support/man/docs/c51/c51_le_memmodels.htm"&gt;http://www.keil.com/support/man/docs/c51/c51_le_memmodels.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.keil.com/support/man/docs/c51/c51_xc_memmodel.htm"&gt;http://www.keil.com/support/man/docs/c51/c51_xc_memmodel.htm&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/90046?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2009 23:56:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9ac6685f-8e5e-4004-b2a7-c20f3cec6391</guid><dc:creator>Christoph Franck</dc:creator><description>&lt;p&gt;&lt;p&gt;
Not just yes, but that&amp;#39;s the usual way to do things.&lt;/p&gt;

&lt;p&gt;
The memory model just selects the default memory used for
variables if no memory area is specified explicitly.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of DATA, PDATA and XDATA simultaneously</title><link>https://community.arm.com/thread/57063?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2009 15:06:17 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ba1049e1-200e-4a8b-89ec-eff41ba46c25</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
yes.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>