Outputting Label2.caption to the LCD.

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
Shak
LCD Guru
Posts: 57
Joined: Tue Jan 01, 2002 4:00 pm
Location: Huddersfield, UK
Contact:

Post by Shak »

how would I do this in VB/


I am really stuck on it

Shak

Ghoast
LCD Guru
Posts: 65
Joined: Thu Nov 29, 2001 4:00 pm
Location: Sweden
Contact:

Post by Ghoast »

MsComm1.OutPut=label2.Caption works fine for that. put a MsComm control in a form and open the port, send the data and you're done. To send a command send MsComm1.OutPut=Chr(254) <command> where Chr(254) is the command prexif followed by a command. For example, to turn backlight on indefinetly send Chr(254) & Chr(66) & Chr(0)
or to place the cursor at column 1, row 1 send Chr(254) & Chr(71) & Chr(1) & Chr(1)
the command set is in the manual. remember to send decimals if you use Chr command.

Ghoast
LCD Guru
Posts: 65
Joined: Thu Nov 29, 2001 4:00 pm
Location: Sweden
Contact:

Post by Ghoast »

Use this source code in a form containing a Ms comm control, a command button named Command1 and a label named Label1:

Private Sub Form_Load()
'Open comm port.
MSComm1.PortOpen = True
'Turn on backlight indefinetly
MSComm1.Output = Chr(254) & Chr(66) & Chr(0)
End Sub

Private Sub Command1_Click()
'Set cursor at column 1, row 1.
MSComm1.Output = Chr(254) & Chr(71) & Chr(1) & Chr(1)
'Send caption of Label1 to the comm port.
MSComm1.Output = Label1.Caption
End Sub

Private Sub Form_Unload(Cancel As Integer)
'Close comm port.
MSComm1.PortOpen = False
End Sub

Shak
LCD Guru
Posts: 57
Joined: Tue Jan 01, 2002 4:00 pm
Location: Huddersfield, UK
Contact:

Post by Shak »

nice one ghoast :grin:

Shak

Post Reply