Timers with mega

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,
I am trying to get a 109 hz signal of a mega103 with a 4 mhz clock, and using the 16 bit timers. I believe I am missing something, here is what I have ..

OCR1AL = 0x59;
OCR1AH = 0x8f;
TCCR1A = 0x80;
TCCR1B = 0x09;
TCNT1H = 0x00;
TCNT1L = 0x00;
.. I believe this is just using it in compare mode, but I get nothing out of the output, and the DDRB is set ... Anyone know what I am missing ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Erik,
Today I was much more level headed, I saw that as I was paging through the datasheet. Something wierd is hapening though, I can change the higher value(OCR1AH) all I want, and it doesnt change the frequency of the output. Only as I move the lower(OCR1AL) value it changes, but I was able to get my desired frequency, but changing the divide frequency, and the value of the lower register. Any reason why you think the upper value has no effect ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Slightly OT: If you haven't already, search this site for AVRCalc. It helps to make setting the numbers much easier, for timers, ocr, toggling, etc.

Lee