Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HD44780 WriteOnly mode not working (with SPLC780D) #380

Open
neildavis opened this issue Feb 19, 2022 · 2 comments
Open

HD44780 WriteOnly mode not working (with SPLC780D) #380

neildavis opened this issue Feb 19, 2022 · 2 comments

Comments

@neildavis
Copy link
Contributor

neildavis commented Feb 19, 2022

Has anybody successfuly used the hd44780 driver in 'write only' mode? i.e. permanently holding the RW pin at GND and passing machine.NoPin as rw when creating the Device

I wanted to use it this way since the LCD board I'm using requires 5V, but I'm interfacing with a 3.3V MCU (Pi Pico) so want to avoid reading from the device at 5V.

I know I could use a bi-directional level shifter in the circuit, or a hardware hack, but since the driver supported this mode and timing is not important to me I thought I'd try to use it.

I've tried in 8-bit and 4-bit modes but no luck. Just get the boxes instead of text. The datasheet for the LCD module says it uses a SPLC780D rather than a HD44780 but from those datasheets I don't see a huge amount of difference in the timings.

I've tried changing ClearHomeTime & InstrExecTime in Config but found no values that work.

I've also tried rebuilding the driver with various timing changes during the Configure function for the initialization sequence to be more tolerant to the various devices as summarized here but still no luck.

If I connect RW to another GPIO pin - to allow the driver to read the 'busy flag' from the LCD module - then it works flawlessly in both 8-bit and 4-bit mode, so I've ruled out hardware failure.

Any ideas greatfully recieved. Thanks.

Here's my program (8-bit mode variant)

package main

import (
	"machine"
	"time"

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

var (
	pinLCDEN   = machine.GP16
	pinLCDRS   = machine.GP17
	pinLCDData = [8]machine.Pin{machine.GP18, machine.GP19, machine.GP20, machine.GP21,
		machine.GP22, machine.GP26, machine.GP27, machine.GP28}
	pinLCDRW = machine.NoPin // Write only mode to avoid reading at 5V
	lcd      hd44780.Device
)

const (
	lcdCols          = 16
	lcdRows          = 2
	lcdClearHomeTime = time.Millisecond * 150
	lcdInstrExecTime = time.Microsecond * 150
)

func setupPins() {
	lcd, _ = hd44780.NewGPIO8Bit(pinLCDData[:], pinLCDEN, pinLCDRS, pinLCDRW)
	lcd.Configure(hd44780.Config{Width: lcdCols, Height: lcdRows,
		ClearHomeTime: lcdClearHomeTime, InstrExecTime: lcdInstrExecTime})
}

func main() {
	setupPins()
	lcd.SetCursor(0, 0)
	lcd.Write([]byte("Hello"))
	lcd.Display()
	lcd.SetCursor(0, 1)
	lcd.Write([]byte("World"))
	lcd.Display()
	for {
	}
}
@deadprogram
Copy link
Member

Was this addressed by #361 ?

@neildavis
Copy link
Contributor Author

Was this addressed by #361 ?

No, I only started using this repo at v0.19.0 which is downstream of that commit (905fc6f). All the changes I tried from the descritpion were built against dev at the time.

@neildavis neildavis changed the title HD44780 WriteOnly mode not working HD44780 WriteOnly mode not working (with SPLC780D) Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants