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: Changing constant value while run time.

Other Parts Discussed in Thread: TM4C123GH6PM

Tool/software: Code Composer Studio

Is it possible to change the constant value in debug mode (or run time)? if yes, how ?

I am working on communication project in which there are 5 node (TM4C123GH6PM) having a constant address assigned to each one of them and if one node send command to other node to change the address the constant value gets override to a new address.

Example - MCUx (Address 3) to MCUy (Address 4) - "change address"

MCUy changes the address to some other value - Address 7 becomes the new address of MCUy.

  • bhavuk lalwani said:
    I am working on communication project in which there are 5 node (TM4C123GH6PM) having a constant address assigned to each one of them and if one node send command to other node to change the address the constant value gets override to a new address.

    If you have a command to change the address, then the address shouldn't be a constant, should it?

    Robert

    Although, the fact you have a command to change address via communications makes me queasy.

  • If you (actually implement such) and are even a (bit) disorganized/attention deficient (i.e. like moi) - you have provided the "hearse for your own funeral."       How ever will you "keep track" of "who's who" - when such updates may (or really do) occur? 

    And - as poster Robert (hints) - cannot that change occur due to "unanticipated and/or unexpected" consequences?      (for example: You seek to change ("Node 3" to "Node 4") - yet for (any) reason - the change fails.       What then?

    A very accurate (paper or silicon) "trail" is required - and too often such is neglected, lost, or incorrectly logged.         What then?

  • Let's put it this way, this academic project requires me to assign constant addresses to each and every node connected to me (Master). I need to change the constant address while the code is in debugging mode if it finds the condition of valid command sent to be true.
  • How to read and write to EEPROM memory in CCS?
    I am new to micro-controllers and exploring hence apologies if it seems silly.
  • bhavuk lalwani said:
    How to read and write to EEPROM memory in CCS?

    I haven't tried it myself, but there is an example CCS GEL file in EEPROM write via CCS which might be suitable.

  • bhavuk lalwani said:
    Let's put it this way, this academic project requires me to assign constant addresses to each and every node connected to me (Master).

    Ah, I think maybe you mean a network address/Node ID, not change the address a command reads/writes a block of memory in the micro? That's a little less unnerving. You should take a look at what LONWorks and TCP/IP do when faced with similar dilemmas.

     

    bhavuk lalwani said:
    I need to change the constant address while

    Actually, I think the first thing you need to do is to stop thinking of it as a constant. Rather as a configurable value or possibly the more descriptive persistent variable.

    Second would be to determine under what circumstances a change is allowed and third will be to determine the possible failures and how to cope with them (including the initial condition).

    Robert

  • If I refer to the cmd file .const values are stored in Flash section of memory because of this reason I was referring to a constant value.

    The change is allowed only if the intermediate nodes gets the command and picks the available addresses to pick after polling is done through master node. Possible failure is also handled in this code which can be same address assigned to 2 nodes.

    To be more specific, I need some help in reading a memory block from EEPROM where the source address was defined initially as "# define source_address 10" and if the command is received this configurable value gets written to other available value.
  • bhavuk lalwani said:
    If I refer to the cmd file .const values are stored in Flash section of memory

    Which is why you need to stop thing of it as a const. So you can stop implementing it as a const.

    Robert