This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCSTUDIO: how to use asp("nop") with for function

Part Number: CCSTUDIO
Other Parts Discussed in Thread: UCD3138

Hi team,

here is a ccs code error that confuse me and want to get your help;

I want to achieve a delay as following description:

if any error in above description? it should be resonable under a C compilation environment.

Thanks

Best regards

Mia Ma

  • Hi Mia,

    What is the device which CCS is connected to?

  • Hi Bin,

    UCD3138 series.

    Thanks

    Best regard

    Mia 

  • Hi Bin,

    how about this case, if I use this description and my IC is UCD3138, any problem here?

    looking for you reply here.

    Thanks

    Best regards

    Mia Ma

  • Mia, you probably have 3 errors here:

    1.  The error message is because you need to define i as a temporary variable before you can use it.  You need to put the Uint32 i; on a line before the for statement, 

    2.  the asm statement feeds the info in the quotes to the assembler.  The assembler assumes that anything in the first character of the line is a label, not an instruction, so you are defining a label, not creating a nop.  you need a space after the quote like this: asm(" nop");

    3.  Normally we put in nops to provide a precise delay.  Each nop takes a single instruction cycle.  When you put a for loop around the nop, that probably takes at least 10 instruction cycle each time through the loop.  So if you want a precise delay, I suggest putting in a line of asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop"); and so on instead of using a loop.  
     

  • Hi Bower,

    Thanks for your reply.

    And here is an additional question related to CCS.

    what is the exactly error in above description? how to adjust it?

    Thanks

    Best regards

    Mia Ma

  • Mia, I don't think you gave me enough information.  Overall, that's a very strange set of expressions.  I'd want to see the rest of the code and the rest of the errors and warnings and what line each error or warning is attached to.  

    Also, what are you really trying to accomplish?  

  • Hi Bower,

    I think it's kind of complicated in this website page, maybe we could move to email.

    Thanks.

    Best regards

    Mia Ma