Hello---I was tring to generate a simple sqaure wave on the mega 48 PDIP pin 11 (PD5, OC0B) (self oscillating using the compare function)
I tried multiple settings & got nothing---I checked to ensure ddrd, pd5 was set.
nitialize: ldi temp, $12 ;set com0B0 & WGM01
out tccr0a, temp
ldi temp, $02 ;set a clk/8 prescale
out tccr0b, temp
ldi temp, $22 ;set timer compare value (set freq)
; out ocr0b, temp
out ocr0a, temp -----see comments
I finally got to this point & still nothing at all. Then for the hell of it I wrote my compare value to OCR0A & OUT came my Square Wave!!! Strangely, deleteing the setup of ocr0b still allows it to still work. It appears that some register label or pinout definition is switched (or my understanding is way off). Is there an errata floating around regarding the pinout (perhaps I am really using OC0A on pin 11) or register definitions?
At least I luckily have a waveform, but now I don't know why!