<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Example using 'Global Pin Control Low/High Register' in PORT module for Kinetis K60 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155180#M372</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For clarification, I'm looking for basic examples using the PORTx_GPCLR and PORTx_GPCHR registers in the Kinetis K60.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have applications using these registers?&amp;nbsp; If so, could you please send snipits of your code as examples?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;~&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 30 Jul 2011 04:33:46 GMT</pubDate>
    <dc:creator>belskyc</dc:creator>
    <dc:date>2011-07-30T04:33:46Z</dc:date>
    <item>
      <title>Example using 'Global Pin Control Low/High Register' in PORT module for Kinetis K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155179#M371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any example code that uses the 'Global Pin Control Low/High Register' on the Kinetis K60 to configure the ports?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;~&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Jul 2011 03:16:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155179#M371</guid>
      <dc:creator>belskyc</dc:creator>
      <dc:date>2011-07-30T03:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Example using 'Global Pin Control Low/High Register' in PORT module for Kinetis K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155180#M372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For clarification, I'm looking for basic examples using the PORTx_GPCLR and PORTx_GPCHR registers in the Kinetis K60.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have applications using these registers?&amp;nbsp; If so, could you please send snipits of your code as examples?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;~&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Jul 2011 04:33:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155180#M372</guid>
      <dc:creator>belskyc</dc:creator>
      <dc:date>2011-07-30T04:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Example using 'Global Pin Control Low/High Register' in PORT module for Kinetis K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155181#M373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following configures port A bits0, 3, 6, 22, 25 and 31 to GPIO functionality with enabled pull-up resistor, passive input filter:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PORTA_GPCLR = ((PORTA_BIT6 | PORTA_BIT3 | PORTA_BIT0) | (PORT_MUX_GPIO | PORT_PS_UP_ENABLE | PORT_PFE));PORTA_GPCHR = (((PORTA_BIT22 | PORTA_BIT25 | PORTA_BIT31) &amp;gt;&amp;gt; 16) | (PORT_MUX_GPIO | PORT_PS_UP_ENABLE | PORT_PFE));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is however only a part of what may be needed to configure the complete port functionality and characterisics (eg. first power needs to be applied to the port).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The use of &lt;STRONG&gt;PORTx_GPCLR/PORTx_GPHR&lt;/STRONG&gt; may save a few instructions but is not that generic since it requires grouping pins requiring identical settings into lower 16 and upper 16 bits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More generally, the following can be used for complete initialision of GPIO input use (for example):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;_CONFIG_PORT_INPUT(A, (PORTA_BIT22 | PORTA_BIT25 | PORTA_BIT31 | PORTA_BIT6 | PORTA_BIT3 | PORTA_BIT0), (PORT_PS_UP_ENABLE | PORT_PFE));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#define _CONFIG_PORT_INPUT(ref, pins, chars)  SIM_SCGC5 |= SIM_SCGC5_PORT##ref; \
                                              fnConnectGPIO(PORT##ref, pins, chars); \
                                               GPIO##ref##_PDDR &amp;amp;= ~(pins);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// This routine is used to connect a number of port pins to their GPIO function with defined characteristics
//
extern void fnConnectGPIO(int iPortRef, unsigned long ulPortBits, unsigned long ulCharacteristics)
{
    unsigned long ulBit = 0x00000001;
    volatile unsigned long *ptrPCR = (volatile unsigned long *)(PORT0_BLOCK + (iPortRef * 0x1000));
    while (ulPortBits != 0) {
        if (ulPortBits &amp;amp; ulBit) {
            *ptrPCR = (PORT_MUX_GPIO | ulCharacteristics);               // set the GPIO characteristics for each port pin
            ulPortBits &amp;amp;= ~(ulBit);
        }
        ptrPCR++;
        ulBit &amp;lt;&amp;lt;= 1;
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similar macros (with small changes) also allow generic output and peripheral type configuration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:59:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155181#M373</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2020-10-29T08:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Example using 'Global Pin Control Low/High Register' in PORT module for Kinetis K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155182#M374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's wrong........ GPCLR can't do anything with pins 16-31. It is Global Pin Control LOW register and it can only SET or CLEAR 0-15 bit's of PORTX&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 07:27:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155182#M374</guid>
      <dc:creator>branislavdrengu</dc:creator>
      <dc:date>2012-10-04T07:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Example using 'Global Pin Control Low/High Register' in PORT module for Kinetis K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155183#M375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have function example for PORTX_GPCLR ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 07:28:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Example-using-Global-Pin-Control-Low-High-Register-in-PORT/m-p/155183#M375</guid>
      <dc:creator>branislavdrengu</dc:creator>
      <dc:date>2012-10-04T07:28:01Z</dc:date>
    </item>
  </channel>
</rss>

