Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / Digital Interfaces and Clock Division

4.096 MHz crystals: generating a 1 kHz sampling trigger

A 4.096 MHz timer needs 4096 clock ticks between ADC triggers spaced 1 ms apart. With a counter that starts at zero, counts upward, includes the terminal count and has no prescaler, 0 through 4095 gives exactly 4096 values. Writing 4095 to the reload register assumes this counting behavior. Check the timing diagrams for compare match, toggle and overflow modes separately.

Why the oscilloscope may show 500 Hz

If firmware also toggles a GPIO at each trigger, the pin state at 0, 1 and 2 ms might be low, high and low. Adjacent transitions are 1 ms apart, while two consecutive edges of the same polarity are 2 ms apart. The oscilloscope therefore reports 500 Hz for the complete square wave.

For acceptance, check which trigger source the ADC actually selects. If every internal timer event triggers a sample, the sample rate is still 1 kHz. If the ADC instead triggers on the rising edge of the toggled pin, it samples once every two toggles. Save the trigger selection and timestamps of consecutive conversions together so the 500 Hz display does not lead to an unnecessary factor-of-two change in the counter value.

Send us a part number or your requirements

Brand, frequency, quantity and delivery target — a useful place to start.

WeChat

MERLIN · TIMING COMPONENTS

Scan with WeChat to contact Sales

Add our WeCom contacts from your usual WeChat app.

On desktop, scan with your phone. On mobile, save the QR image and select it from your album in WeChat Scan.