Skip to content

hd44780 not working in 4-bit mode with the LCD from Arduino Starter Kit #646

@sorf

Description

@sorf

The code exhibiting the problem is pretty much a hello-world type (from here)

package main

import (
	"bytes"
	m "machine"
	"strconv"
	"time"

	"tinygo.org/x/drivers/hd44780"
)

func main() {
	m.Serial.Configure(m.UARTConfig{BaudRate: 9600})
	lcd, err := hd44780.NewGPIO4Bit([]m.Pin{m.D5, m.D4, m.D3, m.D2}, m.D11, m.D12, m.NoPin)
	if err != nil {
		println("error: create LCD", err.Error())
		return
	}
	if err := lcd.Configure(hd44780.Config{Width: 16, Height: 2}); err != nil {
		println("error: configure LCD", err.Error())
		return

	}

	println("Start")
	lcd.Write([]byte("Countdown:"))
	lcd.Display()
	time.Sleep(1 * time.Second)
	
	// snip

It happens with latest version (v0.26.0), on both:

The easiest way to reproduce the issue is with a virtual circuit on wokwi.com (such as this one), by pressing F1 there, then selecting Upload Firmware and Start Simulation and uploading the tinygo built hex file. The mis-behavior is of random "gibberish" showing up on the LCD.

Th expected behavior of the virtual circuit should be like exhibited by this one - programmed with the Arduino LiquidCrystal library.

Possibly related to #380?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions