list p=12F683 ; list directive to define processor
#include <p12F683.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _FCMEN_OFF & _IESO_OFF & _CP_OFF & _CPD_OFF & _BOD_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_OFF & _INTRC_OSC_NOCLKOUT
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings
Cblock 0x20
d1
d2
endc
#define Data GPIO,0
#define Clock GPIO,1
org 0x0000 ; org sets the origin, 0x0000
goto Start ; go to beginning of program
org 0x0004 ;interrupt vector
goto Start
Start
movlw 07h ; Set GPIO <2:0) to
movwf CMCON0 ; digital I/O
clrf ANSEL ; digital I/O
movlw b'1110101'
movwf OSCCON ;8MHz internal oscillator
banksel TRISIO
movlw b'00000000'
movwf TRISIO
banksel GPIO
clrf GPIO
goto main
main:
banksel GPIO
movlw b'00000001'
movwf GPIO
call Delay
movlw b'00000010'
movwf GPIO
call Delay
goto main
Delay
;1993 cycles
movlw 0x8E
movwf d1
movlw 0x02
movwf d2
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_0
;3 cycles
goto $+1
nop
;4 cycles (including call)
return
end