Hi,
If you are still stuck this might help.
You missed out an important detail and that is the frequency of the oscillator you are using.
For the answer I will assume a crystal of 4Mhz which means that 1 machine cycle, typically 1 instruction is 1Mhz or 1 us.
Now follow that code through as see what it does.
START
BSF PORTA,2 ; TURN ON A2
CALL TEMPO ; DELAY ABOUT 250MS X 3
CALL TEMPO
CALL TEMPO
BCF PORTA,2 ; TURN OFF A2
MOVLW B'01111111'
MOVWF PORTB ; TURN ON 7 BITS OF PORT B
CLRF PORTB ; TURN OFF PORT B 1us LATER !
BSF PORTA,2 ; TURN ON A2 ABOUT 4us AFTER YOU LAST TURNED IT OFF !
CALL TEMPO
BCF PORTA,2
; ; AGAIN JUST A 1 us GAP BETWEEN ON AND OFF
BSF PORTA,2
CALL TEMPO
BCF PORTA,2
BSF PORTA,2
CALL TEMPO
BCF PORTA,2
BSF PORTA,2
CALL TEMPO
BCF PORTA,2
BSF PORTA,3 ; NOW YOU TURN ON A3 BUT ONLY AFTER A2 HAS SWITCHED ON AND OFF 4 TIMES
CALL TEMPO
BCF PORTA,3
All those 1us gaps will be read by the 4017 but because its so fast you only see them on your display as jitter or garbage
Also ensure the Watchdog is turned off by using this line of code.
Code:
LIST P=16F84A
#INCLUDE<P16F84A.INC>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC