Java Web under the serial communication

Source: Internet
Author: User

Recently in the Java serial communication, mainly with the PC through the serial port from the RS485 read data, and through the CRC cyclic redundancy check, to receive the correct data parsing, insert database MySQL, and SSH technology to the database data in tabular form and chart display
Ideas:
1. In order to read data from the RS485, because there is no hardware device, the system is Win7, so the virtual Serial Port Drive (VSPD) This software is replaced by a dummy serial port. and download Sscom32.exe analog serial communication software.

2. In order to realize serial communication, using Java to implement serial communication (under Windows System), we need to use the string javacomm20-win32.zip provided by Sun. There are three files to use, which are configured as follows:
Comm.jar placed to Java_home/jre/lib/ext;
Win32com.dll placed to Java_home/bin;
Javax.comm.properties two places to put them.
Jre/lib (that is, the JRE under the JAVA folder), Java_home/jre/lib
This configuration has been tested successfully on my computer and may not require such trouble. Note that if you use myeclipse because it comes with the JRE, you need to place the DLL and the properties file in the appropriate location of the JRE where it resides.

Does it feel like this is a hassle, and there are windows restrictions. Later we downloaded RXTX this open source package instead of just the comm. Not only Windows can under, Linux also can. The use method is simple and is configured as follows:

Rxtxcomm.jar put it in Java_home/jre/lib/ext.
RxtxSerial.dll put it in Java_home/bin.
If you use the MyEclipse tool, you need to put the rxtxSerial.dll in its own JRE.

3. Create a new Eclipse project and add a Comm.jar or Rxtxcomm.jar package. Because there is a sample Simpleread.java in the Javacomm20-win32.zip package, this example can be used to test whether the serial port is correct

4. After receiving the correct data, according to the Protocol of the Transmitting and receiving parties, the CRC cyclic check is used to determine whether the transmission is correct according to the verification function of the transmitting party.

5. Parse the correct end of the data, view your assigned communication rules, and then parse

6. Insert Database, JDBC Insert

7. Data statistics, timing statistics hourly, daily, monthly, annual average, the use of quartz services to achieve.

8. Build Web Engineering, use HIBERNATE3,SPRING3,DWR technology to display database data dynamically, chart using Jfreechart, and AJAX application
    • VSPD virtual serial port. RAR (4.4 MB)
    • Download number of times: 497
    • Sscom32.zip (343.5 KB)
    • Download number of times: 508
    • Javacomm20-win32_.zip (266.3 KB)
    • Download number of times: 436
    • Rxtx-2.1-7-bins-r2.zip (596 KB)
    • Download number of times: 517

Java Web under the serial communication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.