Created
July 22, 2016 07:07
-
-
Save 74hc595/88e3920a768ac3b883e33fd4a1955828 to your computer and use it in GitHub Desktop.
PIC10F200 blinking LED
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Blinks an LED connected to GP2 at roughly 15 Hz. | |
INCLUDE "p10f200.inc" | |
__CONFIG _WDTE_OFF & _CP_OFF & _MCLRE_OFF | |
ORG 0x0000 | |
MOVLW ~((1<<T0CS)|(1<<PSA)) ;enable GPIO2 and 1:256 Timer0 prescaler | |
OPTION | |
MOVLW ~(1<<TRISIO2) ;set GP2 as an output | |
TRIS GPIO | |
MOVLW 1<<GP2 | |
blink: | |
XORWF GPIO,F ;toggle GPIO bit | |
CLRF TMR0 | |
delay: | |
BTFSS TMR0,7 ;wait until TMR0 reaches 128 | |
GOTO delay | |
GOTO blink ;loop back | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One cycle can be saved if GP1 is used instead of GP2. W will contain the value 2, which can then be used to replace
GOTO delay
withSUBWF PCL,F
to back up to the previous instruction. (DECF PCL,F
produces an infinite loop.)