請先看『使用說明』
RS485 Module
From LEXWiKi
Contents |
The Sample code source you can download from
Source file: RS485Src.rar
Binary file: RS485bin.rar
How to use this Demo Application
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 .
Test
Please following below when use this application to test COM functions.
picture of example
Parallel line
To be used in : 485->M303(485) 、 M303(485)->485 、 M303(485)->M303(485)
Parallel line + crossover + converter
To be used in : 485->232 、 M303(485)->232 、 232->485 、 232->M303
Corssover
Cross Tx node and Rx node
Converter
RS232 and RS485 signal converter
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 )
Supported Auto-Flow M/B
VIA
CV700C, CV766C, 3V700C, 5V700C
INTEL
FI853P, CI945C, CI270C, 3I270A, 3I270C, FI270A