Choosing the right oscillator

Found it: https://forum.arduino.cc/t/esp-pulse-output-resolution/896740/8

Do you see the noInterrupts(); ? After that, most Arduino functions do no longer work. The digitalRead() still works. The interrupts are turned off to stop Timer0, which is used for millis(). The interrupt of Timer0 could cause a small extra delay now and then. By stopping the interrupts, the timing is always 100% accurate.

The line PINB = bit( 0); toggles a single output, but it can toggle multiple outputs at once.

The __builtin_avr_delay_cycles() function is very precise. The compiler uses the single clock cycle NOP instruction (or a combination of other instructions) to create a certain delay.
For 10 milliseconds, I think you need 160 of those delay cycles.

I think @Koepel is giving you much more accuracy than you need. For what you are doing, I doubt very much that you need 62.5ns accuracy. But since you haven't revealed the full specs or specifics of your application hardware, it may serve you well if you get in a jam. How far does any motor, servo, or actuator move in that interval? I can assure you that it is not much.

You need to prototype this, if you already have the PCB you need to start testing. If you have no PCB yet, you need to build and test a hardware prototype. As far as oscillator choice, sufficient answers have been provided, but apparently ignored, for example reply #16 asks a question that is answered in reply #15. I know I could cut and paste a few words from it into Google and have a data sheet and ordering link in front of me in about a minute.

JLPCB is not a design shop. They will happily build any junk design you throw at them. There is a lot that can go wrong with a PCB design so it's worth a large investment of time to learn how it's really supposed to be done. Before shops like that came along, the price alone was a gate to keep out guesswork designs.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.