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

📄 button.asm

📁 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without ev
💻 ASM
字号:
;+---------------------------------------------------------------------------+;|                                                                           |;| Copyright (C) 2002,  Tom De Rybel                                         |;|                      on1dcd@hotmail.com                                   |;|                                                                           |;| This program is free software; you can redistribute it and/or             |;| modify it under the terms of the GNU General Public License               |;| as published by the Free Software Foundation; either version 2            |;| of the License, or any later version.                                     |;|                                                                           |;| This program is distributed in the hope that it will be useful,           |;| but WITHOUT ANY WARRANTY; without even the implied warranty of            |;| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |;| GNU General Public License for more details.                              |;|                                                                           |;| You should have received a copy of the GNU General Public License         |;| along with this program; if not, write to the Free Software               |;| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 |;|                                                                           |;|                                                                           |;+---------------------------------------------------------------------------+; Second test of the Cypress EZ-USB; Makes a LED connected to PB4 follow the state of a button connected to PB5.;;+-------------------------------------+;| Declaration of the EZ-USB registers |;+-------------------------------------+.equ DPL1,	0x84.equ DPH1,	0x85.equ DPS,	0x86.equ CKCON,	0x8E.equ SPC_FNC,	0x8F.equ EXIF,	0x91.equ MPAGE,	0x92.equ SCON1,	0xC0.equ SBUF1,	0xC1.equ EICON,	0xD8.equ EIE,	0xE8.equ EIP,	0xF8		.equ CPUCS,     0x7F92	.equ PORTACFG, 	0x7F93.equ PORTBCFG, 	0x7F94.equ PORTCCFG, 	0x7F95.equ OUTA,     	0x7F96	.equ OUTB,     	0x7F97.equ OUTC,     	0x7F98.equ PINSA,    	0x7F99.equ PINSB,    	0x7F9A.equ PINSC,    	0x7F9B.equ OEA,      	0x7F9C.equ OEB,      	0x7F9D.equ OEC,      	0x7F9E;+-------------------+;| Interrupt vectors |;+-------------------+;;Reset Vector.org 0x0000ljmp init.org 0x0100;+-------------------------+;| Initialisation sequence |;+-------------------------+    init:	;;mov	0x92, #0x7F	; tc, allows movx Ri to access ez-usb memory	mov dptr, #PORTBCFG	; All pins are standard PB pins	mov a, #00000000b	movx @dptr, a		mov dptr, #OEB		; Pin PB4 is an output pin	mov a, #00010000b	movx @dptr, a;+--------------+;| Main program |;+--------------+		begin:			mov dptr, #PINSB	; Read PB contents	movx a, @dptr		; and move into accu	mov r1, #00100000b	; Define bitmask for a propper bit status extraction	anl a, r1		; AND accu with bitmask in r1	rr a			; Shift PB5 result into PB4 position	mov dptr, #OUTB 	; Write result into PB register for output	movx @dptr, a	ljmp begin		; Repeat at infinitum

⌨️ 快捷键说明

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