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.

manipulating assembler variables from within C code



I want to manipulate the variable array values in assembler code from within Main.c.  The way the assembler code is written, the variable is not a pointer, and I would like not to change that. The variable contents are data values. My problem is that I have seen no examples of assembler variables accessible from Main that are not pointers. Does anyone know how to do this? 

  • Hi Dick,

    see TI-document spru514c.pdf section 7.4.2.1 this should answer your question

    Best regards

    Andreas

  • Hi,

    if Address is the first memory address where the array of type mytype is allocated then you can access the value stored in it using:

    *(mytype*)Address

    the Nth array element can be accessed incrementing the address location by N using the proper type cast to have the memory address incremented by the correct number of memory words

    *((mytype*)Address + N)

    or using the usual array notation

    ((mytype*)Address)[N]

    The memory address is to be used as a C pointer, this way the assembler variable doesn't need to be a pointer but, in anyway, you must know how to get the address where the values are stored to let the C code access them.

    Best regards