How can I set an interupt to go off every 33 milliseconds?

When trying to create a timer interrupt you need to use registers to count clock cycles and the process kind of confuses me because this is my first time working with Arduino. Here is what I have so far:

#include <avr/interrupt.h>

const uint16_t PERIOD = ...;  // I'm assuming that here I will have to calculate how long a 
                                    //clock cycle is and then multiply that by the number of cycles 
                                    //I need to reach 33 milliseconds. Am I right?


void setup()
    // Configure Timer x.
    TCCRxA = 0;            // undo the timer config done...
    TCCRxB = 0;            // the Arduino core library
    TCNTx = 0;             // reset the timer
    OCRxA = PERIOD - 1;    // set the period
    TIMSKx = _BV(OCIExA);  // enable TIMERx_COMPA interrupt
    TCCRxA = ...;          // set the counting mode to CTC...
    TCCRxB = ...;          // ...and set the prescaler

void loop()
    // Do the job that I need to do first

    // Sleep for the remaining time and wait for the interupt.

According to the tutorial I followed I’m supposed to set the counting mode to CTC and set the prescaller, but I’m not sure what values those will be or how to calculate them. Can anyone help me fill in the missing information? I’m having troulbe understanding the documenation.

You could use one of the timer libraries:

And there are a few available in the library manager as well.

--- bill

Do those work when the device has been powered down with the sleep function?

They are libraries to set up the h/w to generate interrupts and call an ISR.
It is the interrupt that will wake up the processor.
It won't be a slim as doing the raw h/w yourself with a null ISR, but it is a easier, as that code already exists.
And you may find that you also want to do something in the ISR later.

--- bill

Just waiting for a wake-up won't help if Timer0 is still interrupting about every millisecond. If you need something small done every 33 milliseconds you should put that in the ISR.

33 milliseconds is 528000 clock cycles (at 16 MHz) . To fit that in a 16-bit value you have to pre-scale the clock by a factor of 32 (to 0.5 MHz) and count to 16500 instead.