Multi-host communication based on multi-host parallel port Protocol

Source: Internet
Author: User

With the continuous development of single-chip microcomputer applications, there are more and more multi-chip systems composed of multiple single-chip microcomputer, and information exchange between multiple single-chip microcomputer is a whole. The work of a single-chip microcomputer is divided into multiple single-chip microcomputer. On the one hand, the performance of the system can be improved, and on the other hand, the hardware design of the system can be simplified.

Asynchronous serial ports are generally used for long-distance transmission, while parallel ports and synchronous serial ports can be used for short-distance transmission. Although the synchronous serial port has a low speed but few signal lines, it is used for low-speed and small-capacity data transmission. The parallel port has a high transmission speed, but many signal lines are used for high-speed and large-capacity data transmission. Based on the common two-way parallel communication and bus interfaces of multiple single-chip microcomputer, this paper proposes a simple multi-host parallel port protocol to achieve high-speed data communication between multiple single-chip microcomputer. This Protocol occupies less signal lines and is easy to operate. 1 multi-host parallel port communication protocol
The multi-host parallel port Protocol defines the data signal and control signal, implements three bus operation modes, and defines the bus operation sequence. Set, A/D, W/R, and D0 ~ D7 contains 11 signal lines. Set is the write control. The host or slave sends the address or data to the bidirectional parallel port D0 ~ D7; w/R indicates read/write control. If w/r = 0, it indicates that the Host reads data from the machine. If w/r = 1, it indicates that the host writes data from the machine; a/D is the address/data selection control. If A/D is set to 0, it indicates data transmission. If A/D is set to 1, it indicates the transfer address. Do ~ D7 is a bidirectional data address bus, which is used with w/R and A/D for bidirectional transmission of addresses and data. Three bus operation modes are implemented through w/R and A/D control signals, as shown in table 1.

2 protocol Single-chip Computer Simulation
When a single-chip microcomputer is used to implement the parallel port protocol, the host operates in the query mode and the slave operates in the interrupt mode. The set signal of the slave must be sent to the External Interrupt pin of the slave. Definition of control bit logical values:
# Defincread o
# Dcfine writ L
# Define data o
# Define ADDR 1 2.1 host Parallel Protocol Program
The signal line of the host's multi-host parallel port uses any one of the single-chip microcomputer's two-way parallel port and any three I/O, and the host actively communicates with the slave in the query mode, reads/writes data from the slave. By calling the delay function delay (), the host and slave can control the SPI transmission speed. The user program only needs to call the ppi_readbuf () and ppi_writbuf () functions to read/write data from the slave machine.

2.2 slave port protocol procedure
A/D and W/R in the signal line of the multi-host parallel port can use any I/O of the single chip microcomputer, Which is do ~ D7 allocates a bidirectional parallel port, but the set must use the int pin. This design uses the into pin. The multi-host parallel port protocol of the slave machine is implemented in the interrupt service program, and the data read/write protocol is implemented with the host in the interrupt process. In this example, the data is stored in the Buf buffer.


Conclusion

The parallel port protocol proposed in this paper realizes the multi-machine communication of single chip microcomputer. This program has been applied in practice. This Protocol can be implemented on a single-chip microcomputer with external interruptions, or it can be used to communicate with a single-chip microcomputer on a cpld. This method is simple, reliable, low-cost, and has high promotion value.

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.