LCM Module:LCM under Linux

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
(How to use the DEMO application)
Line 22: Line 22:
Notes:We use the number char for line switch ,whereby this DEMO Application doesn't support number char display(0~9)!!<br />
Notes:We use the number char for line switch ,whereby this DEMO Application doesn't support number char display(0~9)!!<br />
 +
 +
== Sample code Introduction ==
 +
===Open COM Port Device===
 +
In Sample code /LCD_CTLDlg.cpp lin 157
 +
if(m_SerialPort.InitPort(this,nPort,9600,'N',8,1,EV_RXFLAG|EV_RXCHAR,512)) //Set LCM to 9600.n.8.1
 +
{
 +
m_SerialPort.StartMonitoring(); //Open Com port monitoring
 +
m_bSerialPortOpened=TRUE; //Set COM port open
 +
}
 +
 +
===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===
 +
In Sample code /LCD_CTLDlg.cpp lin 183
 +
if(!m_bSerialPortOpened) return; //check the com port was open
 +
UpdateData(TRUE);
 +
char szSend[30] = {0x1b, 0x51, 0x41}; //0x1b , 0x51 ,0x41 for LCM send UPline command
 +
sprintf(szSend+3, "%s\r", m_Sendmsg);
 +
m_SerialPort.WriteToPort(szSend); //Write command and message to LCM device
 +
 +
===Send the LOW line message to LCM Device===
 +
In Sample code /LCD_CTLDlg.cpp lin 215
 +
UpdateData();
 +
char szSend[30] = {0x1b, 0x51, 0x42}; //0x1b , 0x51 ,0x42 for LCM send LOWline command
 +
sprintf(szSend+3, "%s\r", m_Sendmsg2);
 +
m_SerialPort.WriteToPort(szSend); //Write command and message to LCM device

Revision as of 18:57, 4 February 2009

Contents

The Sample code source you can download form

Source file: LCM_src_v11.tar.gz

Binary file: LCM_v11.tar.gz

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:LCM_Linux_AP.JPG

  1. Key-in 1 then Key-in message for UP line
  2. Key-in 2 then Key-in message for LOW line
  3. Key-in 3 then Key-in message for message Auto-Show

Notes:We use the number char for line switch ,whereby this DEMO Application doesn't support number char display(0~9)!!

Sample code Introduction

Open COM Port Device

In Sample code /LCD_CTLDlg.cpp lin 157

  if(m_SerialPort.InitPort(this,nPort,9600,'N',8,1,EV_RXFLAG|EV_RXCHAR,512)) //Set LCM to 9600.n.8.1
  {
  m_SerialPort.StartMonitoring(); //Open Com port monitoring
  m_bSerialPortOpened=TRUE; //Set COM port open 
  }

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

In Sample code /LCD_CTLDlg.cpp lin 183

  if(!m_bSerialPortOpened) return; //check the com port was open
  UpdateData(TRUE);
  char szSend[30] = {0x1b, 0x51, 0x41}; //0x1b , 0x51 ,0x41 for LCM send UPline command
  sprintf(szSend+3, "%s\r", m_Sendmsg);
  m_SerialPort.WriteToPort(szSend); //Write command and message to LCM device

Send the LOW line message to LCM Device

In Sample code /LCD_CTLDlg.cpp lin 215

  UpdateData();
  char szSend[30] = {0x1b, 0x51, 0x42}; //0x1b , 0x51 ,0x42 for LCM send LOWline command
  sprintf(szSend+3, "%s\r", m_Sendmsg2);
  m_SerialPort.WriteToPort(szSend); //Write command and message to LCM device
Personal tools