LCM Module:LCM under Linux

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
Current revision (13:34, 25 February 2022) (edit) (undo)
 
(26 intermediate revisions not shown.)
Line 1: Line 1:
[[Category:AllowPages]]
[[Category:AllowPages]]
-
== The Sample code source you can download form ==
+
== LCM Module Spec ==
-
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/LCM_release/Linux_base/LCM_src_v11.tar.gz LCM_src_v11.tar.gz]
+
LCM Module spec and command list :
-
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/LCM_release/Linux_base/LCM_v11.tar.gz LCM_v11.tar.gz]
+
<Google Drive> [https://drive.google.com/file/d/1f9f4yxEA5FLhMidfcWN97lkqGCF4t7H5/view?usp=sharing LCM-Spec]
 +
 
 +
<FTP> [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/LCM_release/SCS02002R0LEW--ENGLISH.pdf LCM-Spec]
 +
 
 +
== The Sample code source you can download from ==
 +
Source file:
 +
 
 +
<Google Drive> [https://drive.google.com/file/d/1v2xZGQXceBavjyq8q4me4qEOeZeCEz0l/view?usp=sharing LCMctl_v2.2L_Src]
 +
 
 +
<FTP> [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/LCM_release/Linux_base/LCMctl_v2.2L_Src.tar.gz LCMctl_v2.2L_Src]
 +
 
 +
About source code.
 +
 +
1.We suggest using Code::Blocks as an IDE in Linux.
 +
 +
2.Or you can just use "make" to compile the source code in the LCMctlv22LSrc/ folder or LCMctlv22LSrc/src/ folder.
 +
And you can excute "lcmctlv22l" file in the LCMctlv22LSrc/src/ folder
 +
 +
$cd LCMctlv22LSrc/src/
 +
$make
 +
$./lcmctlv22l
 +
 
 +
Binary file:
 +
 
 +
<Google Drive> [https://drive.google.com/file/d/1R6Od8o4V1Tlfg_9Nt7bw_uK5eZkojw5S/view?usp=sharing LCMctl_v2.2L_Bin]
 +
 
 +
<FTP> [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/LCM_release/Linux_base/LCMctl_v2.2L_Bin.tar.gz LCMctl_v2.2L_Bin]
== How to Switch functions ==
== How to Switch functions ==
Line 16: Line 42:
== How to use the DEMO application ==
== How to use the DEMO application ==
-
[[Image:LCM_Linux_AP.JPG]]<br />
+
[[Image:lcmctl.JPG]]<br />
-
#Key-in 1 then Key-in message for UP line
+
#COM Port selection
-
#Key-in 2 then Key-in message for LOW line
+
#Confirm COM Port select
-
#Key-in 3 then Key-in message for message Auto-Show
+
#Upline message enter
-
 
+
#Upline message send
-
Notes:We use the number char for line switch ,whereby this DEMO Application doesn't support number char display(0~9)!!<br />
+
#Clear upline
 +
#Lowline message enter
 +
#Lowline message send
 +
#Clear lowline<br /><br />
== Sample code Introduction ==
== Sample code Introduction ==
-
===Open COM Port Device===
+
===Open COM Port Device(COM1~COM4)===
-
In Sample code /LCD_CTLDlg.cpp lin 157
+
portinfo_t portinfo1 ={'0' , 9600 , '8', '0' , '0' , '0' , '0' , '0' , '1' , 0 };
-
if(m_SerialPort.InitPort(this,nPort,9600,'N',8,1,EV_RXFLAG|EV_RXCHAR,512)) //Set LCM to 9600.n.8.1
+
portinfo_t portinfo2 ={'0' , 9600 , '8', '0' , '0' , '0' , '1' , '0' , '1' , 0 };
-
{
+
portinfo_t portinfo3 ={'0' , 9600 , '8', '0' , '0' , '0' , '2' , '0' , '1' , 0 };
-
m_SerialPort.StartMonitoring(); //Open Com port monitoring
+
portinfo_t portinfo4 ={'0' , 9600 , '8', '0' , '0' , '0' , '3' , '0' , '1' , 0 };
-
m_bSerialPortOpened=TRUE; //Set COM port open
+
//Default tty:COM2
-
}
+
-
 
+
-
===Close COM Port Device===
+
-
In Sample code /LCD_CTLDlg.cpp lin 171
+
-
m_SerialPort.ClosePort(); //Set COM port close
+
-
m_bSerialPortOpened=FALSE;
+
===Send the UP line message to LCM Device===
===Send the UP line message to LCM Device===
-
In Sample code /LCD_CTLDlg.cpp lin 183
+
char upline[C32]={0x1b,0x51,0x41}; //for LCM UP line command
-
if(!m_bSerialPortOpened) return; //check the com port was open
+
text = gtk_entry_get_text(GTK_ENTRY(entry));
-
UpdateData(TRUE);
+
sprintf(upline+3,"%s\r", text);
-
char szSend[30] = {0x1b, 0x51, 0x41}; //0x1b , 0x51 ,0x41 for LCM send UPline command
+
PortSend(fdcom, upline, C32); //Send the message to LCM
-
sprintf(szSend+3, "%s\r", m_Sendmsg);
+
 
-
m_SerialPort.WriteToPort(szSend); //Write command and message to LCM device
+
===Clear the UP line message of LCM Device===
 +
char upline[C32]={0x1b,0x51,0x41}; //for LCM UP line command
 +
const char *clear = "";
 +
sprintf(upline+3 , "%s\r" , clear);
 +
PortSend(fdcom, upline, C32);
===Send the LOW line message to LCM Device===
===Send the LOW line message to LCM Device===
-
In Sample code /LCD_CTLDlg.cpp lin 215
+
char lowline[C32]={0x1b,0x51,0x42}; //for LCM LOW line command
-
UpdateData();
+
text = gtk_entry_get_text(GTK_ENTRY(entry));
-
char szSend[30] = {0x1b, 0x51, 0x42}; //0x1b , 0x51 ,0x42 for LCM send LOWline command
+
sprintf(lowline+3,"%s\r",text);
-
sprintf(szSend+3, "%s\r", m_Sendmsg2);
+
PortSend(fdcom, lowline, C32); //Send the message to LOW Line
-
m_SerialPort.WriteToPort(szSend); //Write command and message to LCM device
+
 
 +
===Clear the LOW line message of LCM Device===
 +
char lowline[C32]={0x1b,0x51,0x42}; //for LCM LOW line command
 +
const char *clear = "";
 +
sprintf(lowline+3 , "%s\r" , clear);
 +
PortSend(fdcom, lowline, C32);
 +
 
 +
===LCM Command list===
 +
Please check the page6 in spec file ,you can download form [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/LCM_release/SCS02002R0LEW--ENGLISH.pdf LCM-Spec]

Current revision

Contents

LCM Module Spec

LCM Module spec and command list :

<Google Drive> LCM-Spec

<FTP> LCM-Spec

The Sample code source you can download from

Source file:

<Google Drive> LCMctl_v2.2L_Src

<FTP> LCMctl_v2.2L_Src

About source code.

1.We suggest using Code::Blocks as an IDE in Linux.

2.Or you can just use "make" to compile the source code in the LCMctlv22LSrc/ folder or LCMctlv22LSrc/src/ folder.
  And you can excute "lcmctlv22l" file in the LCMctlv22LSrc/src/ folder
 
 $cd LCMctlv22LSrc/src/
 $make
 $./lcmctlv22l

Binary file:

<Google Drive> LCMctl_v2.2L_Bin

<FTP> LCMctl_v2.2L_Bin

How to Switch functions

Our LCM module can support TTL and RS232 type,Please make sure your serial port support type,
And switch LCM JUMP as below picture!!

Function:
Image:LCM_RS232.JPG

TTL Function:
Image:LCM_TTL.JPG

How to use the DEMO application

Image:lcmctl.JPG

  1. COM Port selection
  2. Confirm COM Port select
  3. Upline message enter
  4. Upline message send
  5. Clear upline
  6. Lowline message enter
  7. Lowline message send
  8. Clear lowline

Sample code Introduction

Open COM Port Device(COM1~COM4)

portinfo_t portinfo1 ={'0' , 9600 , '8',  '0' , '0' , '0' , '0' , '0' ,  '1' , 0 };
portinfo_t portinfo2 ={'0' , 9600 , '8',  '0' , '0' , '0' , '1' , '0' ,  '1' , 0 };
portinfo_t portinfo3 ={'0' , 9600 , '8',  '0' , '0' , '0' , '2' , '0' ,  '1' , 0 };
portinfo_t portinfo4 ={'0' , 9600 , '8',  '0' , '0' , '0' , '3' , '0' ,  '1' , 0 };
//Default tty:COM2

Send the UP line message to LCM Device

   char upline[C32]={0x1b,0x51,0x41}; //for LCM UP line command
   text = gtk_entry_get_text(GTK_ENTRY(entry));
   sprintf(upline+3,"%s\r", text);
   PortSend(fdcom, upline, C32); //Send the message to LCM

Clear the UP line message of LCM Device

   char upline[C32]={0x1b,0x51,0x41}; //for LCM UP line command
   const char *clear = "";
   sprintf(upline+3 , "%s\r" , clear);
   PortSend(fdcom, upline, C32);

Send the LOW line message to LCM Device

   char lowline[C32]={0x1b,0x51,0x42}; //for LCM LOW line command
   text = gtk_entry_get_text(GTK_ENTRY(entry));
   sprintf(lowline+3,"%s\r",text);
   PortSend(fdcom, lowline, C32); //Send the message to LOW Line

Clear the LOW line message of LCM Device

   char lowline[C32]={0x1b,0x51,0x42}; //for LCM LOW line command
   const char *clear = "";
   sprintf(lowline+3 , "%s\r" , clear);
   PortSend(fdcom, lowline, C32);

LCM Command list

Please check the page6 in spec file ,you can download form LCM-Spec

Personal tools