Don't complain that simulator mimic the real hardware!
Edit: GeorgePauley submitted an excellent message while I was writing.
This is with reference to message #2
Beeing able to edit the value of PORTC, and see the register value change, is a bug in the simulator in older versions.
In all PIC18 devices, and modern PIC16 devices, PORTC is a Read-Only register.
Any write to PORTC go into LATC in the real hardware, so any change to PORTC should be visible in LATC instead.
In wery old PIC16 devices there are also Output latches, but they are Write-Only registers, with no possibility for for the CPU or Debugger to read in hardware.
What will happen with PORTC register, then depend upon TRISC and ANSELC registers:
If ANSELC register is set to Analog mode, then digital input buffers in hardware are disabled,
and PORTC values shall be 0.
If ANSELC register is set to Digital mode, PORTC register shall show signal state on the pin:
If TRISC register is set to all Inputs, PORTC shall Not change,
value should still be the value of External signals in hardware, or Stimulus values in the simulator.
If TRISC is set to all Outputs, then changes to LATC should be visible in PORTC register,
unless the pin is shorted to Vss or Vdd, or is driven by another output in hardware.
If individual pins have different settings in TRISC, ANSELC, or if other peripherals are enabled,
then each bit in PORTC register should respond accordingly.
This message is based upon how hardware is supposed to work.
Different versions of the simulator and debugger may have different bugs or limitations,
so unless you specify what version of MPLAB X is used,
and precisely describe what register you study, and what settings have been done in other registers,
then it is impossible to understand if the simulator is at fault, or if the simulator is showing the effect of a user or program mistake.
post edited by Mysil - 2019/02/21 09:23:29