Using Embedded Assembly
Using Embedded Assembly
Embedding Assembly in C
Embedding Assembly in C
Allows direct access to assembly language from C
Allows direct access to assembly language from C
Useful for operating on components not used by C, ex:
Useful for operating on components not used by C, ex:
asm ( “ CLRC INTM ; enable global interrupt” );
asm ( “ CLRC INTM ; enable global interrupt” );
Note: first column after leading quote is
Note: first column after leading quote is
label
label
field
field
-
-
if no label,
if no label,
should be blank space.
should be blank space.
Avoid modifying registers used by C
Avoid modifying registers used by C
Lengthy code should be written in ASM and called from C
Lengthy code should be written in ASM and called from C
main C file retains portability
main C file retains portability
yields more easily maintained structures
yields more easily maintained structures
eliminates risk of interfering with registers in use by C
eliminates risk of interfering with registers in use by C
#define EINT
#define EINT
asm
asm
( “ CLRC INTM”)
( “ CLRC INTM”)
The assembly function allows for C files to contain 28x assembly code. Care should be taken not
to modify registers in use by C, and to consider the label field with the assembly function. Also,
any significant amounts of assembly code should be written in an assembly file and called from
C.
There are two examples in this slide – the first one shows how to embed a single assembly
language instruction into the C code flow. The second example shows how to define a C term that
will invoke the assembly language instruction.
C28x – C Programming
D - 7
Содержание C28 Series
Страница 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Страница 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Страница 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Страница 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Страница 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Страница 275: ...Appendix eZdsp F2812 eZdsp F2812 Connector Header and Pin Diagram C28x Appendix A eZdsp F2812 A 3 ...
Страница 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Страница 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Страница 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Страница 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Страница 281: ...Appendix JP7 JP8 JP11 JP12 Boot Mode Select JP9 PLL Disable DS1 DS2 LEDs C28x Appendix A eZdsp F2812 A 9 ...
Страница 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...