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

KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am