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

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐