Professional Documents
Culture Documents
File11 Real Delays To Be Applied On Circuit
File11 Real Delays To Be Applied On Circuit
File11 Real Delays To Be Applied On Circuit
They are repeated N times till the total time runs out.
N = Reg3*Reg2*Reg1
( To define reg1 , reg2, reg3 as the variables of the counter in the EQU section)
DELAY1S
MOVLW D'5'
MOVWF REG3
MOVLW D'255'
MOVWF REG2
MOVLW D'255'
MOVWF REG1
DECFSZ REG1,F ; 1 microseconds
GOTO $-1 ; 2 microseconds
DECFSZ REG2,F
GOTO $-5
DECFSZ REG3,F
GOTO $-9
RETURN
Microlab File11 – by Joseph Massoud
DELAY2S
MOVLW D'10'
MOVWF REG3
MOVLW D'255'
MOVWF REG2
MOVLW D'255'
MOVWF REG1
DECFSZ REG1,F
GOTO $-1
DECFSZ REG2,F
GOTO $-5
DECFSZ REG3,F
GOTO $-9
RETURN
DELAY500MS
MOVLW D'5'
MOVWF REG3
MOVLW D'127'
MOVWF REG2
MOVLW D'255'
MOVWF REG1
DECFSZ REG1,F
GOTO $-1
DECFSZ REG2,F
GOTO $-5
DECFSZ REG3,F
GOTO $-9
RETURN
Microlab File11 – by Joseph Massoud
Repeat lab91 by applying them on the circuit using different length of delays as follow:
1. Lab111 : 1 second
2. Lab112 : 5 seconds
1. Write a program lab117 which creates a square wave on output D0 of the pic
having a frequency of 1 KHz. ( If this signal variations cant be recognized on the
led, we will be reading it later on output pin D0 using an oscilloscope in the lab).
2. Write a program lab118 which creates a rectangular wave on output D0 of the pic
having a frequency of 500 Hz and a duty cycle of 80%. ( If this signal variations
cant be recognized on the led, we will be reading it later on output pin D0 using
an oscilloscope in the lab).
GOOD LUCK