Go Down

Topic: Meaning of VARIANT_MCK / 256 / yourValue (Read 740 times) previous topic - next topic


Hi! I'm a newbie on Arduino, and I have a question that might be too basic to ask, but I can't figure it out on my own and I can't find the answer described to me here either.

I am trying to generate a chirp signal with Timer Counters. I have found some code that helps me getting started, but I still can't figure out what the following row means:

Code: [Select]
const uint32_t rc = VARIANT_MCK / 256 / frequencyStart;

I understand everything but the VARIANT_MCK/256 part. I don't understand how to count the actual value that will become rc and how it all adds up to the correct frequency I'm trying to achieve.

The code is using the TIMER_CLOCK4, which is MCK/128. I have an Arduino Due, so MCK should be 84MHz.

Will the above division then be MCK/128/256/frequencyStart? And what will the actual answer represent? I feel like I'm out on deep water and I need a helping hand before I go completely under water, so if anyone could explain it to me I'd be extremely grateful!

Go Up