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
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
[wontfix] Fail to forward REPL to LCD160CR
[wontfix] Fail to forward REPL to LCD160CR
Last edited by Cacahuete on Fri Nov 10, 2017 10:31 pm, edited 1 time in total.
Re: Fail to forward REPL to LCD160CR
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
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
Re: Fail to forward REPL to LCD160CR
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:
"From now on anything you type at the MicroPython prompt, and any output you receive, will appear on the display."
"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"?
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:
"From now on anything you type at the MicroPython prompt, and any output you receive, will appear on the display."
"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"?
Re: Fail to forward REPL to LCD160CR
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
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
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: [wontfix] Fail to forward REPL to LCD160CR
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.
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
Index to my micropython libraries.
Index to my micropython libraries.
Re: [wontfix] Fail to forward REPL to LCD160CR
@Cacahuete
Did you initialize the LCD160CR after power on?
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:
Cheers!
Did you initialize the LCD160CR after power on?
Code: Select all
import lcd160cr
lcd = lcd160cr.LCD160CR()
lcd.init('Y') # LCD160CR in 'Y' position
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')