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

📄 getkey.asm

📁 ADUC842 C程序集,包括ADC,DAC,PLL,PWM,WDT等程序.
💻 ASM
字号:
;File: getkey.a51
;Author: Eckart Hartmann Date:17/10/2003
;Development progress: Urt834.df
;
;getkey=========Get a character from UART.
;C Function prototype: char _getkey(void);
;Description of Function: Gets a key from UART and flags if error.
;User interface: UART must be initialised with _UrtCfg() before calling
;		_getkey. 
;		Call _getkey.
;		_getkey waits for a character to arrive in the UART then
;		returns the character. _getkey sets bit 7 of cUrtVar
;		if a parity error is detected.
 ; Robustness: CD bits bits must be correct when communicating - variable
;		cUrtVar (bits 4 to 6) contains the required CD value.
;		Will hang if no character arrives.
;Side effects: Overwrites a, cy, p, r1, RI and TI. 
;
NAME	GETKEY
$NOMOD51
 $IC(..kei842.inc) ; Parameter passing registers for Keil .
 $IC(..kei842.dat) ; SFR definition for Keil .
;
extrn DATA (cUrtVar)
public	_getkey
;
?PR?_getkey?GETKEY   SEGMENT CODE
	RSEG  ?PR?_getkey?GETKEY
	USING	0
;
_getkey:
	JNB  	RI,_getkey	;while(!RI);
	MOV  	cP1l,SBUF	;r7 = SBUF;
	CLR  	RI		;RI = 0;	
	mov	r1,#cUrtVar	;if(noparity)
	mov	a,@r1
	anl	a,#0ch
	jb	ACC.3,getkQ4
	jnb	RB8,getkE	; if(!RB8) error();
	sjmp	getkR
getkQ4:	cjne	a,#12,getkQ8	;else if(parity=='e');
	mov	a,cP1l		; {
	mov	c,p		; c = p;
	sjmp	getkQp		; if(c!=RB8) error(); }
getkQ8:	mov	a,cP1l		;else
	mov	c,p		; {
	cpl	c		; c = !p;
getkQp:	jb	RB8,getk1	; if(c!=RB8)
	cpl	c
getk1:	jc	getkR
getkE:	mov	a,@r1		;  cUrtVar |= 0x80;
	orl	a,#80h
	mov	@r1,a
getkR:	ret			; }
;
;Function End==========================================================Function End
	END

⌨️ 快捷键说明

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