NOP Vs _nop_()?

In one of my project I am talking with MX909 Driver IC with C51 ucontroller. To initialize MX909 if I write module in Assembly language it's working fine. Once I replaced with C same module it's not working.

The only difference I can make for both assembly and C languages is NOP and _nop_() instruction. Is both instructions will take same number of machine cycles?

Thanks,
Suresh Kumar Kavula

Parents
  • Once I replaced with C same module
    why on earth did you do that?

    The only difference I can make for both assembly and C languages is NOP and _nop_() instruction. Is both instructions will take same number of machine cycles?

    If you had taken one second to look at the generated assembly you would have found that they are identical.

    My guess is that you suffer from some fallacy that e.g. a for loop is the same as a djnz loop and nothing could be farther from the truth.

    If you, for some silly reason, have to "replace with C" have a look at the assembler code generated by the compiler and you will find your answer.

    Erik

Reply
  • Once I replaced with C same module
    why on earth did you do that?

    The only difference I can make for both assembly and C languages is NOP and _nop_() instruction. Is both instructions will take same number of machine cycles?

    If you had taken one second to look at the generated assembly you would have found that they are identical.

    My guess is that you suffer from some fallacy that e.g. a for loop is the same as a djnz loop and nothing could be farther from the truth.

    If you, for some silly reason, have to "replace with C" have a look at the assembler code generated by the compiler and you will find your answer.

    Erik

Children
More questions in this forum