This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

adding assembly code in C function

hello
i have written code in following way
void fonction1(void)
{ TMOD = (TMOD | 0x20); SCON0 = 0x50; asm { MOV SCON1,#40h } SCON1 = 0x40;
}

at the time of Build target it is showing error " 'asm' is undefined symbol"
like this in other functions also i want to add assembly code in c function . so how can i resolve this problem .
pls help me some body .
thank for time

Parents
  • There is absolutely no reason whatsoever to use inline assembler for this!

    Just write it in 'C'!

    The trouble with most attempts to use inline assembler is that they rely upon some basic misconception.
    In most cases, it would be far better to just create an assembler function, and call that from 'C'.

    You need to be thoroughly familiar with how the compiler works before you go dropping arbitrary snippets of assembler into your 'C' code - as it is, you haven't even looked for the correct syntax in the compiler manual!

    You also haven't read the instructions on how to post source code - they are really quite clearly stated:
    www.danlhenry.com/.../keil_code.png

Reply
  • There is absolutely no reason whatsoever to use inline assembler for this!

    Just write it in 'C'!

    The trouble with most attempts to use inline assembler is that they rely upon some basic misconception.
    In most cases, it would be far better to just create an assembler function, and call that from 'C'.

    You need to be thoroughly familiar with how the compiler works before you go dropping arbitrary snippets of assembler into your 'C' code - as it is, you haven't even looked for the correct syntax in the compiler manual!

    You also haven't read the instructions on how to post source code - they are really quite clearly stated:
    www.danlhenry.com/.../keil_code.png

Children
No data