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.

CCS/CCSTUDIO: Write-only instruction

Part Number: CCSTUDIO


Tool/software: Code Composer Studio

Hi 

Does any body know why should we use write-only instruction? when we have to use them? and what's gonna happen if we do not take care about that?

thanks

  • Hi Arash,
    I'm not quite familiar with what you are referring to (and how this related to CCS). Can you provide some more details?

    Thanks
    ki
  • This is part of Example_2802xCpuTimer project example,

    // To ensure precise timing, use write-only instructions to write to the entire
    // register. Therefore, if any of the configuration bits are changed in
    // ConfigCpuTimer and InitCpuTimers (in f2802x_CpuTimers.h), the
    // below settings must also be updated.

    CpuTimer0Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0
    CpuTimer1Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0
    CpuTimer2Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0

    in this example I came across write-only instruction
  • I move this thread to the C2000 forum. The experts there can answer best.

    Thanks
    ki
  • Hi Arash,

    There are two ways to update the register bit settings.
    1) Write to individual bits using .bit operation (e.g. CpuTimer0Regs.TCR.bit.TSS = 1). This will be read modified write operation.
    2) Write to full register using .all operation (like in example). In this case single write is performed to update full register hence all the all bits in the register get updated same time.

    In this case recommendation is to write full register in one shot (reason is giving in the comment) instead of updating individual bits one by one.

    Regards,

    Vivek Singh
  • in this example it says "To ensure precise timing" we need to write full register not bit by bit, my question is how does this kind of writing ensure precise timing? what is wrong with bit by bit writing?
  • thanks Vivek for reply
    But you are telling me what write-only is!!! I know what write-only is, what I don't know is: why should we use it?
  • This initializes all the bits in control register at same time so that TIMER start from clean state.