RS485 Module

From LEXWiKi

Jump to: navigation, search

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