Serial Port operations include the java host computer Embedded c-host machine, and the java lower bit

Source: Internet
Author: User

Serial Port operations include the java host computer Embedded c-host machine, and the java lower bit
Environment 1: 1.1 Keil uVision4

Http://pan.baidu.com/s/1o6A331w

1.2 STC

Http://pan.baidu.com/s/1jGpCUTC

 

1.3 Myeclipse 8.5

Http://pan.baidu.com/s/1jGABEaM

 

1.4 jar package RXTX to be imported

Http://pan.baidu.com/s/1ntwsvRr

Copy rxtxParallel. dll and rxtxSerial. dll to the bin directory of the jdk directory.

Copy RXTXcomm to the jdk \ jre \ lib \ ext directory.

Finally, import the jar package RXTXcomm to your java project.

1.5 AT89C51 single chip microcomputer 1.6 18B20 Temperature Sensor 1.7 DS1302 clock controller 1.8 1602 LCD two single chip microcomputer lower computer

Create a folder on the desktop as your embedded workspace


Create a project in keil


Select the folder created on the desktop


Select atmel series Processors


Select at89c51


Copy the c file you wrote to the process you just created on the desktop. If not, create a new SouceFile. c file.


Switch to keil and double-click the process name to import the c file.


Modify process attributes


Click target to change 24 to 12.


Click output to check the crate hex


If the imported c file does not have any code, write it again. Then, click the following three buttons. If the imported c price is written, you can click


Open the Desktop Folder again and find that many files are added, including hex files.


Now you can burn the hex file to the microcontroller.

Here I am using STC


Click the exe file


Modify the baud rate of your mcu com port, click "single open file", and select your hex file. Download the program to the microcontroller.

At this time, you are prompted to re-execute the single-chip microcomputer or turn on the single-chip microcomputer switch button.

If you are prompted that the COM port cannot be found or is in use, first check whether the COM port is correct, and then check whether other software occupies the COM port. It is best to turn off all other software.


Let's take a look at the running results in myeclipse.


Three PC host computer

How to accept serial port information? The language I chose is java, because it is powerful and flexible.

The ide I selected is myeclipse 8.5. In addition, the kar package rxtx is used because the comm package only supports win32 bits.

The operation is simple, that is, creating a java project, importing a jar package, and creating a java file under src. Pay attention to the use of rxtx. It is mainly to copy two dll files to the bin of jdk, copy the jar package to ext, and finally import the jar files to your project. Download all the code and jar files at the following link. The following describes how to use rxtx.





4. Source Code

Http://pan.baidu.com/s/1pJDPtPL

It contains the process files and rxtx packages of the upper and lower computers.

For more information, see ReadMe. tex.

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.