Solution: Keil c51 PSOC3 __asm documentation error and solution.

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

cross mob
WaMa_286156
Level 5
Level 5
First comment on blog 100 replies posted 50 replies posted

I am trying to create a multi-line assembly #define.

The keil documentation says __asm { push ACC } is the format.  That is a lie.  If you do that, the result is:

 

 

                       2520              { push ACC; };
*** _____________________________________^
*** ERROR #A9 IN 2520 (Z:\drop-folder\Dropbox\4g\Cypress\Projects\Depth\DepthRTOS_PSOC3-Brd6V0\Source\tasks.src, LINE 25
                               20): SYNTAX ERROR

 

 

-----------

The correct format is

__asm push ACC  

  That produces the correct result.

In order to generate a #define that creates several lines of assembly code for 8051, you must use this format

__asm push ACC \n push IE \n CLR EA \n

The __asm caused the assembly to be generated.  *Important:* to get *each* of the lines of assembly out, you must follow each assembly instruction with a \n.  During my testing, I left the \n off of the CLR EA, and it did not get emitted. 

 

1 Solution
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @WaMa_286156 ,

Thank you for sharing this useful information with the Infineon Community.

Please continue to use our products and contact us through the community regarding any queries you have on our products or information you would like to share.

View solution in original post

0 Likes
1 Reply