From tim at teccs.biz Thu Jun 19 20:07:08 2008 From: tim at teccs.biz (Tim Chapman) Date: Thu, 19 Jun 2008 21:07:08 -0600 Subject: [WheelWatcher] AVR ATMega at 8MHz Message-ID: <000e01c8d282$ba442a30$3c01a8c0@teccs> I am running the code found at http://www.nubotics.com/support/ww01/code/atmel/bascom/ww01_bascomavr_monito r.bas.php I have an ATMega running on the internal oscillator at 8MHz. I am getting output showing all the values advancing just fine. I am getting no output to the servos. I checked the signals with my oscilloscope on PinD.4 and PinD.5 as well as PinC.2 and PinC.5. Nothing going on there at all. Will this work at 8MHz or is 16MHz required? Thank you for your time. Tim From plskeggs at noeticdesign.com Fri Jun 20 21:48:13 2008 From: plskeggs at noeticdesign.com (Pete Skeggs) Date: Fri, 20 Jun 2008 22:48:13 -0600 Subject: [WheelWatcher] AVR ATMega at 8MHz In-Reply-To: <000e01c8d282$ba442a30$3c01a8c0@teccs> References: <000e01c8d282$ba442a30$3c01a8c0@teccs> Message-ID: <485C880D.5090300@noeticdesign.com> This is a multi-part message in MIME format. --------------080300000205090302050105 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Tim, Sorry you're having trouble. Did you modify the code at all? Exactly which atmega are you using? The first two lines after the comment header would need to be changed depending on which atmega and certainly regarding the 8MHz speed: |$regfile = "M16def.dat" $crystal = 8000000 ' was 16000000 | This would not explain why you would see no output at pins D4 and D5 but are seeing valid serial port output. The only reason that could be is that: - you changed the code in a bad way or, - you're not using an atmega16, but some other spin with slightly different internal peripherals or, - there is a wiring issue | | || As for other timing changes, timer 1 would be oscillating at fosc/64 = 125,000 Hz instead of 250,000, so you would need to set Capture1 = 2500 to get the PWM frequency to be 50Hz as required for servo control pulses. This would then mean that Max_servo should be 250, Min_servo 125, and Mid_servo 187, which are initialized before Main. You would also need to change the initialization of Out_r and Out_l in Setup to 250 and 125 respectively. -Pete ||Tim Chapman wrote: > I am running the code found at > http://www.nubotics.com/support/ww01/code/atmel/bascom/ww01_bascomavr_monito > r.bas.php > I have an ATMega running on the internal oscillator at 8MHz. > I am getting output showing all the values advancing just fine. > I am getting no output to the servos. I checked the signals with my > oscilloscope on PinD.4 and PinD.5 as well as PinC.2 and PinC.5. Nothing > going on there at all. > > Will this work at 8MHz or is 16MHz required? > > Thank you for your time. > > Tim > > _______________________________________________ > WheelWatcher mailing list > WheelWatcher at list.nubotics.com > http://list.nubotics.com/mailman/listinfo/wheelwatcher > > > --------------080300000205090302050105-- From tim at teccs.biz Sat Jun 21 09:39:58 2008 From: tim at teccs.biz (Tim Chapman) Date: Sat, 21 Jun 2008 10:39:58 -0600 Subject: [WheelWatcher] AVR ATMega at 8MHz In-Reply-To: <485C880D.5090300@noeticdesign.com> Message-ID: <000c01c8d3bd$71c08060$3c01a8c0@teccs> I made all the changes you described and it works fine. Thank you very much! I was getting my output from port c.2 and port c.5. They gave no output even after I changed the code. With servos connected to port d.4 and port d.5 it works fine. Thanks again. TIm -----Original Message----- From: wheelwatcher-bounces at list.nubotics.com [mailto:wheelwatcher-bounces at list.nubotics.com] On Behalf Of Pete Skeggs Sent: Friday, June 20, 2008 10:48 PM To: WW-01/WW-02 WheelWatcher Encoder Support List Subject: Re: [WheelWatcher] AVR ATMega at 8MHz Tim, Sorry you're having trouble. Did you modify the code at all? Exactly which atmega are you using? The first two lines after the comment header would need to be changed depending on which atmega and certainly regarding the 8MHz speed: |$regfile = "M16def.dat" $crystal = 8000000 ' was 16000000 | This would not explain why you would see no output at pins D4 and D5 but are seeing valid serial port output. The only reason that could be is that: - you changed the code in a bad way or, - you're not using an atmega16, but some other spin with slightly different internal peripherals or, - there is a wiring issue | | || As for other timing changes, timer 1 would be oscillating at fosc/64 = 125,000 Hz instead of 250,000, so you would need to set Capture1 = 2500 to get the PWM frequency to be 50Hz as required for servo control pulses. This would then mean that Max_servo should be 250, Min_servo 125, and Mid_servo 187, which are initialized before Main. You would also need to change the initialization of Out_r and Out_l in Setup to 250 and 125 respectively. -Pete ||Tim Chapman wrote: > I am running the code found at > http://www.nubotics.com/support/ww01/code/atmel/bascom/ww01_bascomavr_ > monito > r.bas.php > I have an ATMega running on the internal oscillator at 8MHz. > I am getting output showing all the values advancing just fine. > I am getting no output to the servos. I checked the signals with my > oscilloscope on PinD.4 and PinD.5 as well as PinC.2 and PinC.5. Nothing > going on there at all. > > Will this work at 8MHz or is 16MHz required? > > Thank you for your time. > > Tim > > _______________________________________________ > WheelWatcher mailing list > WheelWatcher at list.nubotics.com > http://list.nubotics.com/mailman/listinfo/wheelwatcher > > > From tim at teccs.biz Sun Jun 29 18:52:40 2008 From: tim at teccs.biz (Tim Chapman) Date: Sun, 29 Jun 2008 19:52:40 -0600 Subject: [WheelWatcher] AVR ATMega at 8MHz In-Reply-To: <485C880D.5090300@noeticdesign.com> Message-ID: <000201c8da53$fb22ed10$3c01a8c0@teccs> Pete, I really appreciate your assistance and need to ask you for another similar favor. I am new to microcontrollers and am having a hard time understanding the code for the wheelwatcher. I am weak on timers and PWM as they are implemented on the microcontrollers. Would you be so kind as to explaing the code to me. I don't understand what the 128usec business is about, etc. An overview of how this works would really be helpful. The comments in the code just aren't seeming to gel and make complete sense to me. If you would rather that I ask specific questions, I can go that route. Thank you again, Tim -----Original Message----- From: wheelwatcher-bounces at list.nubotics.com [mailto:wheelwatcher-bounces at list.nubotics.com] On Behalf Of Pete Skeggs Sent: Friday, June 20, 2008 10:48 PM To: WW-01/WW-02 WheelWatcher Encoder Support List Subject: Re: [WheelWatcher] AVR ATMega at 8MHz Tim, Sorry you're having trouble. Did you modify the code at all? Exactly which atmega are you using? The first two lines after the comment header would need to be changed depending on which atmega and certainly regarding the 8MHz speed: |$regfile = "M16def.dat" $crystal = 8000000 ' was 16000000 | This would not explain why you would see no output at pins D4 and D5 but are seeing valid serial port output. The only reason that could be is that: - you changed the code in a bad way or, - you're not using an atmega16, but some other spin with slightly different internal peripherals or, - there is a wiring issue | | || As for other timing changes, timer 1 would be oscillating at fosc/64 = 125,000 Hz instead of 250,000, so you would need to set Capture1 = 2500 to get the PWM frequency to be 50Hz as required for servo control pulses. This would then mean that Max_servo should be 250, Min_servo 125, and Mid_servo 187, which are initialized before Main. You would also need to change the initialization of Out_r and Out_l in Setup to 250 and 125 respectively. -Pete ||Tim Chapman wrote: > I am running the code found at > http://www.nubotics.com/support/ww01/code/atmel/bascom/ww01_bascomavr_ > monito > r.bas.php > I have an ATMega running on the internal oscillator at 8MHz. > I am getting output showing all the values advancing just fine. > I am getting no output to the servos. I checked the signals with my > oscilloscope on PinD.4 and PinD.5 as well as PinC.2 and PinC.5. Nothing > going on there at all. > > Will this work at 8MHz or is 16MHz required? > > Thank you for your time. > > Tim > > _______________________________________________ > WheelWatcher mailing list > WheelWatcher at list.nubotics.com > http://list.nubotics.com/mailman/listinfo/wheelwatcher > > >