How to use Arduino as a clock source?

I need to use the MCP2120 infrared encoder/decoder, this chip requires a clock of 7.3728 MHz. Is there any way I can use Arduino to output a clock source?


the simplest solution is to put a crystal of that value on the IR chip itself.


It is possible to sacrifice a PWM and make a timer clock a pin, but its period can only be integer multiples of your Arduino period. 7.3728MHz is not one of them. You could make 8MHz, but that is far enough off that I would expect it to be filtered out be the remote encoder/decoder.

I noticed that there are 2 pin and 4 pin crystal oscillator, what’s the difference?

2 pin devices are just the crystal resonator. 4 pin devices take power and ground and make a TTL level oscillating signal on the output.

Thanks! What does Arduino use? Resonator? What am supposed to use here? Or I can use either of them.

The MCP2120 datasheet is a little vague about the OSCx pins, but I think there are enough clues there. It shows a photo of a development board with a 2 pin crystal with tiny capacitors on each lead. The pin description describes OSC1 and OSC2 for using a crystal, and also marks OSC1 as CLKIN when using an external clock. Looks like you could go either way. It has the circuitry to use a 2 pin crystal, but if you just have a 4 pin oscillator you could run its output into the OSC1/CLKIN pin.

The MCP2120/MCP2150 developer's kit user's guide shows a crystal on OSC1 and OSC2 with 18pF capacitors to ground from each side of the crystal. I'd go with that.

All hail to power of googling a part number!