datasheetbank_Logo
전자부품 반도체 검색엔진( 무료 PDF 다운로드 ) - 데이터시트뱅크

AN669 데이터 시트보기 (PDF) - Microchip Technology

부품명
상세내역
일치하는 목록
AN669 Datasheet PDF : 7 Pages
1 2 3 4 5 6 7
AN669
Assembly Language Variables, Include Files,
etc.
For the floating point math routines of AN575, there is
one include file which contains important constant and
register declarations: math16.inc. This file of declara-
tions is rather extensive, however, it is straightforward
to convert it to C. Example 4 shows a segment of the
math16.inc requiring some attention for the conver-
sion.
EXAMPLE 4: MATH16.INC EXCERPT
FROM AN575. ASSEMBLY
LANGUAGE FILE
These Constant and Variable Declarations
Need to be Converted to C Language
Declarations
Example 5 shows the equivalent C constant and vari-
able declarations. The equates in assembly language
create constants. The equivalent C language is a
#define. Moreover, variables are declared in assem-
bly language by equating a variable name to a register
RAM location (i.e. AARGB7 equ 0x20). In C the vari-
ables are declared by assigning a type to the variable.
In the listing in Example 5, AARGB7 is declared as an
unsigned integer data type.
B0
equ
B1
equ
B2
equ
B3
equ
B4
equ
B5
equ
B6
equ
B7
equ
MSB
equ
LSB
equ
.
. etc.
.
AARGB7 equ
AARGB6 equ
AARGB5 equ
AARGB4 equ
AARGB3 equ
AARGB2 equ
AARGB1 equ
AARGB0 equ
AARG equ
0
1
2
3
4
5
6
7
7
0
0x20
0x21
0x22
0x23
0x24
0x25
0x26
0x27
0x27
; most significant
; byte of argument A
EXAMPLE 5: THE CONVERTED MATH16C.C FILE. C LANGUAGE FILE
#define B0
0
#define B1
1
#define B2
2
#define B3
3
#define B4
4
#define B5
5
#define B6
6
#define B7
7
#define MSB 7
#define LSB 0
.
. etc.
.
unsigned int AARGB0 @ ACCB0;
unsigned int AARGB1 @ ACCB1;
unsigned int AARGB2 @ ACCB2;
unsigned int AARGB3 @ ACCB3;
unsigned int AARGB4 @ ACCB4;
unsigned int AARGB5 @ ACCB5;
unsigned int AARGB6 @ ACCB6;
unsigned int AARGB7 @ ACCB7;
unsigned int AARG @ ACC;
// most significant byte of argument A
// least significant byte of argument A
// most significant byte of argument A
© 1997 Microchip Technology Inc.
DS00669A-page 3

Share Link: 

datasheetbank.com [ Privacy Policy ] [ Request Datasheet ] [ Contact Us ]