<?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>RE: PINSEL0 in LPC2148 (UART1 INITIALISATION)</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/25475/re-pinsel0-in-lpc2148-uart1-initialisation</link><description> 
in the keil ide example prog of uart the ports used for enabling
uart1 is PINSEL0 = 0x00050000;,but when comparing the pin with the
lpc schematics the uart1 pins are p0.8,p0.9 ,i&amp;#39;m not getting how the
uart1 is getting enabled. 

 
also in another example</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: RE: PINSEL0 in LPC2148 (UART1 INITIALISATION)</title><link>https://community.arm.com/thread/125471?ContentTypeID=1</link><pubDate>Thu, 21 May 2009 02:37:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:175eb1b1-8e0c-424d-8610-6c99f43f66bd</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
If there is two bits of configuration for each pin, then you need
to skip 16 bits if you are going to skip 8 pins.&lt;/p&gt;

&lt;p&gt;
Each digit of a hexadecimal number is only four bits, i.e. setting
the configuration for two I/O pins.&lt;/p&gt;

&lt;p&gt;
1) Read my previous posts.&lt;br /&gt;
2) Read the datasheet&lt;br /&gt;
3) Read up a bit on hexadecimal numbers.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE: PINSEL0 in LPC2148 (UART1 INITIALISATION)</title><link>https://community.arm.com/thread/114939?ContentTypeID=1</link><pubDate>Wed, 20 May 2009 22:02:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3f16ecf8-2c01-46f9-9fb1-a61fbce525e4</guid><dc:creator>vikas m</dc:creator><description>&lt;p&gt;&lt;p&gt;
p0.8 must be controlled by the bits 00000100 if i am not
wrong..can u please clarify me with that&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE: PINSEL0 in LPC2148 (UART1 INITIALISATION)</title><link>https://community.arm.com/thread/103123?ContentTypeID=1</link><pubDate>Wed, 20 May 2009 06:32:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d41d9992-ac6a-4948-bae8-62b1764fc8e4</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
p0.0 is represented by the values 0, 1, 2, 3.&lt;br /&gt;
p0.1 is represented by the values 0, 4, 8, 12.&lt;br /&gt;
p0.2 is represented by the values 0, 16, 32, 48.&lt;br /&gt;
...&lt;/p&gt;

&lt;p&gt;
&amp;quot;ok.i agree that each processor pin is represented by two bits
then for selecting p0.0 why it is represented as 0x00000001,according
to you it should be 0x000002&amp;quot;&lt;br /&gt;
The bit 0x00000001 and 0x00000002 both belongs to the configuration
of p0.0.&lt;/p&gt;

&lt;p&gt;
&amp;quot;but in schematic RxD pin is p0.1 but in PINSEL0 it is given as
0x00000004,&amp;quot;&lt;br /&gt;
The bit 0x00000004 and 0x00000008 both belongs to the configuration
of p0.1.&lt;/p&gt;

&lt;p&gt;
The code&lt;/p&gt;

&lt;pre&gt;
PINSEL0 &amp;amp;= 0xFFFFFFF0; // Reset P0.0,P0.1 Pin Config
PINSEL0 |= 0x00000001; // Select P0.0 = TxD(UART0
PINSEL0 |= 0x00000004; // Select P0.1 = RxD(UART0)
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Is clearing the four bits belonging to p0.0 and p0.1, and is then
setting one of the bits belonging to p0.0 and one bit belonging to
p0.1. In the end, all four bits have been given a well-defined
value.&lt;/p&gt;

&lt;p&gt;
For uart1, you mentioned &amp;quot;for enabling uart1 is PINSEL0 =
0x00050000;,but when comparing the pin with the lpc schematics the
uart1 pins are p0.8,p0.9 ,i&amp;#39;m not getting how the uart1 is getting
enabled.&amp;quot;&lt;/p&gt;

&lt;p&gt;
p0.8 is controlled by the bits 0x00010000 and 0x00020000.&lt;br /&gt;
p0.9 is controlled by the bits 0x00040000 and 0x00080000.&lt;br /&gt;
The value 0x00050000 is the sum of 0x00010000 (one of the bits
controlling p0.8) and 0x00040000 (one of the bits controlling
p0.9).&lt;/p&gt;

&lt;p&gt;
In the end, you can control the values of the 16 first port pins
using:&lt;/p&gt;

&lt;pre&gt;
PINSEL0 &amp;amp;= ~(3 &amp;lt;&amp;lt; (2*n));
PINSEL0 |= s &amp;lt;&amp;lt; (2*n);
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
n is the pin number (0..15) and s is the configuration you want
(0..3).&lt;/p&gt;

&lt;p&gt;
To control the settings for p0.16..p0.31, you would do:&lt;/p&gt;

&lt;pre&gt;
PINSEL1 &amp;amp;= ~(3 &amp;lt;&amp;lt; (2*(n-16)));
PINSEL1 |= s &amp;lt;&amp;lt; (s*(n-16))
&lt;/pre&gt;

&lt;p&gt;
To control the settings for p1, you would replace PINSEL0 with
PINSEL2 and PINSEL1 with PINSEL3.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE: PINSEL0 in LPC2148 (UART1 INITIALISATION)</title><link>https://community.arm.com/thread/77459?ContentTypeID=1</link><pubDate>Wed, 20 May 2009 06:13:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d3a7bb8e-c9bd-4812-aed1-49b7eca31e14</guid><dc:creator>rohil k</dc:creator><description>&lt;p&gt;&lt;p&gt;
ok.i agree that each processor pin is represented by two bits then
for selecting p0.0 why it is represented as 0x00000001,according to
you it should be 0x000002.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE: PINSEL0 in LPC2148 (UART1 INITIALISATION)</title><link>https://community.arm.com/thread/56118?ContentTypeID=1</link><pubDate>Wed, 20 May 2009 03:46:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a5b03ed3-2f5e-4bc2-9c44-dd4dfdfd5210</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Have you looked at the datasheet for the processor?&lt;/p&gt;

&lt;p&gt;
Each processor pin is represented by two bits, so to control p0.8,
you have to step 16 bits into the PORTSEL0. To control p0.9, you have
to step 18 bits in. To control P0.1 you have to step 2 bits in.&lt;/p&gt;

&lt;p&gt;
Note also, that some of the processor signals can be enabled on
two alternative processor pins.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>