請先看『使用說明』
RS485 Module under WinCE
From LEXWiKi
(→The Sample code source you can download from) |
|||
(5 intermediate revisions not shown.) | |||
Line 3: | Line 3: | ||
'''Note:this source code and binary only suppor RS485 test on VIA series motherboard''' | '''Note:this source code and binary only suppor RS485 test on VIA series motherboard''' | ||
== The Sample code source you can download from == | == The Sample code source you can download from == | ||
- | + | <!-- | |
+ | <Google Drive> | ||
+ | |||
+ | Source file: [https://drive.google.com/file/d/1g-cWs5kpIVSvJyb2AP17_XtUN7b0-jcQ/view?usp=sharing RS485_CE_Src] | ||
+ | |||
+ | Binary file: [https://drive.google.com/file/d/1XeyocArp8cquoK73gZA50sLyPhUQCFiW/view?usp=sharing RS485_CE_Bin] | ||
+ | --> | ||
+ | |||
+ | |||
+ | <FTP> | ||
+ | |||
+ | Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/RS485/RS485_Src_CE.rar RS485_CE_Src] | ||
+ | |||
+ | Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/RS485/RS485_Bin_CE.rar RS485_CE_Bin] | ||
- | Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/RS485/RS485_Bin_CE.rar RS485_Bin_CE.rar] | ||
== How to use this Demo Application == | == How to use this Demo Application == | ||
<center>[[Image:RS485.jpg]]</center><br /> | <center>[[Image:RS485.jpg]]</center><br /> | ||
Line 13: | Line 25: | ||
4.click AutoFlow if you want to test flowcontrol.<br /> | 4.click AutoFlow if you want to test flowcontrol.<br /> | ||
- | + | == Sample code Introduction == | |
+ | |||
+ | ===Create Com Port=== | ||
+ | bool CreatCom(CString Com_Str,DWORD Send_buf,DWORD Rec_buf,int flow_control) | ||
+ | '''Parameters'''<br /> | ||
+ | Com_Str: The name of COM port to be created<br /> | ||
+ | Send_buf:Setting Send buffer<br /> | ||
+ | Rec_buf: Setting Recive buffer<br /> | ||
+ | flow_control:flow control flag :1(on) or 0(off)<br /> | ||
+ | |||
+ | ===Setting Com port === | ||
+ | bool SetCom(int rate, BYTE ByteSize, TCHAR parity, TCHAR stopbit, int rtsflag) | ||
+ | '''Parameters'''<br /> | ||
+ | rate:Specifies the device communication BaudRate.<br /> | ||
+ | parity:'E'=EVENPARITY , 'M'=MARKPARITY , 'N'= NOPARITY , 'S'= SPACEPARITY , 'O' = ODDPARITY<br /> | ||
+ | stopbit:'1'=ONESTOPBIT , '1.5'=ONE5STOPBITS , '2'=TWOSTOPBITS <br /> | ||
+ | rtsflag: 0=no setting(RS232) , 1=default RTS is low , 2=default RTS is high<br /> | ||
+ | |||
+ | ===Send Message or Recive Message=== | ||
+ | bool Send(CString)<br /> | ||
+ | bool Recive(CString *)<br /> | ||
+ | If successful return true else return false <br /> | ||
+ | |||
+ | ===Close Com handle=== | ||
+ | bool CloseCom()<br /> | ||
+ | Closes a COM handle. if function success , return true.<br /> | ||
+ | |||
+ | ===Close Com handle=== | ||
+ | LPCTSTR GetErrMsg()<br /> | ||
+ | Get the error message when return value is false from above function <br /> |
Current revision
Note:this source code and binary only suppor RS485 test on VIA series motherboard
Contents |
The Sample code source you can download from
<FTP>
Source file: RS485_CE_Src
Binary file: RS485_CE_Bin
How to use this Demo Application

1.Selcet RS485 com port and Rts Signal Control ,Click Open.
2. Put some message in editbox and then press send button
3.Click Recive button and than the message will display in editbox.
4.click AutoFlow if you want to test flowcontrol.
Sample code Introduction
Create Com Port
bool CreatCom(CString Com_Str,DWORD Send_buf,DWORD Rec_buf,int flow_control)
Parameters
Com_Str: The name of COM port to be created
Send_buf:Setting Send buffer
Rec_buf: Setting Recive buffer
flow_control:flow control flag :1(on) or 0(off)
Setting Com port
bool SetCom(int rate, BYTE ByteSize, TCHAR parity, TCHAR stopbit, int rtsflag)
Parameters
rate:Specifies the device communication BaudRate.
parity:'E'=EVENPARITY , 'M'=MARKPARITY , 'N'= NOPARITY , 'S'= SPACEPARITY , 'O' = ODDPARITY
stopbit:'1'=ONESTOPBIT , '1.5'=ONE5STOPBITS , '2'=TWOSTOPBITS
rtsflag: 0=no setting(RS232) , 1=default RTS is low , 2=default RTS is high
Send Message or Recive Message
bool Send(CString)
bool Recive(CString *)
If successful return true else return false
Close Com handle
bool CloseCom()
Closes a COM handle. if function success , return true.
Close Com handle
LPCTSTR GetErrMsg()
Get the error message when return value is false from above function