i am using 4MHz clock for pic18f452. therefore, 250ns is 1 instruction cycle. is there any way to get a delay of 375ns? using timers, i cant define count in fractions. using inbuit delay function delay(1)=250ns delay(2)=500ns . if i use delay(1.5) it will be still 250ns as i can only use an integer as a passing parameter.
I think you are not calculating instruction time correctly. A 4 MHz clock is divided by 4 phases (fetch, decode, execute, store), so you have a 1 us instruction time, the smallest delay at 4 MHz.
However, I looked at the spec sheet for the PIC18F452 and it states that it will run off an external oscillator from DC to 40 MHz. 40MHZ means a 100 ns instruction time.
4 of those cycles gives you exactly 400 ns. Or you can run 3 cycles for 300 ns and use a RC network to stretch it out another 75 ns.
If toggling a I/O pin then the best you can do in a burst is 10 MHz/2.
Note that you could buy a good 32 MHZ oscillator which would give you exactly 375 ns instruction cycles, as suggested by @winny.
This is quoted from the PIC18F4xx datasheet:
• Up to 10 MIPs operation:
DC - 40 MHz osc./clock input
4 MHz - 10 MHz osc./clock input with PLL active
• 16-bit wide instructions, 8-bit wide data path
• Priority levels for interrupts
• 8 x 8 Single Cycle Hardware Multiplier
Not familiar with 18F parts, but...
Analog comparators can be used to add delay to pins, and dac could make this tunable. This can't change instruction timing however. CLC modules might be usable likewise
TMR1 can be externally clocked without synchronisation, so you might be able to clock it off the crystal. This can't change instruction timing however.
You have a 4x clock PLL, so you could bump up the internal clock for a bit. This will change the instruction timing.
BTW 4MHz xtal = 1000ns cycle