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

how to display the contents of sfrs of 8051 microcontroller & update it

hai,
I want to know how the contents of sfrs
can be displayed & updated by the user.
My project is bootloader.I am using 8051 microcontroller ,frontend is VC++, backend is C.Compiled using KEIL compiler.
Can anyone help me with the code

Thank you,
Sadhana

  • In a classic 8051, that's very tricky to do. To access a generic SFR by number, you have to either write self-modifying code, i.e. have some external memory that is wired in a von-Neumann mode, or you have to prepare 128 individual "read-SFR-<n>" and 128 "write-SFR-<n>" routines and select one of those via a jump table --- which may already be more code than fits in the device.

    A better answer may be: don't do that. Modifying SFRs interactively, in a running system, is extremely risky --- you may easily lose control over the device completely.