UncleRus / esp-idf-lib

Component library for ESP32-xx and ESP8266
https://esp-idf-lib.readthedocs.io/en/latest/
1.37k stars 426 forks source link

hd44780 lib issue #504

Closed microgenios closed 1 year ago

microgenios commented 1 year ago

The issue

In Wokwi simulator your LCD library was not working properly. I changed the Enable pin's Clock time and now everything is OK. Following the modified code (Parallel bus access)

static esp_err_t write_nibble(const hd44780_t *lcd, uint8_t b, bool rs) { if (lcd->write_cb) { (...) } else { CHECK(gpio_set_level(lcd->pins.rs, rs)); ets_delay_us(1); // Address Setup time >= 60ns.

    CHECK(gpio_set_level(lcd->pins.d7, (b >> 3)  & 0x01));  
    CHECK(gpio_set_level(lcd->pins.d6, (b >> 2)  & 0x01));  
    CHECK(gpio_set_level(lcd->pins.d5, (b >> 1)  & 0x01));  
    CHECK(gpio_set_level(lcd->pins.d4, (b >> 0)  & 0x01));  

   //Enable clock
    CHECK(gpio_set_level(lcd->pins.e, 0));   ets_delay_us(1);
    CHECK(gpio_set_level(lcd->pins.e, true));ets_delay_us(1);
    CHECK(gpio_set_level(lcd->pins.e, 0));   ets_delay_us(100);

}

return ESP_OK;

}

Which SDK are you using?

esp-idf

Which version of SDK are you using?

master

Which build target have you used?

Component causing the issue

hd44780

Anything in the logs that might be useful for us?

No response

Additional information or context

No response

Confirmation

trombik commented 1 year ago

does it work on a real hardware without the fix?