This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Question about sbit definitions

Hi,

I am using the Keil uVision 2 software to develop a firmware driver. I have one technical related to the sbit definitions.

Lets say i have couple of sbit definitions as follows:

sbit JTAG_TDO = 0xB0+0;
sbit ALT_JTAG_TDO = 0x80+0;

In the course of program execution, based on some condition I want JTAG_TDO point to the ALT_JTAG_TDO pin so that whatever i write to JTAG_TDO gets written to ALT_JTAG_TDO at the port address 0x80+0 instead of the original 0xB0+0.

I tried doing &JTAG_TDO = &ALT_JTAG_TDO and that raised a compiled error.

Please let me know how to dynamically change the port pin addressing?

Parents
  • suresh,

    He's asking if the microcontroller is installed in a socket. What he's wondering is if you plan to perform this upgrade by sending the customer a new chip with the new code on it for him to replace. Otherwise, he's wondering if there's some mechanism to just reprogram the FPGA in the same manner as the controller (JTAG, etc.).

    The long and short of it is this: People here are not trying to lead you astray. The ONLY ways to do what you're doing are:

    1.) Put an if() at EACH place where you'd access this pin and let that select which pin to toggle.

    2.) Reconfigure some programmable portion of your hardware.

    3.) Use accesses to the whole port and masking in one of two possible values to toggle the pin. (Like I believe erik mentioned above)

    There is no way to do what you want with the 8051. Your backwarsds compatibility requirement cannot be met by any other means than the above. If none of them is acceptable, then despite it being a requirement, you cannot do what you want.

Reply
  • suresh,

    He's asking if the microcontroller is installed in a socket. What he's wondering is if you plan to perform this upgrade by sending the customer a new chip with the new code on it for him to replace. Otherwise, he's wondering if there's some mechanism to just reprogram the FPGA in the same manner as the controller (JTAG, etc.).

    The long and short of it is this: People here are not trying to lead you astray. The ONLY ways to do what you're doing are:

    1.) Put an if() at EACH place where you'd access this pin and let that select which pin to toggle.

    2.) Reconfigure some programmable portion of your hardware.

    3.) Use accesses to the whole port and masking in one of two possible values to toggle the pin. (Like I believe erik mentioned above)

    There is no way to do what you want with the 8051. Your backwarsds compatibility requirement cannot be met by any other means than the above. If none of them is acceptable, then despite it being a requirement, you cannot do what you want.

Children