arv09
Newbie level 3
I have been coding in Assembly for a couple of months now. I started with 8051 and I am now using a Microcontroller (Nuvoton) which is an 8051 derivative.
For debug purposes, I want to view the SFR values at runtime. I have 4 seven segment for my application. I can view the 256 bytes of RAM with the below code in the 7 segment displays
regloc is a register location in RAM. When pressing a key, this regloc is made to scroll from 0 to 255. So depending on the value at regloc, the corresponding value from the internal 256 bytes of RAM is displayed. 2 of the 7-segment digits display the regloc in Hexa (00 to FF) and the other 2 7-segment displays the RAM value at that regloc location.
Similarly, I want to view the SFR's too. The Nuvoton Microcontroller (N79E855) that I'm using currently has more number of SFR's than 8051.
To view these, when I use similar logic and tried following code
MOV R0,regloc
MOV A,R0
What this does is, it loads to accumulator the value at regloc and not the SFR. I can understand that what I'm doing is loading the accumulator with the value at regloc address.
MOV A,PSW
(OR)
MOV A,D0h
While the above two lines would load into ACC, the value at PSW, I'd like to know if I can read the SFR's sequentially like reading the RAM. I hope this is all clear and someone can let me know if this can be done or the only way is direct addressing method
For debug purposes, I want to view the SFR values at runtime. I have 4 seven segment for my application. I can view the 256 bytes of RAM with the below code in the 7 segment displays
Code:
MOV R0,regloc
MOV A,@R0
regloc is a register location in RAM. When pressing a key, this regloc is made to scroll from 0 to 255. So depending on the value at regloc, the corresponding value from the internal 256 bytes of RAM is displayed. 2 of the 7-segment digits display the regloc in Hexa (00 to FF) and the other 2 7-segment displays the RAM value at that regloc location.
Similarly, I want to view the SFR's too. The Nuvoton Microcontroller (N79E855) that I'm using currently has more number of SFR's than 8051.
To view these, when I use similar logic and tried following code
MOV R0,regloc
MOV A,R0
What this does is, it loads to accumulator the value at regloc and not the SFR. I can understand that what I'm doing is loading the accumulator with the value at regloc address.
MOV A,PSW
(OR)
MOV A,D0h
While the above two lines would load into ACC, the value at PSW, I'd like to know if I can read the SFR's sequentially like reading the RAM. I hope this is all clear and someone can let me know if this can be done or the only way is direct addressing method