I am using PIC16F72 the
__delay_ms(55);
is not working showing error after removing it the code work fine for led flash/blink...?
i am using #include <htc.h> header file...
I am not sure what you are saying. Is your comment a question or a statement. When D1 =0 , what do you want to happen? Presumably, this delay is a subroutine, so you need a return. That return will also add two cycles. The call also takes two cycles. I agree, it is 19 cycles from movlw to the NOP that I added.
That was not a right or wrong opinion. It was in the datasheet. The program counter is advanced before fetching the instruction. If the result of the instruction requires a change to the program counter, then it seems logical that another cycle is needed.
Here are some relevant quotes from the Mid-Range MCU Family Reference Manual. The datasheet for each MCU has a similar discussion about single-cycle instructions.
PC incremented before fetching instruction (page 4-5):
Internally, the program counter (PC) is incremented
every Q1, and the instruction is fetched from the program memory and latched into the
instruction register in Q4.
An “Instruction Cycle” consists of four Q cycles (Q1, Q2, Q3, and Q4). Fetch takes one instruction
cycle while decode and execute takes another instruction cycle. However, due to Pipelining, each
instruction effectively executes in one cycle. If an instruction causes the program counter to
change (e.g. GOTO) then an extra cycle is required to complete the instruction (Example 4-1).