<?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: SOME HELP WITH ROBOT´S STUFF AND MORE WITH MC68HC908JK1 in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134152#M3652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I suspect you will need to write your own function that "bit-bangs" the PWM operation, using the required GPIO pins.&amp;nbsp; You would probably need to use the TIM channels in an "interrupt only" manner, where the output level at the GP pin will be switched within the ISR code.&amp;nbsp; This will add some degree of latency to the PWM operation, and will restrict the maximum PWM frequency that may be used.&amp;nbsp; Minimum and maximum duty cycle limits are also likely because of the processing time required by the ISRs.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;To get a better idea of your requirements, the following additional information would need to be considered -&lt;/FONT&gt;&lt;/DIV&gt;&lt;OL&gt;&lt;LI&gt;&lt;FONT size="2"&gt;MCU bus frequency&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Number of motors to be controlled&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Required PWM frequency&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Required PWM resolution&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Minimum first step of PWM, i.e.&amp;nbsp;from motor off to the minimum run speed.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;With this information, it should be possible to determine the feasibility.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 May 2007 12:54:31 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2007-05-23T12:54:31Z</dc:date>
    <item>
      <title>SOME HELP WITH ROBOT´S STUFF AND MORE WITH MC68HC908JK1</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134148#M3648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;HELLO, yes i know that i use some """out-of-date"""" devices but what i can do? jejeje.&amp;nbsp; i bought a china's cheap r/c car and i modified it to be a simple robot.&amp;nbsp;&amp;nbsp; the only thing (for the moment) that this little piece of plastic have to do is to follow a black line (3M black tape for example). the only problem is that mi little car is too fast to follow properly the black line.&amp;nbsp;&amp;nbsp; in the program i add a kind of improvised PWM speed control in the part of motor controls on the hc908's code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;here is the piece of code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void AdelantePWM(int pwm){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PTB_PTB3=0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PTD_PTD2=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Delayms(pwm);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PTB_PTB3=0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PTD_PTD2=0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Delayms(pwm);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this code is within a library (MOTORAPI.c) and controls the main motor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;int the main code the function apears AdelantePWM(250) for example, this will turn on and off the motor during 0.25 seconds. (Delayms is a delay function).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i think that is good but i will no take a risks with that... (call me donkey if you want cause i know only the basics of hc908 architecture).&amp;nbsp;&amp;nbsp; here is some stills of the "robot".&amp;nbsp; if you want to see it working please help me &lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(sorry , i know just a little new english words.... &lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif"&gt;&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://mauricio2346.googlepages.com/Imagen041.jpg"&gt;&lt;IMG height="233" src="http://mauricio2346.googlepages.com/Imagen041.jpg" width="346" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://mauricio2346.googlepages.com/Imagen045.jpg"&gt;&lt;IMG height="259" src="http://mauricio2346.googlepages.com/Imagen045.jpg" width="346" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://mauricio2346.googlepages.com/Imagen043.jpg"&gt;&lt;IMG height="257" src="http://mauricio2346.googlepages.com/Imagen043.jpg" width="345" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 11:02:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134148#M3648</guid>
      <dc:creator>mauricio2346</dc:creator>
      <dc:date>2007-05-18T11:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: SOME HELP WITH ROBOT´S STUFF AND MORE WITH MC68HC908JK1</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134149#M3649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Mauricio,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't know that they are "out of date", I just shipped some products that use the JK1 the other day.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I like the car, it looks quite impressive, but what was the actual question?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 11:51:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134149#M3649</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2007-05-18T11:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: SOME HELP WITH ROBOT´S STUFF AND MORE WITH MC68HC908JK1</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134150#M3650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I like the idea of keeping it simple.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The JK1 timers support PWM.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Create your project using Processor Expert.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Choose the PWM bean and it will create the PWM code for you.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You can then just use&amp;nbsp;API calls to the PWM&amp;nbsp;like these:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PWM1_SetRatio16(word Ratio);&amp;nbsp; // sets the PWM according to a ratio 0-100%&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PWM1_SetDutyMS(word Time); // sets the PWM duty cycle by mili-seconds&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I like to use&amp;nbsp;the SetRatio command.&amp;nbsp; This way, when&amp;nbsp;you set the period in the set up of the bean, you don't have to care about it anymore.&amp;nbsp; Just send a command to set the duty cycle.&amp;nbsp; Also, it's easy to make a loop in your code to increase / decrease the ratio for acceleration control.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hope this helps.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;uCTechnoGeek&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 20:35:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134150#M3650</guid>
      <dc:creator>UcTechnoGeek</dc:creator>
      <dc:date>2007-05-18T20:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: SOME HELP WITH ROBOT´S STUFF AND MORE WITH MC68HC908JK1</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134151#M3651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Hi!! yeah, i got it but that means i should use&amp;nbsp; PTD4 and PTD5 (unfortunately i cant modify the board of the car).&amp;nbsp; when i bought the r/c car i tought this toy wouldn't be too fast, but when i cut it.... you know, sometimes you get surprised with your proyects (especially robots). in this moment that pins controls other things of the board.&amp;nbsp; can i use this function with I/O ports???&lt;BR /&gt;THANKS!&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 May 2007 13:23:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134151#M3651</guid>
      <dc:creator>mauricio2346</dc:creator>
      <dc:date>2007-05-19T13:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: SOME HELP WITH ROBOT´S STUFF AND MORE WITH MC68HC908JK1</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134152#M3652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I suspect you will need to write your own function that "bit-bangs" the PWM operation, using the required GPIO pins.&amp;nbsp; You would probably need to use the TIM channels in an "interrupt only" manner, where the output level at the GP pin will be switched within the ISR code.&amp;nbsp; This will add some degree of latency to the PWM operation, and will restrict the maximum PWM frequency that may be used.&amp;nbsp; Minimum and maximum duty cycle limits are also likely because of the processing time required by the ISRs.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;To get a better idea of your requirements, the following additional information would need to be considered -&lt;/FONT&gt;&lt;/DIV&gt;&lt;OL&gt;&lt;LI&gt;&lt;FONT size="2"&gt;MCU bus frequency&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Number of motors to be controlled&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Required PWM frequency&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Required PWM resolution&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Minimum first step of PWM, i.e.&amp;nbsp;from motor off to the minimum run speed.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;With this information, it should be possible to determine the feasibility.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 12:54:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134152#M3652</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-05-23T12:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: SOME HELP WITH ROBOT´S STUFF AND MORE WITH MC68HC908JK1</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134153#M3653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi&lt;BR /&gt;&lt;BR /&gt;Your code would probably work, just not very reliably. You definitely need to use an interrupt or hardware PWM based on a timer. Your robot now only follows a black line, but you will soon want to make it do more things. If you do not use a timer to generate your pulses, then when you add new features to your robot, the PWM will probably start acting funny. The car will probably slow down whenever you tell it to do something else!&lt;BR /&gt;&lt;BR /&gt;Your code would not damage the microcontroller. But you need to be sure the electronic circuit between the microcontroller and the motor protects the microcontroller. Probably the most important thing to beware of is electrical noise coming from the motor. Also make sure the current drawn from the microcontroller is not too high. I won't go into details here, because I expect that you know electronics. Your assembly work on the circuit is very good.&lt;BR /&gt;&lt;BR /&gt;So try the Processor Expert idea (if this uses a timer) or answer the questions that BigMac asked in the last message, so that you can get some help setting up a timer for making your PWM.&lt;BR /&gt;&lt;BR /&gt;Dusty&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2007 01:05:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SOME-HELP-WITH-ROBOT-S-STUFF-AND-MORE-WITH-MC68HC908JK1/m-p/134153#M3653</guid>
      <dc:creator>DustyStew</dc:creator>
      <dc:date>2007-05-28T01:05:39Z</dc:date>
    </item>
  </channel>
</rss>

