lcgamboa / picsimlab

PICsimLab - Programmable IC Simulator Laboratory
GNU General Public License v2.0
466 stars 90 forks source link

LCD1602 working with x board but not working with gpboard using PIC16F877A #127

Closed eagl1 closed 3 weeks ago

eagl1 commented 3 weeks ago

Hi,

I used the same code and same pin configuration. But it's working with x board but not working with gpboard, here are the photos:

  1. gpboard:

image

  1. x board:

image

What could be the problem ? I think it's a bug with the gpboard.

lcgamboa commented 3 weeks ago

Hi @eagl1,

Could you share the source code and the workspace file (.pzw)? It is probably some problem with the gpsim interface with PICSimLab.

eagl1 commented 3 weeks ago

code_simulation.zip

lcgamboa commented 3 weeks ago

Hi @eagl1, in your code you don't initialize the ADCON1 register. After reset the ADCON1 = 0 and all ADC input pins are in analog mode (including the REx pins). Initializing the ADCON=0x06 put all pins in digital mode and solve the problem. In the real (and PICSimlab) PIC microcontroller if the pin is configured as output in analog mode it work (but consumes more energy and it is not recommended by datasheet), but it don't work with gpsim.