I am controlling an ADC with my Arduino Uno. I would like the clock of the ADC to be the same frequency of the Arduino. Is there any way that I can have a constant clock output from one of the Arduino pin ?
Thanks,
Liam
I am controlling an ADC with my Arduino Uno. I would like the clock of the ADC to be the same frequency of the Arduino. Is there any way that I can have a constant clock output from one of the Arduino pin ? Thanks, Liam |
|||||
|
This outputs 8 MHz on pin 9:
You change the prescaler bits. You can look at the datasheet or my cheat sheet here: You may not need a prescaler, depending on the frequency. Change OCR1A to some number between 0 and 65535 to slow it down. |
|||||||||
|
You can use one of the PWM pins on Arduino to output a PWM signal. If you want a constant clock, you need to set the duty cycle of the PWM to be 0.5, i.e. 50%. Syntax: analogWrite(pin, value) where the parameter "value" is the duty cycle ranges from 0 (always off) to 255 (always on) since it is a 8-bit PWM generator inside Arduino. If you need a PWM wave with duty cycle of 0.5, you need to set the "value" above to be 127, which is exactly in middle of 0 and 255:
|
|||||||||
|