Let's Make Robots!

38 khz pwm pulse modulation

avr 38khz modulation problems

Hello guys...

 

I have some troubles... I take a look at AVR Calc and at 8mhz I can make a CTC of around 37.98khz signal wich lets say would be ok for 38... the problem is that there is not enough explanation of how to make it...

 

for 8mhz, 1 prescaller, ,on 8 bit timer:

OCR = 0xD2

TCNT Base = 0x2D

CTC = 37.9147khz

Error = -0.224%

overflow: 32.000 uSec

PWM normal/fast = 31250.000 hz

pwm phase correct 15686.274hz

 

 

can you please help me how to set the code for this?