⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example.asm

📁 MicroChip的12BIt和14Bit的PIC系列单片机的汇编器
💻 ASM
字号:
;; example.asm -- a simple LED flasher;;; example source code for picasm by Timo Rossi;;; define PIC device type;	device	pic16c84;; define config fuses;	config	CP=off,WDT=off,PWRT=off,OSC=hs;; include PIC register definitions, and some macros;	include "pic16c84.h"	include "picmac.h";; bit definitions for two LEDs connected to port A bits 0 and 1; bit masks can be computed from bit numbers with the left shift operator.;A_LED1	equ	0A_LED2	equ	1;; define some register file variables;	org	0x0cdelay_cnt1	ds	1delay_cnt2	ds	1;; code start;	org	0	movlw	0xff	movwf	PORTA	;initialize port A so that LEDs are off	bsf	STATUS,RP0			;register page 1	movlw	~((1<<A_LED1)|(1<<A_LED2))	;LEDs as outputs,	movwf	TRISA				;other PORTA pins as inputs	bcf	STATUS,RP0			;register page 0main_loop	movlw	1<<A_LED1	xorwf	PORTA,F		;toggle led1	clrw			;maximum delay length (256 counts)	call	delay	clrw			;maximum delay length (256 counts)	call	delay	movlw	(1<<A_LED1)|(1<<A_LED2)	xorwf	PORTA,F		;toggle both leds	clrw			;maximum delay length (256 counts)	call	delay	goto	main_loop;; delay subroutine; input: delay count in W;; inner loop duration approx:; 5*256+3 = 1283 cycles ->; 1.28ms with 4MHz crystal (1MHz instruction time);delay	movwf	delay_cnt1	clrf	delay_cnt2delay_a	nop	nop	incfsz	delay_cnt2,F	goto	delay_a	decfsz	delay_cnt1,F	goto	delay_a	return	end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -