Hi, I have this code which I am simulating using Proteus. I am running the PIC @ 4MHz so every instruction is 1uS.
Now my code runs a delay routine 0-255 then inside that routine another routine runs 0-255. Total delay should be 255 x 255 = 65025 mS. But the delay is somewhere between 180-200mS region. Can someone explain why this is happening please? Thanks
Code:
    PAGE0
    CLRF    PORTD
    CLRF    PORTB
    PAGE1
    CLRF    TRISD
    CLRF    TRISB
    PAGE0
    MOVLW    0
    MOVWF    COUNT1
    MOVWF    COUNT2
    MOVWF    COUNT3
    MOVWF    COUNT4


MAIN
    BSF    RSET
    CALL    DELAY250
    BCF    RSET
    CALL    DELAY250
    MOVWF    COUNT1
    MOVWF    COUNT2
    GOTO    MAIN


DELAY250
    CALL        DELAY500
    INCFSZ        COUNT1,f
    GOTO         DELAY250
    BCF        STATUS,Z
    RETURN
DELAY500
    INCFSZ        COUNT2,f
    GOTO        DELAY500
    BCF        STATUS,Z
    RETURN


    END