PyBoard LCD160CR Text Scrolling Window 8

I used my PyBoard microcontroller + LCD160CD screen as a name tag at 44CON.

I had to do some research, as I could not find example code to get the text scrolling working. The key to the solution was to set the direction to 2 (-x).

This is the code I put in main.py:

# main.py -- put your code here!

Didier Stevens 2017/09/13 https://DidierStevens.com

https://docs.micropython.org/en/latest/pyboard/library/lcd160cr.html

import lcd160cr

http://micropython.org/resources/LCD160CRv10-refmanual.pdf page 7

def LCDVector(frame_mode, direction, step):
return frame_mode << 15 | direction << 12 | step

http://micropython.org/resources/LCD160CRv10-refmanual.pdf page 8

def LCDFont(pixel_replication, soft_scroll_flag, transparency_flag, font_number, horizontal_bold_offst, vertical_bold_offst):
return pixel_replication << 8 | soft_scroll_flag << 7 | transparency_flag << 6 | font_number << 4 | horizontal_bold_offst << 2 | vertical_bold_offst

lcd = lcd160cr.LCD160CR(‘X’)
lcd.set_orient(lcd160cr.PORTRAIT)
lcd.set_scroll_buf('Didier NVISO.BE ')
lcd.set_scroll_win(8, 0, 0, 128, 128, LCDVector(0, 2, 4), LCDFont(7, 0, 0, 3, 0, 0), 0x0000, 0xFFFF)
lcd.set_scroll(1)


Article Link: https://blog.didierstevens.com/2017/09/16/pyboard-lcd160cr-text-scrolling-window-8/