Crazy Square Wave

How to generate 10% duty cycle 1MHz square wave with 180 degree phase shift on arduino Uno?

@snehit07, do not hijack. Thread split.

16000000 / 1000000 = 16 steps

100% / 16 = 6.25%

Yup. No way to get 10%. (Assuming you are referring to an AVR based Arduino.)

You can generate a 1MHz signal, but not at a duty cycle of 10%

The period of 1 clock cycle is 62.5ns, so the high portion of your signal needs to be a multiple of 62.5ns.

For a 10% duty cycle at 1MHz, you want the signal high for 100ns.
100ns is not a multiple of 62.5ns.

with 180 degree phase shift

With respect to what?

Clearly an X-Y problem.