regarding butterfly's atmega169
Discussion in "AVR Discussion Forum" started by nuRuL Apr 24, 2008.
Thu Apr 24 2008, 08:11 pm
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
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
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..
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
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!
but this one is more clear i guess
i'll try to do it first and see what happens
thanks!
Powered by e107 Forum System