Could someone be kind enough and tell me how many instruction cycles each line of this code will use because I need to know what time this routine takes to execute.
I'm using a PIC16F684 and its internal oscillator at 8MHz
Code:
databyte = %00000000
'wait for the header pulse to end and check if duration is about 2400us+/-100us
j = 0
WHILE (porta.0 == 0)
PAUSEUS 20
j = j + 1
WEND
IF (( j < 115) || (j > 125)) then abort 'wrong pulse duration
FOR i = 0 to 7
j = 0
WHILE (porta.0 == 1) 'wait until the bit prefix (600us no-pulse) ends
PAUSEUS 20
j = j + 1
WEND
IF ((j < 25) || (j > 35)) then abort 'wrong no-pulse duration, we want it to be 600us+/-100us
j = 0
WHILE (porta.0 == 0)
PAUSEUS 20
j = j + 1
WEND
IF ((j > 25) && (j < 35)) THEN
databyte.0(i) = 0
GOTO bypass
ENDIF
IF ((j > 55) && (j < 65)) THEN
databyte.0(i) = 1
GOTO bypass
ENDIF
GOTO abort 'wrong pulse duration
bypass:
NEXT i
abort:
Bookmarks