pic10f200 流水灯
;
list p=10F200 ; list directive to define processor
#include ; processor specific variable definitions
__CONFIG _MCLRE_OFF & _CP_ON & _WDT_OFF
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
; Const definition
PIN_R EQU 2
PIN_G EQU 1
PIN_B EQU 0
PIN_DATA EQU 3
DEV_ID EQU 0x2 | 0x80
BIT_CNT EQU 0x08
;***** VARIABLE DEFINITIONS
rCnt EQU 0x11 ; red LED value
gCnt EQU 0x12 ; green LED value
bCnt EQU 0x13 ; blue LED value
;tick EQU 0x13 ; system tick
tick EQU TMR0
IOTemp EQU 0x16
recvTemp EQU 0x17
devID EQU 0x19
bitsCnt EQU 0x1A
;dataPort EQU 0x1D
dataPort EQU GPIO
UpdateLED macro ledCnt,des
;movf tick,w
;subwf ledCnt,w
movf ledCnt,w
subwf tick,w
rlf IOTemp,des
endm
; if we use 38400 @ 4MHz 26 cycle per data
;**********************************************************************
ORG 0xFF ; processor reset vector
movlw 0
; Internal RC calibration value is placed at location 0xFF by Microchip
; as a movlw k, where the k is a literal value.
ORG 0x000 ; coding begins here
movwf OSCCAL ; update register with factory cal value
movlw DEV_ID ;DEV_ID=0X82 送给W
movwf devID ;w 送给devid=0x82
movwf