Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Writing in Assembly for a PSoC® 3 Project in PSoC Creator™ - KBA203624

Writing in Assembly for a PSoC® 3 Project in PSoC Creator™ - KBA203624

Anonymous
Not applicable

Version: **

Translation - Japanese:

Question:

How do I write assembly code in a C source file for PSoC 3 projects in PSoC Creator?

Answer:

There are two options to write assembly code in PSoC Creator:

Option 1: Create a separate assembly source file

  1. Right-click on the project name in Project Explorer and select Add new item.
  2. Select "8051 Keil Assembly File" and provide a name for the file. This creates an assembly source file with a .a51 extension in the Source Files folder in the project.
  3. Add assembly code to this file with the standard 8051 instruction set.
     
      See the Ax51 Assembler User Guide for help on instructions, template, etc. from Help > Documentation > Keil.
     
      Note: With this choice, it is not necessary to enable the inline assembly option in the Option 2.

Option 2: Inline Assembly in a C source file

  1. In the C source file, put the assembly code between the directive “#pragma asm” and “#pragma endasm”.
  2. In Project Explorer, right-click on the source file that has the inline assembly, and select Build Settings.
  3. Select the Compiler option and set the value for the Inline Assembly parameter to True.
     
      Now, the compiler will process the inline assembly code during compilation
0 Likes
446 Views
Contributors