pic16f1826 error
Quote from cpexpert6 on September 13, 2026, 11:13 pmFriends, I'm trying to simulate a project using the PIC16F1827, but it throws an error upon startup. I am attaching the .c, .hex (from XC8), and .sim2 files. What could be causing the error? I'm using SimulIDE 2.0.0.
log:
NOVO CIRCUITO
Inicializando p16F1826-3443
p16F1826-3443 Inicializado
Carregando arquivo hex:
F:/pic16f628a/pic16f1826_4a20ma/pic16f1826_4a20ma.hex
Endereço Linear Estendido: 0x10000
Palavra de Configuração Carregada em: 0x8007 valor = 0x3F84
INTOSCIO: I/O OSC1
Watchdog: Desativado
MCLR: Desativado
Palavra de Configuração Carregada em: 0x8008 valor = 0x1EFF
PLL: Desativado
Firmware carregado com sucesso
Circuito Carregado:
F:/pic16f628a/pic16f1826_4a20ma/pic16f1826_4a20ma.sim1
Iniciando Simulação do Circuito...
Inicializando 57 eElementos
Inicializando 21 eNós
Simulação em Execução...
eMcu::stepCpu: Erro PC = 4541 Tamanho do PGM = 2048
MCU parado
Friends, I'm trying to simulate a project using the PIC16F1827, but it throws an error upon startup. I am attaching the .c, .hex (from XC8), and .sim2 files. What could be causing the error? I'm using SimulIDE 2.0.0.
log:
NOVO CIRCUITO
Inicializando p16F1826-3443
p16F1826-3443 Inicializado
Carregando arquivo hex:
F:/pic16f628a/pic16f1826_4a20ma/pic16f1826_4a20ma.hex
Endereço Linear Estendido: 0x10000
Palavra de Configuração Carregada em: 0x8007 valor = 0x3F84
INTOSCIO: I/O OSC1
Watchdog: Desativado
MCLR: Desativado
Palavra de Configuração Carregada em: 0x8008 valor = 0x1EFF
PLL: Desativado
Firmware carregado com sucesso
Circuito Carregado:
F:/pic16f628a/pic16f1826_4a20ma/pic16f1826_4a20ma.sim1
Iniciando Simulação do Circuito...
Inicializando 57 eElementos
Inicializando 21 eNós
Simulação em Execução...
eMcu::stepCpu: Erro PC = 4541 Tamanho do PGM = 2048
MCU parado
Quote from sorro on September 14, 2026, 3:45 pmlog:
NOVO CIRCUITO
Inicializando p16F1826-3443
p16F1826-3443 Inicializado
Carregando arquivo hex:
F:/pic16f628a/pic16f1826_4a20ma/pic16f1826_4a20ma.hex
Endereço Linear Estendido: 0x10000
Palavra de Configuração Carregada em: 0x8007 valor = 0x3F84
INTOSCIO: I/O OSC1
Watchdog: Desativado
MCLR: Desativado
Palavra de Configuração Carregada em: 0x8008 valor = 0x1EFF
PLL: Desativado
Firmware carregado com sucesso
Circuito Carregado:
F:/pic16f628a/pic16f1826_4a20ma/pic16f1826_4a20ma.sim1
Iniciando Simulação do Circuito...
Inicializando 57 eElementos
Inicializando 21 eNós
Simulação em Execução...
eMcu::stepCpu: Erro PC = 4541 Tamanho do PGM = 2048
MCU parado
log:
NOVO CIRCUITO
Inicializando p16F1826-3443
p16F1826-3443 Inicializado
Carregando arquivo hex:
F:/pic16f628a/pic16f1826_4a20ma/pic16f1826_4a20ma.hex
Endereço Linear Estendido: 0x10000
Palavra de Configuração Carregada em: 0x8007 valor = 0x3F84
INTOSCIO: I/O OSC1
Watchdog: Desativado
MCLR: Desativado
Palavra de Configuração Carregada em: 0x8008 valor = 0x1EFF
PLL: Desativado
Firmware carregado com sucesso
Circuito Carregado:
F:/pic16f628a/pic16f1826_4a20ma/pic16f1826_4a20ma.sim1
Iniciando Simulação do Circuito...
Inicializando 57 eElementos
Inicializando 21 eNós
Simulação em Execução...
eMcu::stepCpu: Erro PC = 4541 Tamanho do PGM = 2048
MCU parado
Quote from nemka on September 14, 2026, 8:32 pmA pointer stored in FSR1 overwrites the RAM. Simulation stops when PCLATH is overwritten.
When the simulation stops, PCL is 0xBD, so the error caused when PCL is 0xBC. PC can be 0x00BC, 0x01BC or 0x02BC.
Disassembly listing will help you to find the error in your code.
A pointer stored in FSR1 overwrites the RAM. Simulation stops when PCLATH is overwritten.
When the simulation stops, PCL is 0xBD, so the error caused when PCL is 0xBC. PC can be 0x00BC, 0x01BC or 0x02BC.
Disassembly listing will help you to find the error in your code.
Quote from nemka on September 15, 2026, 10:11 amThere is a goto 0x1BD on address 0x1DF. Before this, there is a movwf INDF1.
At this point, there may be a wrong address in FSR1.Without disassembly listing hard to find more information.
There is a goto 0x1BD on address 0x1DF. Before this, there is a movwf INDF1.
At this point, there may be a wrong address in FSR1.
Without disassembly listing hard to find more information.
Quote from arcachofo on September 15, 2026, 11:48 am@cpexpert6 are you sure you compiled for the correct target?
As @nemka mentioned there is a movwf INDF1.
At that point FSR1 contains 10, which writes content of W to PCLATH (address 10).
That causes the jump out of the Program Memory:
eMcu::stepCpu: Erro PC = 4541 Tamanho do PGM = 2048This was generated by the compiler, which is not very likely to make this mistake unless it thinks it is some other device.
@cpexpert6 are you sure you compiled for the correct target?
As @nemka mentioned there is a movwf INDF1.
At that point FSR1 contains 10, which writes content of W to PCLATH (address 10).
That causes the jump out of the Program Memory:
eMcu::stepCpu: Erro PC = 4541 Tamanho do PGM = 2048
This was generated by the compiler, which is not very likely to make this mistake unless it thinks it is some other device.
