<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/3057" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2009-08-06T15:50:03+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/3057</id>

		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2009-08-06T15:50:03+02:00</updated>

		<published>2009-08-06T15:50:03+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3057&amp;p=10401#p10401</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3057&amp;p=10401#p10401"/>
		<title type="html"><![CDATA[Re: help with  interrupt and registers]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3057&amp;p=10401#p10401"><![CDATA[
Maybe you're mixing infos here. Most of the high registers are used by the compiler and you can use them in your inline assembler as well (if you tell the compiler that you modify them). However, if you need a static or global variable in a register, you must choose something below r8 (and not r0 and not r1). The compiler may still need these registers, but it's rather unlikely if you don't use floating point.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Thu Aug 06, 2009 3:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2009-07-26T00:47:44+02:00</updated>

		<published>2009-07-26T00:47:44+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3057&amp;p=10292#p10292</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3057&amp;p=10292#p10292"/>
		<title type="html"><![CDATA[help with  interrupt and registers]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3057&amp;p=10292#p10292"><![CDATA[
Just want to make sure I have this understood right <br /><br /><br />is this right<br />cli()<br />//doing stuff here  will be done with the usb interrupt disabled<br />// you have 25 clocks to do what you need with a 12mhz<br />sei()<br /><br /><br />also what registers are safe? I found this helpful guide <br /><!-- m --><a class="postlink" href="http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_reg_usage">http://www.nongnu.org/avr-libc/user-man ... _reg_usage</a><!-- m --><br />under &quot;What registers are used by the C compiler?&quot;<br />I gathered form this info that a few groups of registers are ok to use., namely(r18-r27, r30-r31):<br />but when using them my data seems to be a bit random. and some of those registers seem to cause issues when changed.<br /><br />Assuming I'm using the registers right, what registers can I use? I really need a few 8 bits or possible two 32 bits. Is there any info around here that would show what is available and what data types they are?<br /><br />another thing I dont understand is how to init these registers with data?<br /><br />If I do<br /><div class="codebox"><p>Code: </p><pre><code>   register int *result1 asm (&quot;r26&quot;)= 0xff  ;<br />   register int *result2 asm (&quot;r30&quot;)= 0xff ;</code></pre></div><br />I get that data put in there, but I can no longer change them when I do something like..<br /><div class="codebox"><p>Code: </p><pre><code>   asm volatile<br />   (<br />   &quot;in  r21, %0\n&quot;// get data from port c<br />   &quot;BST r21, 5 \n&quot;//put the 5th bit<br />   &quot;BLD r26, 0 \n&quot;//into r26 0th bit.<br />   &quot;BST r21, 4 \n&quot;//put the 4th bit<br />   &quot;BLD r30, 0 \n&quot;//into r30 0th bit<br />   : : &quot;I&quot; (_SFR_IO_ADDR(PINC))    ); </code></pre></div><br />Te data stays at FF , did I do something wrong?<br /><br /><br /><br />BTW: I have an atmega 168<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Sun Jul 26, 2009 12:47 am</p><hr />
]]></content>
	</entry>
	</feed>
