How to send data using SPI for Newhaven character display.

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
sim222
Posts: 20
Joined: Wed Nov 27, 2019 12:04 am

How to send data using SPI for Newhaven character display.

Post by sim222 » Fri Dec 10, 2021 4:56 am

Hi guys,

Always thanks for your all support for the micropython!!!
I made some projects using MICROPYTHON already this year even I am a newbie for coding.
At this time, I need to display data on character LCD display made by Newhaven:https://www.digikey.kr/ko/products/deta ... V3/2626390

Here's my sample code.

I think I should know how to make hex data for this display.
Checked the signal on the SPI data and the clock line by an oscilloscope.

PLZ help me..

from pyb import SPI,I2C,UART
import time,os
import pyb

spi1=SPI(1, SPI.CONTROLLER, baudrate=100000, polarity=1, phase=1)

#spi1=SPI(1, SPI.PERIPHERAL, baudrate=100000, polarity=1, phase=1) <- It doesn't work.

spiss=pyb.Pin('X5',pyb.Pin.OUT_PP)
spiss(0)

while True:
com1=0xfe #default
com2=0x42 # command for display on
data=0x00
spi1.send(b'com1,com2')
pyb.delay(1000)

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

Re: How to send data using SPI for Newhaven character display.

Post by pythoncoder » Sat Dec 11, 2021 9:52 am

This line

Code: Select all

spi1.send(b'com1,com2')
will send the literal bytes object "com1,com2" which is not what I think you intend. Try

Code: Select all

spi1.send(b"\xfe\x42")
Peter Hinch
Index to my micropython libraries.

sim222
Posts: 20
Joined: Wed Nov 27, 2019 12:04 am

Re: How to send data using SPI for Newhaven character display.

Post by sim222 » Mon Dec 13, 2021 5:52 am

pythoncoder wrote:
Sat Dec 11, 2021 9:52 am
This line

Code: Select all

spi1.send(b'com1,com2')
will send the literal bytes object "com1,com2" which is not what I think you intend. Try

Code: Select all

spi1.send(b"\xfe\x42")
Thanks!!!
Now I can understand all things.

Post Reply