| Electronic Components Datasheet Search |
|
AN669 Datasheet(PDF) 3 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
AN669 Datasheet(HTML) 3 Page - Microchip Technology |
|
3 / 7 page ![]() © 1997 Microchip Technology Inc. DS00669A-page 3 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 B0 equ 0 B1 equ 1 B2 equ 2 B3 equ 3 B4 equ 4 B5 equ 5 B6 equ 6 B7 equ 7 MSB equ 7 LSB equ 0 . . etc. . AARGB7 equ 0x20 AARGB6 equ 0x21 AARGB5 equ 0x22 AARGB4 equ 0x23 AARGB3 equ 0x24 AARGB2 equ 0x25 AARGB1 equ 0x26 AARGB0 equ 0x27 AARG equ 0x27 ; most significant ; byte of argument A 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. 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; // most significant byte of argument A 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; // least significant byte of argument A unsigned int AARG @ ACC; // most significant byte of argument A |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |