include <p16f874A.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _BOREN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF
Status EQU 03h
TRISB EQU 86h
PORTB EQU 06h
LED EQU 0x05
CBLOCK 0x20
; Variables used in delay routine
Kount100us
Kount1ms
Kount100ms
ENDC
org 0x0000 ; processor reset vector
goto start
org 0x04 ; go to beginning of program
start:
bsf status,rp0
bcf TRISB,LED
bcf status,rp0
;CLRF PORTB ; switch to bank1
loop:
bsf PORTB,LED
call delay100ms ;TURN the muscle on by first putting it into
bcf PORTB,LED
call delay100ms
bsf PORTB,LED
goto loop
delay100us:
movlw 0xA5
movwf Kount100us
R100us
decfsz Kount100us,1
goto R100us
retlw 00
delay1ms:
movlw 0x0A
movwf Kount1ms
R1ms
call delay100us
decfsz Kount1ms,1
goto R1ms
retlw 00
delay100ms:
movlw 0x64
movwf Kount100ms
R100ms
call delay1ms
decfsz Kount100ms,1
goto R100ms
retlw 00
END