In the previous videos I've been explaining how to initialize the ports of the PIC16f628 microcontroller. This other video shows how to write a delay loop and blink some LEDs for fun. The code of the main loop and of the delay loop is listed below in case you want to copy-paste it: Check also funelectronicstoday.com for more fun projects.
;MAIN LOOP----------------
REPEAT
MOVLW 0X00
MOVWF PORTB
CALL DELAY
MOVLW 0X01
MOVWF PORTB
CALL DELAY
MOVLW 0X02
MOVWF PORTB
CALL DELAY
MOVLW 0X04
MOVWF PORTB
CALL DELAY
MOVLW 0X08
MOVWF PORTB
CALL DELAY
CLRF PORTB
CALL DELAY
GOTO REPEAT ; END OF MAIN LOOP
DELAY
CLRF DELAY1
CLRF DELAY2
DELAYLOOP
DECFSZ DELAY2,F
GOTO DELAYLOOP
DECFSZ DELAY1,F
GOTO DELAYLOOP
RETURN
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.