Pausing hw timer in high state? [SOLVED]

Hello!

I'm working on a 8-bit computer and I'm evaluating the feasibility of using an AVR microcontroller (Atmega1284P to be exact) for generating the clock signal for the CPU.

I need to generate a 1 Mhz clock signal using the AVR timer hardware and I need to be able to pause and resume the clock. It is critical that the clock is always paused in high state.

Is this possible to do? Can I read back the output state and stop/resume the timer when the signal is high?

I can work out the details myself, but it would be nice to know about the general feasibility of this idea so that I don't hit a dead-end after spending a lot of time on this :slight_smile:

The same could be achieved with a simple nand gate, driving a ceramic resonator (with just a couple of capacitors and resistors). Using an arduino for this just seems overkill.

Sure, but the AVR has other functions planned. It's going to be sharing the address and data busses with the main CPU and acting as a co-processor.

Ok, data sheet has the answer: yes, I can read back the pin value (even when the pin is in output mode) from PINx registers and pause the timer by setting timer's prescaler to 0.