utilities.a51

来自「msc1200是工程评估板MCU的原代码四个差分输入」· A51 代码 · 共 63 行

A51
63
字号
;*********************************************************************
; File name: utilities.a51
;
; Copyright 2003 Texas Instruments Inc as an unpublished work. 
; All Rights Reserved.
;
; Revision History
;	Version 1.0
;
; Assembler Version  (Keil V2.38), (Raisonance V6.10.13)
;
; Module Description:
; ADC routines to read 24-bit ADC and return the value as a long integer.

;*********************************************************************
$include (legal.a51) ; Texas Instruments, Inc. copyright and liability
$include (reg1210.inc)

;*********************************************************************
PUBLIC	unipolar, bipolar

adc_sub SEGMENT  CODE
	RSEG  adc_sub

;;;;;;;;;;;;;;;;;;;;;
; unsigned long unipolar(void)
; return the 3 byte adres to R4567 (MSB~LSB)
; unsigned long int with R4=0
unipolar:
	mov	r4,#0
	mov	r5,adresh
	mov	r6,adresm
	mov	r7,adresl
	ret

;;;;;;;;;;;;;;;;;;;;;
; signed long bipolar(void)
; return the 3 byte adres to R4567 (MSB~LSB)
; return signed long int with sign extendsion on R4
bipolar:
	mov	r4,#0
	mov	a,adresh
	mov	r5,a
	mov	r6,adresm
	mov	r7,adresl
	jnb	acc.7,positive
	mov	r4,#0ffh
positive:
	ret

;;;;;;;;;;;;;;;;;;;;;
; signed long read_sum_regs(void)
; return the 4 byte sumr to R4567 (MSB~LSB)
; return signed long int, sign extension done by hardware
read_sum_regs:
	mov	r4, SUMR3;
	mov	r5, SUMR2;
	mov	r6, SUMR1;
	mov r7, SUMR0;
	ret
	
	end

⌨️ 快捷键说明

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