aljabar
Newbie level 3
- Joined
- Nov 14, 2012
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,296
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
; progam to flash all of PortB pins on and off every 4 seconds, using a 4mhz crystal
; (2 second flash with 8mhz crystal)
list p=16f877a
include p16f877a.inc
__CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON & _LVP_OFF
cblock 0X20 ; specify user regiaters
d1
d2
d3
COUNT
endc
org 0x000
GOTO Main
Main CLRF PORTB ; Set portb,c,d to digital outputs
CLRF PORTC
CLRF PORTD
BANKSEL TRISA
CLRF TRISB
CLRF TRISC
CLRF TRISD
BANKSEL 0
LOOP ; main program looP
CALL DELAY4s ; call this subrutine
MOVLW 0xFF
MOVWF PORTB ; Set port HIGH
CALL DELAY4s
MOVLW 0x00
MOVWF PORTB ; Set port LOW
GOTO LOOP
; SUBROUTINES
DELAY4s ; 4 SECOND DELAY
movlw 0x23
movwf d1
movlw 0xB9
movwf d2
movlw 0x09
movwf d3
Delay_0
decfsz d1, f
goto dly1
decfsz d2, f
dly1 goto dly2
decfsz d3, f
dly2 goto Delay_0
return