Report
1 week, 4 days ago.

Assigning microbit pins to drive lcd on microbit

I've looked at the mbed examples for 16xw and 14x2 lcds. How can I adapt these for use with the microbit? Specifically, which pins can I use and how are they represented in the code?

Comment on this question

1 Answer

1 week, 4 days ago.

You will need:

a) an I2C port expander which will convert the I2C interface to parallel for your text LCD display

b) or use SPI interface to mate with the many supported color TFT displays on mbed

Skim through these links to get the idea:

https://developer.mbed.org/questions/68233/LCD-16x2-with-i2c-compatibility/

https://developer.mbed.org/components/HD44780/

http://www.ebay.com/itm/IIC-I2C-TWI-1602-Serial-Blue-Backlight-LCD-Display-For-Arduino-/221935534466

http://www.ebay.com/itm/291780291995?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

For TFT display use - search the user forum but here are some links:

https://developer.mbed.org/cookbook/SPI-driven-QVGA-TFT

https://developer.mbed.org/components/cat/display/

https://developer.mbed.org/components/18-TFT-with-SPI-Interface/

https://developer.mbed.org/questions/76295/I2C-not-working-Parallel-bus-works/

Hi Sanjiv, Thanks again for your help. However, I can use microbit GPIO lines directly with a standard LCD display and a micropython program. What I'm trying to do is use data collected via SPI to be displayed on the LCD, so I need to keep those 3 SPI pins free. I think if I disable the microbit LED matrix I can reconfigure further pins as outputs to drive the LCD..... but I'm not sure exactly how to do this. Also the mbed example uses p15 as an rs pin. If this is the same P0_15 on the CPU,then I don't think that this is present on the microbit edge connector. Any help gratefully received!

posted by Alan Beamish 19 May 2017

You are using up relatively many pins on the microbit when driving the LCD in parallel mode (6 pins). The serial mode needs only 2 (I2C) or 3 (SPI) pins. Note that you can use the SPI port for both the data collection and the display as long as you dont need them to be active at the same time. Just make sure each device has a separate CS pin and dont use a timer or ticker activated data collection that might interfere with an ongoing display operation.

The pinname scheme p15, p16 etc is only used on the original mbed LP1768 and LPC11U24. Other mbed boards use their own conventions (eg Arduino pinnames). You can also always use the portpin names as given in the device hardware manual (eg P0_15). Check the platform page for your board to find the appropriate pinname convention.

posted by Wim Huiskamp 19 May 2017

Thanks to both Sanjiv and Wim for their help.

posted by Alan Beamish 20 May 2017

To post an answer, please log in.