Discussion in "AVR Discussion Forum" started by    nuRuL    Apr 24, 2008.
Thu Apr 24 2008, 08:11 pm
#1
hi
im now trying to generate a pwm signal (10kHz squarewave signal) using timer/counter0 provided on atmega169.
however, the output compare match will generate the waveform on OC0A pin, which is in this case, PB4
so in order to let the signal visible on the pin (output), i put this line in

DDRB = 0x10;

but i kinda have a situation here, cos im attaching the butterfly on my school's development board and it does not give any access to portB
so my question is, how do i write the code to let, say Port D Pin 0 (PD0) to output whats on PB4?
many thanks in advance

Thu Apr 24 2008, 09:09 pm
#2
i think i already gave a thought on this...

while in fastPWM avr count up and down and both time when compare occurs state of Output compare pin changes. If you enable the compare interrupt then you can change the state of PortD0 pin in that service routine. try it..
 nuRuL like this.
Fri Apr 25 2008, 09:10 am
#3
yes but i dont really understand
but this one is more clear i guess
i'll try to do it first and see what happens
thanks!

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

FrankTrelm
Tue May 14 2024, 10:39 am
BillyTum
Tue May 14 2024, 09:08 am
Loganbag
Tue May 14 2024, 04:05 am
MichaelMog
Tue May 14 2024, 03:58 am
ThomasGaxaW
Mon May 13 2024, 05:33 pm
RobertInfup
Mon May 13 2024, 04:28 pm
Joshuatem
Mon May 13 2024, 08:30 am
RaymondPex
Mon May 13 2024, 03:24 am