simple question arduino code

Hello I'm trying to output a signal for a certain time: 0.5 milliseconds I'm using the arduino. I output in pin_9, when the pin_12 is HIGH pin_9 is HIGH for only 0.5 milliseconds

when I use the time delay with 1 ms, it outputs correctly but if I use a time delay below 1 ms (that is the my case) it outputs only for a few MICRO seconds......

do you know why it happens? thanks

You cannot delay() with fractional values.

Use delayMicroseconds(500) instead.