Ameba Arduino: [RTL8195AM] LCD12864 - Draw sketch

Preparation

  • Ameba x 1
  • LCD12864 Module x 1

Example

In this example, we use LCD12864 module to display the sketch drawn in sample code (“012” and a circle).
We need the following library:
https://github.com/ambiot/amb1_arduino/raw/master/Arduino_libraries/LCD12864.zip
For more information about LCD12864:

http://playground.arduino.cc/Code/LCD12864

Please refer to Arduino official tutorial to add .zip library to Ameba:
https://www.arduino.cc/en/Guide/Libraries#toc4

Open the sample code in “File” -> “Examples” -> “AmebaLCD12864” -> “drawsketch”
Wiring diagram:
1

Code reference

The sample code draws “0 1 2” and a circle on LCD12864 screen.
After initialization, call Render() to start to draw sketch
LCDA.Render()

use DrawCircle(int x0, int y0, int radius) to draw circle. The first two arguments are the x and y coordinates of the circle, and the third argument is the radius of the circle.

LCDA.DrawCircle(30,135,5);

RenderScreenBuffer(int screen) is used to specify the screen part where you want to draw sketch (1 = upper part of the screen, 2 = lower part of the screen)

LCDA.RenderScreenBuffer(2);

Draw(bool t, int x, int y) is used to seitch graphics mode.
(t is true means the graphics mode is on, argument ‘x’ and ‘y’ can be any number.)
(t is false means the ASCII mode is on, argument ‘x’ represents the position of the characters (ranging from 0 to 23), and argument ‘y’ is of no use.

LCDA.Draw(false,4,0);

setPins(int tRS, int tRW, int tD7, int tD6, int tD5, int tD4, int tD3, int tD2, int tD1, int tD0) specifies data for data lines to draw on LCD screen.
tRS: Register Set
tRW: Read/Write
tD7: Data line 7
tD6: Data line 6
tD5: Data line 5
tD4: Data line 4
tD3: Data line 3
tD2: Data line 2
tD1: Data line 1
tD0: Data line 0

LCDA.setPins(1,0,0,0,1,1,0,0,0,0); //0
LCDA.setPins(1,0,0,0,1,1,0,0,0,1); //1
LCDA.setPins(1,0,0,0,1,1,0,0,1,0); //2
Copyrights ©瑞晟微电子(苏州)有限公司 2021. All rights reserved.
Please confirm that QQ communication software is installed