I am trying to make a sweeping frequency output using an Mega128. I set timer 1 to CTC (mode 4), and set OC1A to output. If I run my program normally, the OC1A output toggles nicely at whatever fixed frequency I want. But when I start sweeping, as soon as I write a new value to the OCR1A register it stops working and the output goes low. If I write increasing values (which cause the output to decrease) it works OK, but if I write decreasing values it stops. At first I was updating the OCR1A registers asynchonously. I thought maybe that was the problem (conflicting with TCNT), so I changed it so that I enable the OC interrupt and change the compare value there. It makes no difference. In the simulator it works OK. Has anybody else had this problem? Jim
Message
CTC problem
2007-01-09 by jimmcguffin
Attachments
- No local attachments were found for this message.