×
单片机 > 单片机程序设计 > 详情

pic10f200的一段玩具代码

发布时间:2024-06-17 发布时间:
|

title "PIC10F202 counting program"

list p=10f202

#include ;


__CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _IntRC_OSC


cpt1 equ 0x08

cpt2 equ 0x09

cpt3 equ 0x0A


org 00h ;reset vector

andlw 0xfe

movwf OSCCAL

clrf GPIO

movlw 0x0b

tris GPIO

movlw 0xc0

option


IncCount

call Delay1s

btfsc GPIO,2

goto next

bsf GPIO,2

goto IncCount

next

bcf GPIO,2

goto IncCount ;loop


;------------------------------------------------

Delay1ms ;2us for CALL

movlw 0xF9

movwf cpt1 ;2us

etiq2

nop ;loop=4us*(0xF9=249)=996us

decfsz cpt1,F

goto etiq2

retlw 0x00


;------------------------------------------------

Delay1s

movlw 0x0A

movwf cpt3

etiq4

movlw 0x64

movwf cpt2

etiq3

call Delay1ms

decfsz cpt2,F

goto etiq3

decfsz cpt3,F

goto etiq4

retlw 0x00


end


『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
AVR M16实验之六 DS18B20测温