RS485 Module

From LEXWiKi

Revision as of 09:50, 27 April 2010 by Steve (Talk | contribs)
Jump to: navigation, search

Contents

The Sample code source you can download from

Source file: RS485Src.rar

Binary file: RS485bin.rar

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 "傳送資料", 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

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