I am completely new to arduino programming. I picked up the Arduino Due with the intention of sampling an analog signal (60Hz) at specific frequencies. I am trying to sample from one of the analog pins at integer multiples of 60Hz, such as 3.84kHz, 6kHz or 21.6kHz. I have found little documentation for the Due online.
The datasheet states that the clock governing the analog pins is set to the MCK (asuming the master clock, 84MHz) divided by a prescaler value. The formula given is MCK / ((Prescaler value +1) * 2), with prescaler value ranging from 0 to 512. If the max prescaler value is 512 does this mean that I must slow down the MCK to attain the desired sampling frequency? If so, I cannot find anything in the data sheet that states how to alter the MCK. How do I set the sampling frequency to a specific value?
I am also questioning the method I am using to detect how many samples a second I am recording. I reading from an analog pin for 1 second (with various baud rates) and detecting how many values are sent to my computer through the microUSB port (using Putty). Any advice or direction you can give me would be greatly apreciated. Thanks.