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?
"Also writing to both the pins could cause some side affect as those port pins are mapped to a different pin in the FPGA on that condition." Aha! So this is in an FGPA?! Surely, then, it is a simple matter to provide a "hardware" gate in the FPGA that will switch between JTAG_TDO and ALT_JTAG_TDO?!
The driver (common) I am developing will be used by both the hardware that is shipped already to the customers and in our next generation hardware. So it is mandatory to handle this in software without asking for any changes in the hardware for backward compatibility reasons.
So it is mandatory to handle this in software without asking for any changes in the hardware for backward compatibility reasons. yeah, yeah, have heard that one before - are you management? 1) you evidently must reprogram the uC, what hinders a reprogram of the FPGA. 2) whatever "is mandatory to handle" you cant' make the '51 grow new instructions. 3) you never answered "may not fit in the internal RAM" --- "RAM??? what are you talking about, in a '51 the code is in ROM/PROM?Flash." Erik
Sorry, that was a typo'. It is Internal RAM and not ROM.
now you absolutotally lose me. You post "RAM" I ask "did you mean ROM" You post "Sorry, that was a typo'. It is Internal RAM and not ROM." To stop all confusion, please post "My code is in ROM" or "My code is in RAM" and a followup question Is the uC socketed? Erik
also, how about answering 1)
OOPS. My code is in ROM. I dont understand your question "Is the uC socketed?"
Ok, is the uC (microcontroller) socketed (in a socket or soldered to the board). Erik
Soldered to the board. Thanks
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.
Ok, I achieved what i wanted by passing the pins as parameters to the same function based on an IF condition. Example: Pulse_TCK(bit sbJTAG_TCK); //Definition I am calling the above function as follows: if (old_board) { Pulse_TCK(JTAG_TDO); } else { Pulse_TCK(ALT_JTAG_TDO); } Thanks for all your inputs.
after umpteen posts complaining about the time it takes and whatnot, you choose what was suggested in the very first answer. Erik