VB6 Code Example
Serial Display Module - C# Examples

Example 1 : Sending ASCII text to SC6Dlite with serialport

This project shows how to send ASCII characters to be displayed on SC6Dlite serial LED display with Microsoft Visual C#

Download source code here.

public partial class Form1 : Form
byte[] txbuff = new byte[10]; // Byte array for the transmit data
byte uid = 255; // SC6Dlite uid

public Form1()
serialPort1.BaudRate = 9600; // Initialize serial port
serialPort1.PortName = "COM1"; //

private void button1_Click(object sender, EventArgs e)
txbuff[0] = uid; // Load the transmit buffer
txbuff[1] = 98;
string a = textASCII.Text.PadLeft(6); // Insert spaces to made 6 bytes
byte[] c = StrToByteArray(a); // Convert string to byte array
int z = 0;
for (z = 0; z < 6; z++)
txbuff[z + 2] = c[z];
serialPort1.Write(txbuff, 0, 8); // Send transmit buffer to SC6Dlite
private static byte[] StrToByteArray(string str)
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
return encoding.GetBytes(str);

Example 2: Send fixed and marquee text to SC1602A

This example shows how to send ASCII text to SC1602A Serial LCD using serialport class. It also demonstrates how to send the control command to the LCD.

byte[ ] lcd_command = {11,12,13,254,45,1};

the lcd_command byte array is initialize to the command byte value of all the lcd command used in this example. 11 is LCD Home command, 13 is the Clear LCD command and ( 254,45,1 ) is the clear row 1 3 bytes command. Refer to the SC1602A user's manual for command details.

At the start of the program, a clear lcd command were issued using:

serialport1.Write ( lcd_command, 2, 1);

which will send single byte 13 ( 0x0D) to the LCD to clear the screen.

To print text on row 1

Clear row 1 and set the cursor to the beginning of row 1, then send the text in textbox2 to the LCD.

serialport1.Write ( lcd_command , 3, 3, );

To implement text marquee or scrolling text, the text is first converted to byte array. Then load and send the byte array every 500ms using timer1 tick event handler.

Example 2 source code here

Copyright© SILICON CRAFT 2006