Atmega128 and 7x7segments display (by Donatas)
Hello,
I have a problem with atmega128 and cycle time.
I am usig 7 digits 7 segment display. I used CTC counter (0:13) and one cycle impulse for it. I have 8MHz cristal oscilator. And frequency for each digit is about 10Hz so they are blinking. How can I speed up this thing. I attached my program. Please look at it from 45 rung. Thans.
(no subject) (by Jonathan Westhues)
Rosc should be toggling with period Tcycle*2 = 1 ms. So the counter Cd, which goes from 0 to 13, should have overall period 14 ms, which would correspond to 71 Hz.
But, I would guess that your cycle time isn't actually 0.5 ms. That's probably too short for the micro to finish executing the entire program. So the actual cycle time is slower, and the digits blink.
First, the cycle time should be increased until the program actually runs with the specified cycle time (which you can measure by measuring the LED blink frequency). Then, the only thing to do is to increase the processor frequency--which you can do by a factor of 2, to 16 MHz, if you're running at full voltage--or to simplify your program.
Though I would note, for example, that you could modify your counter to count with period Tcycle, instead of Tcycle*2, by using an ADD op (Cd := Cd + 1) plus some logic to make it wrap, instead of the CTC op.