<?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>Reading a memory location into a C varaible</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/20306/reading-a-memory-location-into-a-c-varaible</link><description> Hi, 
 
I need to read a memory location (SRAM)and load the value into a variable of type integer in my &amp;#39;C&amp;#39; code. 
 
How do I achieve the above mentioned problem in C? 
 
Do I need to do some kind of translations to be done when I read the value so that</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Reading a memory location into a C varaible</title><link>https://community.arm.com/thread/98173?ContentTypeID=1</link><pubDate>Thu, 08 Jun 2006 00:06:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:97769d53-5c8d-4cd4-b2be-9d6fafd9b558</guid><dc:creator>Jinen Dedhia</dc:creator><description>&lt;p&gt;Thanks a ton people.&lt;br /&gt;
&lt;br /&gt;
I think I have got the solution.&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Jinen.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a memory location into a C varaible</title><link>https://community.arm.com/thread/87759?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2006 11:44:57 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3d5a2a99-e259-4882-91b4-5d94520f63c1</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;You haven&amp;#39;t stated what target you&amp;#39;re using.&lt;br /&gt;
&lt;br /&gt;
For an 8051, remember that you will need to specify the appropriate memory space - DATA, XDATA, etc...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a memory location into a C varaible</title><link>https://community.arm.com/thread/87765?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2006 11:36:38 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9d991823-3731-4bd4-a899-6701040cc754</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;i&gt;What I want to do is, I need to assign &lt;b&gt;this register&lt;/b&gt;&amp;#39;s value to one of the variables in &amp;#39;C&amp;#39;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
C does not &amp;quot;know&amp;quot; anything about registers, everything is just variables.&lt;br /&gt;
&lt;br /&gt;
If your post is a convoluted way to ask about assmbler interface to C, state so.&lt;br /&gt;
&lt;br /&gt;
If by &amp;#39;register&amp;#39; you mean a SFR, state so&lt;br /&gt;
&lt;br /&gt;
If by &amp;#39;register&amp;#39; you mean a variable, state so&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a memory location into a C varaible</title><link>https://community.arm.com/thread/87762?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2006 10:14:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e107d0ef-c1fb-4519-9179-893b0cf5e07e</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;fundamental C&lt;br /&gt;
&lt;br /&gt;
read a C book&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a memory location into a C varaible</title><link>https://community.arm.com/thread/46204?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2006 10:14:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:115a02e7-8366-44b5-b6e9-8e935648d9b6</guid><dc:creator>Karl Hamsher</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;How do I achieve the above mentioned problem in C?&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;pre&gt;#define SOME_ADDRESS 0x1234

int i = *(int*)SOME_ADDRESS;&lt;/pre&gt;
&lt;i&gt;&amp;quot;Do I need to do some kind of translations to be done when I read the value so that it would be read as proper integer?&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
That depends on the how the value is stored in memory versus your platform&amp;#39;s requirements.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a memory location into a C varaible</title><link>https://community.arm.com/thread/46219?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2006 09:43:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:86d784e1-b2fc-41b2-97e8-d0e6e21d7657</guid><dc:creator>Jinen Dedhia</dc:creator><description>&lt;p&gt;I am able to read the memory location into one of the internal registers using assembly language.&lt;br /&gt;
&lt;br /&gt;
What I want to do is, I need to assign this register&amp;#39;s value to one of the variables in &amp;#39;C&amp;#39;. How do I do this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>