Debugging/Monitoring symbols

Quote from Rio on March 5, 2025, 9:49 amIt's easy to watch/monitor symbolic constant (e.g. temp EQU 0x20), but I can't watch the state of PORTA, B, C with MCU monitor (address 0x5-0x7 for PIC16F). it stays at the value 0 while debugging the steps. Is that normal? For comparison, I have assigned both memory locations (temp and PORTC) with a simple value.
Caution I am a beginner in the subject.
It's easy to watch/monitor symbolic constant (e.g. temp EQU 0x20), but I can't watch the state of PORTA, B, C with MCU monitor (address 0x5-0x7 for PIC16F). it stays at the value 0 while debugging the steps. Is that normal? For comparison, I have assigned both memory locations (temp and PORTC) with a simple value.
Caution I am a beginner in the subject.

Quote from arcachofo on March 6, 2025, 1:52 pmYou should be able to watch registers.
If you want, zip the circuit and code and attach her and I will have a look.
You should be able to watch registers.
If you want, zip the circuit and code and attach her and I will have a look.

Quote from Rio on March 8, 2025, 4:12 pmDon't worry about the functionality or sence of the example. i just playing around. But as I said, symbolic constant temp can be displayed/debugged in the mpu monitor, PORTC cannot.
Edit: I tried to upload a zip file, but I can't see it afterwards... so here is the code:
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=16F876A, r=DEC
#include <P16F876A.inc>
__CONFIG _CP_OFF & _WRT_OFF & _CPD_OFF & _LVP_OFF & _WDTE_OFF & _FOSC_HS
;
; everything is already defined in P16F876A.inc:
;STATUS EQU 0x003 ; Adresse Statusregister
;RP0 EQU 5 ; Bit für Registerbank 0/1
;PORTB EQU 0x006 ; Adresse Port B
;PORTC EQU 0x007 ; Adresse Port C
;TRISB EQU 0x086 ; Adresse Tristatekontrolle PORT B
;TRISC EQU 0x087 ; Adresse Tristatekontrolle PORT C
;
; alias
temp EQU 0x20
;
ORG 0 ; Programm-Flash
goto init ; Sprung zum Programmanfang
;
init movlw 0xff ; Zahl 256 in w laden
movwf temp ; Inhalt von Register W in Speicherstelle temp setzen
;
loop movf temp,w ; PORTB,w --> eingabe nach w-register
andlw B'00111111' ; maske B7 und B6 nach 00 löschen
movwf temp ; Inhalt von Register W in Speicherstelle temp setzen
iorlw B'00110000' ; maske B5 und B4 auf 11 setzen
movwf temp ; Inhalt von Register W in Speicherstelle temp setzen
xorlw B'00001100' ; maske B3 und B2 komplementieren
movwf temp ; Inhalt von Register W in Speicherstelle temp setzen
movwf PORTC ; w-register nach ausgabe
goto init ; init & loop
END
Thanks.
Don't worry about the functionality or sence of the example. i just playing around. But as I said, symbolic constant temp can be displayed/debugged in the mpu monitor, PORTC cannot.
Edit: I tried to upload a zip file, but I can't see it afterwards... so here is the code:
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=16F876A, r=DEC
#include <P16F876A.inc>
__CONFIG _CP_OFF & _WRT_OFF & _CPD_OFF & _LVP_OFF & _WDTE_OFF & _FOSC_HS
;
; everything is already defined in P16F876A.inc:
;STATUS EQU 0x003 ; Adresse Statusregister
;RP0 EQU 5 ; Bit für Registerbank 0/1
;PORTB EQU 0x006 ; Adresse Port B
;PORTC EQU 0x007 ; Adresse Port C
;TRISB EQU 0x086 ; Adresse Tristatekontrolle PORT B
;TRISC EQU 0x087 ; Adresse Tristatekontrolle PORT C
;
; alias
temp EQU 0x20
;
ORG 0 ; Programm-Flash
goto init ; Sprung zum Programmanfang
;
init movlw 0xff ; Zahl 256 in w laden
movwf temp ; Inhalt von Register W in Speicherstelle temp setzen
;
loop movf temp,w ; PORTB,w --> eingabe nach w-register
andlw B'00111111' ; maske B7 und B6 nach 00 löschen
movwf temp ; Inhalt von Register W in Speicherstelle temp setzen
iorlw B'00110000' ; maske B5 und B4 auf 11 setzen
movwf temp ; Inhalt von Register W in Speicherstelle temp setzen
xorlw B'00001100' ; maske B3 und B2 komplementieren
movwf temp ; Inhalt von Register W in Speicherstelle temp setzen
movwf PORTC ; w-register nach ausgabe
goto init ; init & loop
END
Thanks.

Quote from arcachofo on March 10, 2025, 11:46 amI think I found the problem.
First, in PIC MCUs when you read PORT registers what you get is Pin states, not the value stored in the register itself.
So to get the value in the register it should be configured as output.
But if the Pins are not connected their state is not updated.So as a workaround you can set PORTC as output and connect to something.
I think I found the problem.
First, in PIC MCUs when you read PORT registers what you get is Pin states, not the value stored in the register itself.
So to get the value in the register it should be configured as output.
But if the Pins are not connected their state is not updated.
So as a workaround you can set PORTC as output and connect to something.