<?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 Declare &amp; read pin without Processor Expert in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224508#M4271</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm a newbie with freescale processor ( and english laguage also). I have a TWR-K20 and I've already code some little things but with PE. I would like now to enter in the detail of the µC. And my problem is really simple I suppose ! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand how to program the port register ( PORTx_PCR, PORTx_GPCLR, PORTx_GPCHR. ) But I don't know how to declare and read a port. My question seems to be really stupid but I'm lost ! For exemple when i was working with microchip if I wanted to declare&amp;nbsp; a pin I writen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # define&amp;nbsp; PIN1&amp;nbsp; PORTAbit.RA1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone has an exemple it will be nice !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&amp;nbsp; ! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Oct 2013 14:45:55 GMT</pubDate>
    <dc:creator>joelesco</dc:creator>
    <dc:date>2013-10-22T14:45:55Z</dc:date>
    <item>
      <title>Declare &amp; read pin without Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224508#M4271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm a newbie with freescale processor ( and english laguage also). I have a TWR-K20 and I've already code some little things but with PE. I would like now to enter in the detail of the µC. And my problem is really simple I suppose ! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand how to program the port register ( PORTx_PCR, PORTx_GPCLR, PORTx_GPCHR. ) But I don't know how to declare and read a port. My question seems to be really stupid but I'm lost ! For exemple when i was working with microchip if I wanted to declare&amp;nbsp; a pin I writen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # define&amp;nbsp; PIN1&amp;nbsp; PORTAbit.RA1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone has an exemple it will be nice !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&amp;nbsp; ! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 14:45:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224508#M4271</guid>
      <dc:creator>joelesco</dc:creator>
      <dc:date>2013-10-22T14:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Declare &amp; read pin without Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224509#M4272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jeremie:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you create a new bareboard project, the included MCU header file (e.g. MK20D50.h) already contains helpful macros to manage your pins. Please check the video in the next link:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/videos/1460"&gt; Video Link : 1460&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the definitions you'd want to create would be something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define PIN0&amp;nbsp;&amp;nbsp;&amp;nbsp; (1&amp;lt;&amp;lt;0)&lt;/P&gt;&lt;P&gt;#define PIN1&amp;nbsp;&amp;nbsp;&amp;nbsp; (1&amp;lt;&amp;lt;1)&lt;/P&gt;&lt;P&gt;//...&lt;/P&gt;&lt;P&gt;#define PIN7&amp;nbsp;&amp;nbsp;&amp;nbsp; (1&amp;lt;&amp;lt;7)&lt;/P&gt;&lt;P&gt;//...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Then you can use those definitions as next examples (e.g. port C):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Enable the clock for the desired port:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Configure the pins as GPIO, using the mux macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PORTC_PCR2 = PORT_PCR_MUX(1);&amp;nbsp;&amp;nbsp;&amp;nbsp; // Pin function alternative '1' is GPIO&lt;/P&gt;&lt;P&gt;PORTC_PCR7 = PORT_PCR_MUX(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// To configure pin 7 as output and pin 2 as input:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPIOC_PDDR |= PIN7;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPIOC_PDDR &amp;amp;= ~PIN2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// To set pin 7:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPIOC_PSOR |= PIN7;&lt;/P&gt;&lt;P&gt;//or&lt;/P&gt;&lt;P&gt;GPIOC_PDOR |= PIN7;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// To clear pin 7:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPIOC_PCOR |= PIN7;&lt;/P&gt;&lt;P&gt;//or&lt;/P&gt;&lt;P&gt;GPIOC_PDOR &amp;amp;= ~PIN7;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// For reading pin 2:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;temp_var = GPIOC_PDIR &amp;amp; PIN2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also find non-processor expert based examples in the next links:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TWR-K20D50M (KINETIS_50MHZ_SC):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K20D50M&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab" title="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K20D50M&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab"&gt;TWR-K20D50M Product Summary Page&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TWR-K20D72M (TWR-K20D72M_LAB):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K20D72M&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab" title="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K20D72M&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab"&gt;TWR-K20D72M Product Summary Page&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this is useful :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Jorge Gonzalez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 16:55:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224509#M4272</guid>
      <dc:creator>Jorge_Gonzalez</dc:creator>
      <dc:date>2013-10-22T16:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Declare &amp; read pin without Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224510#M4273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your project a header file named "MK20F12.h" should be present which contains a mass of macro definitions.&lt;/P&gt;&lt;P&gt;The pin values can be read/written by using the "GPIO" macros which access the corresponding register which are described in the reference manual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 21:05:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224510#M4273</guid>
      <dc:creator>thomasgrieger</dc:creator>
      <dc:date>2013-10-22T21:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Declare &amp; read pin without Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224511#M4274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN class="SpellE"&gt;&lt;SPAN lang="ES-TRAD" style="mso-ansi-language:ES-TRAD"&gt;Hi&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang="ES-TRAD" style="mso-ansi-language:ES-TRAD"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="ES-TRAD" style="mso-ansi-language:ES-TRAD"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thomas is right, the header file contains all the port and register definitions you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure if your TWR is K20D50 or K20D72, but you have the SC (Sample code) for both of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, for 50MHz:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.freescale.com/files/32bit/software/KINETIS_50MHZ_SC.zip?WT_TYPE=Lab" target="test_blank"&gt;http://www.freescale.com/files/32bit/software/KINETIS_50MHZ_SC.zip?WT_TYPE=Lab&lt;/A&gt; and Test Software&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=zip&amp;amp;WT_ASSET=Downloads&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will find examples of managing LED's and switches&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Luis&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 21:17:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224511#M4274</guid>
      <dc:creator>LuisCasado</dc:creator>
      <dc:date>2013-10-22T21:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Declare &amp; read pin without Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224512#M4275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeremie,&lt;/P&gt;&lt;P&gt;I defined a single port pin for HB_LED in the following way using macros.&lt;/P&gt;&lt;P&gt;You can try the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define GPIO_PIN_MASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (31U)&lt;/P&gt;&lt;P&gt;#define GPIO_PIN_OUT(dir_reg, pin_no)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (dir_reg |= (((1U) &amp;lt;&amp;lt; (pin_no &amp;amp; GPIO_PIN_MASK))))&lt;/P&gt;&lt;P&gt;#define GPIO_PIN_IN(dir_reg, pin_no)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (dir_reg &amp;amp;= (~(((1U) &amp;lt;&amp;lt; (pin_no &amp;amp; GPIO_PIN_MASK)))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define GPIO_PIN_HIGH(dir_reg, pin_no)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (dir_reg |= (((1U) &amp;lt;&amp;lt; (pin_no &amp;amp; GPIO_PIN_MASK))))&lt;/P&gt;&lt;P&gt;#define GPIO_PIN_LOW(dir_reg, pin_no)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (dir_reg &amp;amp;= (~(((1U) &amp;lt;&amp;lt; (pin_no &amp;amp; GPIO_PIN_MASK)))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//----------------------- HEART BEAT LED----------------------------------------&lt;/P&gt;&lt;P&gt;#define HB_LED_DIR_OUT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_PIN_OUT(GPIOA_PDDR, PIN_8)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define HB_LED_OFF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_PIN_HIGH(GPIOA_PDOR, PIN_8)&lt;/P&gt;&lt;P&gt;#define HB_LED_ON&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_PIN_LOW(GPIOA_PDOR, PIN_8)&lt;/P&gt;&lt;P&gt;#define HB_LED_TOGGLE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_PIN_HIGH(GPIOA_PTOR, PIN_8)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards ,&lt;/P&gt;&lt;P&gt; Nasreen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 05:31:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declare-read-pin-without-Processor-Expert/m-p/224512#M4275</guid>
      <dc:creator>nasreenshaikh</dc:creator>
      <dc:date>2013-10-23T05:31:29Z</dc:date>
    </item>
  </channel>
</rss>

