<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/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/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Set IO through a register</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79711/set-io-through-a-register</link><description>I want to use the register of Nordic&amp;#39;s P0 port directly to set 1 or clear 0. Like this, 
 p_reg-&amp;amp;gt; OUTCLR = clr_mask; 
 P_reg - &amp;amp; gt; OUTSET = set_mask; 
 
 p_reg-&amp;amp;gt; OUTCLR = 20; 
 P_reg - &amp;amp; gt; OUTSET = 20; 
 
 But it can&amp;#39;t be done. Show me how to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Sep 2021 11:41:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79711/set-io-through-a-register" /><item><title>RE: Set IO through a register</title><link>https://devzone.nordicsemi.com/thread/329810?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 11:41:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38e15433-1dad-463e-8eed-c256986b2977</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;As I understand, it&amp;#39;s a low-resolution LCD with parallel interface? if so, I don&amp;#39;t think you can get any speed boost with direct register writing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Set IO through a register</title><link>https://devzone.nordicsemi.com/thread/329778?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 09:51:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc299103-29a6-458f-ae81-144505ea29e9</guid><dc:creator>liuyanfeng</dc:creator><description>&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;I want to improve the driving capability of the 52840 drive LCD screen.&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;To make the LCD display faster, I defined each pin like this&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;# define RESET NRF_GPIO_PIN_MAP (0, 8)&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;# define CSP NRF_GPIO_PIN_MAP (0, 7)&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;# define RSP NRF_GPIO_PIN_MAP (0, 6)&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;# define WRP NRF_GPIO_PIN_MAP (0, 5)&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;# define RDP NRF_GPIO_PIN_MAP (0, 4)&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;# define RESET_H () nrf_gpio_pin_set (RESET)&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;# define RESET_L () nrf_gpio_pin_clear (RESET)&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;I want to set nrF_GPIO_pin_set (RESET) and NRF_GPIo_pin_clear (RESET)&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;Is it possible to increase the execution speed by switching to registers?&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;Or in assembly language?&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;static void SPI_WriteCmd8Bit( uint8_t CByte )&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;NRF_GPIO_Type *p_reg=NRF_P0;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;uint32_t value=0;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;RSP_L ();&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; // NRF_P0-&amp;amp;gt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; OUTCLR = (1 &amp;amp;lt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; &amp;amp;lt; &lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt;RSP); &lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt;This will stop the program from executing&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;RDP_H ();&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; // NRF_P0-&amp;amp;gt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; OUTSET = (1 &amp;amp;lt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; &amp;amp;lt; &lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt;RDP);&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; This will stop the program from executing&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;value = p_reg-&amp;amp;gt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; OUT;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;value &amp;amp;= ~(0xFF&amp;amp;lt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; &amp;amp;lt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; 24);&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;value |= (CByte&amp;amp;lt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; &amp;amp;lt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; 24);&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;p_reg-&amp;amp;gt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; OUT = value;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;WRP_L ();&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; // NRF_P0-&amp;amp;gt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; OUTCLR = (1 &amp;amp;lt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; &amp;amp;lt; &lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt;WRP);&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;WRP_H ();&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; // NRF_P0-&amp;amp;gt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; OUTSET = (1 &amp;amp;lt;&lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt; &amp;amp;lt; &lt;/span&gt;&lt;span class="tgt" style="line-height:26px;"&gt;WRP);&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;Can you help my mom?&lt;/span&gt;&lt;/p&gt;
&lt;p class="tgt"&gt;&lt;span class="tgt" style="line-height:26px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Set IO through a register</title><link>https://devzone.nordicsemi.com/thread/329769?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 09:19:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:593efcda-9fcc-453b-b5d4-09fad26f7057</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Did you configure pin as output? Could you show your complete code?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Set IO through a register</title><link>https://devzone.nordicsemi.com/thread/329766?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 09:09:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:560093df-f1d9-4121-ab64-f42ca454fd4e</guid><dc:creator>liuyanfeng</dc:creator><description>&lt;p&gt;&lt;span&gt;My program won&amp;#39;t run if I use it this way&lt;/span&gt;。 thank&amp;nbsp; you all the same&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Set IO through a register</title><link>https://devzone.nordicsemi.com/thread/329755?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 08:42:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b466048f-cdc6-4140-9878-d68547c5fa0a</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;it should be straightforward - for example, set/clear bit 5:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRF_P0-&amp;gt;OUTCLR = (1 &amp;lt;&amp;lt; 5);
NRF_P0-&amp;gt;OUTSET = (1 &amp;lt;&amp;lt; 5);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>