[wontfix] Fail to forward REPL to LCD160CR

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
User avatar
Cacahuete
Posts: 3
Joined: Mon Sep 04, 2017 9:29 am

[wontfix] Fail to forward REPL to LCD160CR

Post by Cacahuete » Sun Oct 15, 2017 9:47 pm

Hi everybody!

I'm a brand new PyBoard / uPython user and am currently building an electric heater controller atop electronic modules created by a friend of mine. But this is the side-story... My goal for the moment is to clone the REPL to the lcd160cr I've connected in 'Y' position [1] on my PyBoard1.1 (firmware 1.9.2, "threading").

Everything works fine (tests, write, set_power, erase, ...) but when I try "Directing the MicroPython output to the display" [2], nothing happens and it saddens me as I would like my "monitoring application" to be standalone (and not require a PC-based 'display').

I precisely executed the given commands, no errors are thrown, nothing happens...

MicroPython v1.9.2 on 2017-08-23; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> uart = pyb.UART('YA', 115200)
>>> pyb.repl_uart(uart)
>>> print('On the LCD')
On the LCD
>>> # Nothing on the LCD... :(

I've also tried the same commands after: reseting the LCD; erasing it; singing voodoo incantations whilst walking on my hands... but alas, still a plain black (backlit) LCD :cry:

Does anyone has any clue on what I might do wrong?
Thank you for your kind help :)


--------------------
[1] http://micropython.org/resources/LCD160 ... itions.jpg
[2] https://docs.micropython.org/en/latest/ ... he-display
Last edited by Cacahuete on Fri Nov 10, 2017 10:31 pm, edited 1 time in total.

torwag
Posts: 219
Joined: Fri Dec 13, 2013 9:25 am

Re: Fail to forward REPL to LCD160CR

Post by torwag » Mon Oct 16, 2017 6:36 am

Hi and welcome,

writing to an LCD display is not as easy as you tried. In fact what you did was to write ASCII to the UART port. However, even if the display is connected to the UART port it is usually not 'smart' on its own, how should it know what to do with the information you send? What is text to display and what is a command, and where should it be displayed, which font, size, etc.?
So what you need to do is to send the data and commands in a certain order.
This is sometimes complex and most of the time repetitive and therefore usually enwrapped in a library. As for the LCD160 you are lucky as micropython has one for that already.
Look at the example to get an idea how to write to the LCD.

https://docs.micropython.org/en/latest/ ... 160cr.html

Hope this helps

User avatar
Cacahuete
Posts: 3
Joined: Mon Sep 04, 2017 9:29 am

Re: Fail to forward REPL to LCD160CR

Post by Cacahuete » Mon Oct 16, 2017 1:50 pm

Hi torwag and thank you for the quick answer.

I understand the complexity involved in driving displays and I thoroughly read the documentation you are pointing at. Indeed, that's where I found all the 'write', 'erase', etc. commands (I even played around with shapes, gyros, touch, ...).

My disappointment comes from my second link [2] from the exact same documentation, were we can read:


:arrow: "From now on anything you type at the MicroPython prompt, and any output you receive, will appear on the display."

:arrow: "No set-up commands are required for this mode to work and you can use the display to monitor the output of any UART, not just from the pyboard. All that is needed is for the display to have power, ground and the power/enable pin driven high. Then any characters on the display’s UART input will be printed to the screen. You can adjust the UART baudrate from the default of 115200 using the set_uart_baudrate method."


Unfortunately I do not have the knowledge to build a wrapper around UART to make it show on the LCD160, that's why I was so enthusiast about the ease of use depicted by the documentation.

So my question is still topical: does the code shown actually works or is it some "quack powder"?

User avatar
Cacahuete
Posts: 3
Joined: Mon Sep 04, 2017 9:29 am

Re: Fail to forward REPL to LCD160CR

Post by Cacahuete » Fri Nov 10, 2017 10:32 pm

Hi everybody!

Reading the lcd160cr's documentation [1] back and forth I'm forced to admit REPL duplication is not a built-in function... It's a pity that one can infer this behavior from the PyBoard documentation, and I would recommend fixing it for newbies like me.

So my standalone application will be lcd.write() based!

Thank you torwag for your input :)
I'm editing the title to mark the topic as "unsolvable"

See you around the forum!


--------------------
[1] http://micropython.org/resources/LCD160 ... manual.pdf

User avatar
pythoncoder
Posts: 4232
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: [wontfix] Fail to forward REPL to LCD160CR

Post by pythoncoder » Sat Nov 11, 2017 8:53 am

The document you cite is from the manufacturer of the LCD160CR module. The driver in drivers/display/lcd160cr.py is part of the MicroPython project and that doesn't support REPL output. It would seem that the manufacturers made provision for REPL output but this hasn't (yet?) been taken up by the maintainers.

The solution may be at the application level. You may get some joy by studying this viewtopic.php?f=2&t=3298&p=23108.
Peter Hinch

chuckbook
Posts: 119
Joined: Fri Oct 30, 2015 11:55 pm

Re: [wontfix] Fail to forward REPL to LCD160CR

Post by chuckbook » Mon Nov 13, 2017 2:46 pm

@Cacahuete
Did you initialize the LCD160CR after power on?

Code: Select all

import lcd160cr
lcd = lcd160cr.LCD160CR()
lcd.init('Y') # LCD160CR in 'Y' position
would be sufficient.
After this initialization you could redirect the REPL to the LCD160CR as you tried.
However, it would be more convenient to use something like:

Code: Select all

uart = pyb.UART('YA', 115200)
uart.write('Print on LCD')
Cheers!

Post Reply