RS485 Module

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
Current revision (14:06, 25 February 2022) (edit) (undo)
(The Sample code source you can download from)
 
(20 intermediate revisions not shown.)
Line 2: Line 2:
== The Sample code source you can download from ==
== The Sample code source you can download from ==
-
Source file: [ RS485Src.rar]
+
<Google Drive>
-
Binary file: [ RS485bin.rar]
+
Source file: [https://drive.google.com/file/d/1ixqpx2b5iPYhAdI4xTC_dLujtm1oYz-Q/view?usp=sharing RS485_Src]
 +
 
 +
Binary file: [https://drive.google.com/file/d/1XVpJU6XSUj2D5lSnNfB-YHN9Wl64o9qW/view?usp=sharing RS485_Bin]
 +
 
 +
 
 +
<FTP>
 +
 
 +
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/RS485/RS485_Src_v1.2.rar RS485_Src]
 +
 
 +
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/RS485/RS485_Bin_v1.2.rar RS485_Bin]
== How to use this Demo Application ==
== How to use this Demo Application ==
-
[[Image:485.jpg]]
+
[[Image:485init.jpg]]
1. Select RS485 com port to test and then click "Open" button (click close before you change another com)
1. Select RS485 com port to test and then click "Open" button (click close before you change another com)
Line 13: Line 22:
2. Select receive com port and press Open
2. Select receive com port and press Open
-
3. Put some letter in editbox and then press "傳送資料", the editbox of receive will appear what you just enter.
+
3. Put some letter in editbox and then press "Send", the editbox of receive will appear what you just enter.
 +
 
 +
4. Check "Auto-Flow" if you want to test auto flow function
Auto Check
Auto Check
Line 19: Line 30:
Click "Auto Check" will check RS485 automaticlly and show the result after finish .
Click "Auto Check" will check RS485 automaticlly and show the result after finish .
-
[[Image:OK.jpg]] [[Image:NO.jpg]]
+
[[Image:485OK.jpg]] [[Image:485NO.jpg]]
 +
 
 +
== Test ==
 +
Please following below when use this application to test COM functions.
 +
<center>[[Image:Conection_path.jpg]]</center>
 +
===picture of example===
 +
'''Parallel line'''<br />
 +
To be used in : 485->M303(485) 、 M303(485)->485 、 M303(485)->M303(485)<br />
 +
<center>[[Image:parallel.jpg]]</center>
 +
<br /><br />
 +
'''Parallel line + crossover + converter'''<br />
 +
To be used in : 485->232 、 M303(485)->232 、 232->485 、 232->M303<br />
 +
<center>[[Image:485to232.jpg]]</center>
 +
<br /><br />
 +
'''Corssover'''<br />
 +
Cross Tx node and Rx node<br />
 +
<center>[[Image:crossover.jpg]]</center>
 +
<br /><br />
 +
'''Converter'''<br />
 +
RS232 and RS485 signal converter<br />
 +
<center>[[Image:converter.jpg]]</center>
 +
 
 +
== Sample code Introduction ==
 +
'''Set Com port'''
 +
m_CommSend.put_CommPort(PortIndex); // int PortIndex: Port Number
 +
m_CommSend.put_Settings("9600,n,8,1");//baud rate ,parity ,data bit ,stop bit
 +
<br />
 +
<br />
 +
'''When Receive buffer get more than one byte and will cause a ONCOMM message.'''
 +
m_CommSend.put_RThreshold(1);
 +
<br />
 +
<br />
 +
'''Open Com port'''
 +
m_CommSend.put_PortOpen(TRUE);//Setting false and let port be closed
 +
m_CommSend.get_PortOpen();//Return ture if port is opened.
 +
<br />
 +
<br />
 +
'''Let RTS high by Setting TRUE when send data'''
 +
m_CommSend.put_RTSEnable(TRUE);
 +
<br />
 +
<br />
 +
'''Send data or Receive data by buffer'''
 +
m_CommSend.put_Output(COleVariant(m_StrSendData));//Send data to Com Port buffer
 +
variant_inp = m_CommReceive.get_Input();//Receive data from Com Port buffer
 +
 
 +
<br /><br />
 +
 
 +
 
 +
 
 +
 
 +
 
 +
== Enable Auto-Flow ==
 +
Enable/Disable auto-flow from bios setting ( '''Integrated Peripherals''' -> '''COM3 422/485 flow control''' ) <br>
 +
[[Image:bios.jpg]]
 +
<br>
 +
 
 +
Supported Auto-Flow M/B<br>
 +
VIA<br>
 +
CV700C, CV766C, 3V700C, 5V700C
 +
 
 +
INTEL<br>
 +
FI853P, CI945C, CI270C, 3I270A, 3I270C, FI270A

Current revision

Contents

The Sample code source you can download from

<Google Drive>

Source file: RS485_Src

Binary file: RS485_Bin


<FTP>

Source file: RS485_Src

Binary file: RS485_Bin

How to use this Demo Application

Image:485init.jpg

1. Select RS485 com port to test and then click "Open" button (click close before you change another com)

2. Select receive com port and press Open

3. Put some letter in editbox and then press "Send", the editbox of receive will appear what you just enter.

4. Check "Auto-Flow" if you want to test auto flow function

Auto Check

Click "Auto Check" will check RS485 automaticlly and show the result after finish .

Image:485OK.jpg Image:485NO.jpg

Test

Please following below when use this application to test COM functions.

Image:Conection_path.jpg

picture of example

Parallel line
To be used in : 485->M303(485) 、 M303(485)->485 、 M303(485)->M303(485)

Image:parallel.jpg



Parallel line + crossover + converter
To be used in : 485->232 、 M303(485)->232 、 232->485 、 232->M303

Image:485to232.jpg



Corssover
Cross Tx node and Rx node

Image:crossover.jpg



Converter
RS232 and RS485 signal converter

Image:converter.jpg

Sample code Introduction

Set Com port

   m_CommSend.put_CommPort(PortIndex); // int PortIndex: Port Number
   m_CommSend.put_Settings("9600,n,8,1");//baud rate ,parity ,data bit ,stop bit



When Receive buffer get more than one byte and will cause a ONCOMM message.

   m_CommSend.put_RThreshold(1);



Open Com port

   m_CommSend.put_PortOpen(TRUE);//Setting false and let port be closed
   m_CommSend.get_PortOpen();//Return ture if port is opened. 



Let RTS high by Setting TRUE when send data

   m_CommSend.put_RTSEnable(TRUE);



Send data or Receive data by buffer

   m_CommSend.put_Output(COleVariant(m_StrSendData));//Send data to Com Port buffer
   variant_inp = m_CommReceive.get_Input();//Receive data from Com Port buffer





Enable Auto-Flow

Enable/Disable auto-flow from bios setting ( Integrated Peripherals -> COM3 422/485 flow control )
Image:bios.jpg

Supported Auto-Flow M/B
VIA
CV700C, CV766C, 3V700C, 5V700C

INTEL
FI853P, CI945C, CI270C, 3I270A, 3I270C, FI270A

Personal tools