Re: [WheelWatcher] AVR ATMega at 8MHz
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@xxxxxxxxxxxxxxxxx
[mailto:wheelwatcher-bounces@xxxxxxxxxxxxxxxxx] 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@xxxxxxxxxxxxxxxxx
> http://list.nubotics.com/mailman/listinfo/wheelwatcher
>
>
>
This archive was generated by a fusion of
Pipermail (Mailman edition) and
MHonArc.