<?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: GPIO pins for input and output to LED circuit in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159604#M9506</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;I am using Kinetis KLO M0 family as requirement and I have to drive&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt; a relay that is supplying 277VAC @ 5A to the load.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;I also need to be turning it ON and OFF every 9 seconds. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;I am &lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;wondering which micro controller outputs should I be using? ( like you mention GPIO here)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;I can design the power conversion needed, but I am not much&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;familiar with Microcontroller.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 May 2013 20:12:31 GMT</pubDate>
    <dc:creator>victorrod</dc:creator>
    <dc:date>2013-05-16T20:12:31Z</dc:date>
    <item>
      <title>GPIO pins for input and output to LED circuit</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159602#M9504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using MC9S08GT60 MCU and from the manual I understand that there are lots of pins that I can use as GPIO if I don't use their intended function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to do is, connect the GPIO to a custom built circuit with relays and LEDs (those will represent devices that I want to control remotely) so my question is, how do I give output and receive input from the circuit with GPIO? Is it as simple as directly connecting the pin to a demultiplexer on the LED circuit assuming there will be volt emitted when output pin is set to high?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd appreciate on any advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Mar 2009 13:32:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159602#M9504</guid>
      <dc:creator>SyaZ</dc:creator>
      <dc:date>2009-03-07T13:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO pins for input and output to LED circuit</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159603#M9505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've never been a fan of connecting CPU pins directly to the outside world.&lt;/P&gt;&lt;P&gt;If your design is budget conscious then you might have no choice, but something like a logic FET's are very nice for driving LED's, I've used BSS138's in many projects.&lt;/P&gt;&lt;P&gt;The CPU ports turn on the BSS138 by driving the port pin high (set the Port direction as an output, then change port state to 1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eg -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;mov&amp;nbsp;&amp;nbsp; #%00000000,PORTB&amp;nbsp;&amp;nbsp; ; Set up Port B values before changing to output.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;mov&amp;nbsp;&amp;nbsp; #%11111111,DDRB&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Set up Port B Data Direction values (1=Outputs).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;bset&amp;nbsp; 1,PORTB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; ; Turn on Bit 1 of Port B&amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;bclr&amp;nbsp; 1,PORTB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; ; Turn off Bit 1 of Port B&amp;nbsp;&lt;/FONT&gt; &lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above sets all of PORTB as an output with the default state of off '0'.&lt;/P&gt;&lt;P&gt;To turn on the output you 'bset' the bit you want on and bclr to turn it off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For inputs it depends on what voltage you are using, if a 12V input then at minimum you need a resistive divider and change the DDR register to be used as inputs.&lt;/P&gt;&lt;P&gt;The Reference manual for the HC08's covers port configuration commands.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, I have not used the MC9S08GT60 so I don't know if the same rules apply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;Ross&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by Bloodhound on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-03-22&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;11:37 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Mar 2009 19:36:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159603#M9505</guid>
      <dc:creator>Bloodhound</dc:creator>
      <dc:date>2009-03-22T19:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO pins for input and output to LED circuit</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159604#M9506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;I am using Kinetis KLO M0 family as requirement and I have to drive&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt; a relay that is supplying 277VAC @ 5A to the load.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;I also need to be turning it ON and OFF every 9 seconds. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;I am &lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;wondering which micro controller outputs should I be using? ( like you mention GPIO here)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;I can design the power conversion needed, but I am not much&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;familiar with Microcontroller.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 20:12:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159604#M9506</guid>
      <dc:creator>victorrod</dc:creator>
      <dc:date>2013-05-16T20:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO pins for input and output to LED circuit</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159605#M9507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ahmad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, GPIOs can drive some LED directly and relays using some transistors. See the attachments. You only have to take care to the Electrical Characteristics of the MCU (see datasheet - the total current supplied by all the pins of the MCU is limited).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the program, I think you are just beginning with this kind of devices. Thus I recommend you to use CodeWarrior and to write in C language, not in assembly like shown by Ross.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some few lines of code, with a LED connected on pin PTA0 (for example):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Initialize pin as output, set low (LED is switched OFF) */&lt;/P&gt;&lt;P&gt;PTAD_PTAD0 = 0;&lt;/P&gt;&lt;P&gt;PTADD_PTADD0 = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Set pin hight (LED is switched ON) */&lt;/P&gt;&lt;P&gt;PTAD_PTAD0 = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Set pin low (LED is switched OFF) */&lt;/P&gt;&lt;P&gt;PTAD_PTAD0 = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enjoy !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joel Guittet&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 May 2013 05:13:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/GPIO-pins-for-input-and-output-to-LED-circuit/m-p/159605#M9507</guid>
      <dc:creator>Joel69003</dc:creator>
      <dc:date>2013-05-27T05:13:42Z</dc:date>
    </item>
  </channel>
</rss>

