pic10f200的一段玩具代码
2020-03-29 来源:eefocus
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