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/TMS320F28027: how to determine which CPU register to be used?

Part Number: TMS320F28027

Tool/software: Code Composer Studio

Hi, I wrote a C code to test in F28027, and after loading the program to the board, I observe the disassembly code like below:

CpuTimer0.InterruptCount++;// code I write

/*****assembly code generated by compiler****/
3f44b2: 0201 MOVB ACC, #1
3f44b3: 761F0018 MOVW DP, #0x18
3f44b5: 56010012 ADDL @0x12, ACC

I can understand the code: load value 1 to register ACC, move DP to 0x18, add ACC to the address @0x12 at the data page 0x18.

My question is:

1. why ACC register is used to store the value 1. Can I use a different register for example XARn to store the value 1? Is it determined by the compiler?

2. Can I have a different way to achieve CpuTimer0.InterruptCount++?

For example, I load the value @0x12 at the data page 0x18 to XARn, and then add XARn by 1, and then return XARn to the memory @0x12 at the data page 0x18.

  • Howard Zou said:
    2. Can I have a different way to achieve CpuTimer0.InterruptCount++?

    I'm sure there are different ways to compute it.  Though I don't know C28x assembly instructions well enough to give you specifics.  

    Howard Zou said:
    For example, I load the value @0x12 at the data page 0x18 to XARn, and then add XARn by 1, and then return XARn to the memory @0x12 at the data page 0x18.

    That is one way to go.  However, this sequence has two instructions which access memory.  The previous sequence has one instruction which accesses memory.  

    Thanks and regards,

    -George