I'm a newbie to Arduino, and haven't coded in several decades. I'm learning C and its Arduino flavor as I go, which is certainly part of my problem.
I can't be the first with this issue - can you point me to a page that will help me?
I've tried hard for over 8 hours of searching with every keyword and phrase I know, but failed to find anything on this site that tells me how to write to the Timer 1 hardware control Registers on the Uno R3's ATMega328 chip. digitalWrite() seems to be purely a pin-oriented function; there has to be byte- or word-wise read/write capability for internal chip hardware control registers.
The Language Reference doesn't help. I figured there'd be something on reading and writing registers in the Constants section, ideally just a simple sentence like "Every register and bit name in the Atmel data sheet is implemented as a constant in Library XXXX". or a memory space mapping of the registers. Not that I could find.
IN CASE YOU'RE INTERESTED - WHAT I'M DEVELOPING - AND WHY I NEED THIS INFORMATION I need to set up a variable 56-60 Hz square wave for a telescope tracking motor 115VAC frequency control. The challenge is that I need very fine variations in that range. The output will control a 12VDC-115VAC inverter that powers a 115VAC synchronous motor that's geared to the telescope's equatorial axis.
Using a Uno R3, I plan to set up Timer 1 to toggle on OCR1A, and drive that square wave of the chip's pin 15 and the board's pin 9 to the frequency control input of the power inverter. With a prescaler of divide-by-8, I should get out a proper frequency with OCR1A input values in the neighborhood of 16,000, the actual values varying depending on: (a) Compensation for imperfect frequency accuracy of each board's particular crystal, and (b) Whether I'm tracking stars, the sun or the moon, which move across our field of view at three different angular rates.
So I want to be able to: (1) Set up Timer 1 for /8 prescaling, count up, toggle-on-match / reset, and output a square wave on pin 15 (2) Load a start value into OCR1A, then increment, decrement, or otherwise rewrite it during the telescope calibration process.