Summary of the invention
The technical problem to be solved in the present invention is the communication capacity that how to strengthen terminal device, promptly how to realize between the terminal and the radio communication between terminal and the miscellaneous equipment, the communication mode and the specific communication protocol that specifically will provide a kind of suitable terminal device to use, provide and to carry out the portable pda terminal of wireless data exchange to each other or with external unit, this terminal can directly be carried out wireless connection communication with communication object, realizes the real time data message exchange.
The above-mentioned technical matters of the present invention solves like this, construct a kind of portable terminal of realizing message exchange by wireless communication protocol, the portable terminal module that memory storage, display device and a human-computer interaction device that comprises microprocessor, is connected with described microprocessor is arranged, it is characterized in that, also comprise a wireless communication module that adopts ISM band and FSK modulating/demodulating mode, described wireless communication module is connected with described microprocessor communication port, and communicates in RS232 standard serial port mode.
In according to portable terminal provided by the invention, described portable terminal module can be electronic notebook, electronic dictionary, palm PC, and described memory storage can be FLASH storer, ROM or SRAM storer.
In according to portable terminal provided by the invention, signal link comprises power lead VCC and VSS, look-at-me line INT1 and WAKEUP line, command channel line PC2-SDATA, PC1-SCK and PC0-SLE, data line RX/TX-DATAMSG and data clock line PC3-DATACLK between described communication port and the described wireless communication module.
In according to portable terminal provided by the invention, after receiving radiofrequency signal, described wireless communication module notifies described microprocessor by look-at-me line WAKEUP, read digital signal after the demodulation by described microprocessor by the send buffer of data line DATAMSG from be included in described wireless communication module, when described microprocessor has data to send, the data that needs send are delivered to the transmission buffer zone that is included in the described wireless communication module and started timed sending by signal wire TX, and the communications command between described microprocessor and the described wireless communication module is by described signal wire SLE, SCK, SDATA transmits.
In according to portable terminal provided by the invention, the Transmission bit rate of described RS232 standard serial port mode is 19200,8 bit data, no parity check position, 1 position of rest.
In according to portable terminal provided by the invention, the communication protocol data packet format that described wireless communication module adopts comprises the guiding byte of 1 byte, the beginning label of 2 bytes, the data segment of 30 bytes and the end mark of 1 byte.
In according to portable terminal provided by the invention, the data segment of described 30 bytes comprise transmit leg ID, 20 bytes of take over party ID, 3 bytes of packet id field, 3 bytes of type field, 1 byte of 1 byte of representing packet valid data section, 2 bytes with the verification section.
Implement the mobile terminal device by the radio communication exchange data information provided by the invention, owing to realizing that the communication of longer communication distance has broad application prospects with lower cost, carry out radio communication by ISM band, reach between the machine one to one, the data communication of one-to-many or multi-to-multi, function such as finish that wireless game, swap date, wireless network are closely chatted.
Embodiment
The present invention comprises two aspects: communication mode and communication protocol.By these two kinds of technology are embedded into any portable terminal, can constitute various, distinguished portable terminal product.Wherein, communication mode is to use general in the world ISM band, adopts FSK modulation and demodulation technology, and the sending and receiving function of data is integrated on the chip, its biggest advantage is need not be to Wireless Management Committee application frequency range, at the bottom of the power consumption, radiation is little, integrated level is high.Communication protocol then is custom protocol, has simple, reliable and certain characteristics of maintaining secrecy.If adopt existing communication protocol, must there be the unfavorable factor of agreement complexity, coding difficulty and the very expensive testing tool of needs.
As shown in Figure 1, include LCD LCD 2 and human-computer interaction interface unit 4 according to the mobile terminal device by the radio communication exchange data information provided by the invention, this human-computer interaction interface unit 4 can be button or touch-screen, power supply power supply unit 5 is not only given the power supply of portable terminal end parts, and returns wireless communication module 7 power supplies by power lead 10; Main Control Unit 1 can carry out display driver for LCD unit 2, also can receive the information from human-computer interaction interface unit 4, and MCU unit 1 also is connected with storer 3, and it can be FLASH storer, ROM or SRAM storer.
The present invention is the improvement of conventional portable terminal, increases wireless communication module 7, and Main Control Unit 1 comes the supervisory communications process by communication interface 6 and order wire 9.Order and data that wireless communication module 7 receives from Main Control Unit 1, and modulation, the amplification of the data that will send by FSK, send in the air via antenna 8; Wireless communication module 7 receptions simultaneously are from the wireless signal of antenna 8, through the radio frequency of this wireless communication module 7 amplify, the mixing of superhet, again pass through the intermediate frequency filtering (10.7Mhz and 455KHz) of two-stage, then to the fsk signal demodulation, the digital signal that obtains is by interrupt mode notice Main Control Unit 1, at last, Main Control Unit 1 reads back data to come and is stored in by communication interface 6 and order wire 9 from the impact damper of wireless communication module 7 accepts buffer zone, handles for the master routine of Main Control Unit 1.
As shown in Figure 2, the order wire 9 that links to each other with wireless communication module 7 of the communication interface 6 in the portable terminal end parts is by 8 lines.Wherein there are two to be power lead VCC (positive source) and VSS (power cathode); A look-at-me line INT1, when wireless communication module 7 receives data, WAKEUP wakes Main Control Unit 1 up by its look-at-me line, make it receive data as early as possible, use signal wire WAKEUP that two benefits are arranged: the one, whether Main Control Unit 1 need not at every moment be inquired about wireless communication module 7 data, improves the efficient of Main Control Unit 1.Two are to use interrupt mode to reduce the power consumption of portable terminal greatly; Datamsg in the wireless communication module 7 is a data line, when sending data, Main Control Unit 1 data are sent to wireless communication module 7 with predefined traffic rate by the TX signal wire, when receiving data, Main Control Unit 1 receives data in conjunction with RX and PC3 line; Command communication between Main Control Unit 1 and the wireless communication module 7 is that three signal wire SLE, SCK, the SDATA by wireless communication module 7 realizes, SLE is the enable signal line of wireless communication module 7, SCK is a clock cable, and SDATA used data line during for exchange command between the two.
In the circuit theory diagrams of the present invention shown in Fig. 3 by the mobile terminal device of radio communication exchange data information, wireless communication module (U1), CPU (U11), the LCD MODULE that is connected with CPU, memory module and human-computer interaction module are arranged, and the power supply unit of giving above each module for power supply.The on line of wireless communication module and terminal module illustrates in Fig. 2.
The communication protocol that the present invention is adopted is described as follows below:
Communication employing standard 232 serial ports, baud rate 19200,8 bit data, no parity check position, 1 position of rest.Reception information is used interrupt mode, as shown in Figure 5, judge have do not receive data (frame 501), if any then will receiving data storage to buffer zone, and pointer add 1 (frame 502) the data storage that receives in send buffer, return (frame 503); And transmission information adopts timer interrupt mode.The task of master routine as shown in Figure 4 then is to detect send buffer earlier whether a complete packet information (frame 404) is arranged, if any then handling this packet (frame 404) earlier; Otherwise other incidents of this machine of processing (frame 403), in case this machine has the data (frame 406) that will send, at first data storage in sending the data buffer (frame 407), start timer then, carry out data and send.Comprise that between this common process is as powering on, reset (frame 401) and hardware initialization (frame 402), the timing interruption subroutine flow process of transmission data as shown in Figure 6, comprise and judge have the data of denying to send (frame 601), subtract 1 (frame 602), return (frame 603) at last if any sending 1 byte data and pointer.
The communication protocol data packet format as shown in Figure 7.Wherein:
1. guide byte (0xA5)
Starting the RF receiver module, all is standard 232 because our system sends reception, is to be unit with the byte, so need 1 BYTE..
Opening flag (0xAA, 0x55)
Data opening flag byte.Be used for when receiving, filtering mixed and disorderly signal.
3, end mark (0x16)
Represent that this packet finishes.
4, data (30BYTE) data division form as shown in Figure 8.
1. type (1 byte) is used to represent the type of packet.Data have two classes: packets of information, response packet.
2. packet ID (1 byte), because the valid data of each packet i.e. 10 Chinese character informations of 20 bytes only, a lot of information all need to split into a plurality of bags and send.The total data bag number of high 4 these information of bit representation of this field, low which packet of 4 bit representations.
If response packet:
Low 4 bit representations of this field: packet ID.
High 4: 0000 expression receives OK
1111 request repeats.
3. take over party ID (1 byte) can be a sequence number, from 000000~0xFFFFFF, can represent more than 1,670 ten thousand different identity.Take over party ID can be public ID.
4. transmit leg ID (1 byte) can be a sequence number, from 000000~0xFFFFFF, can represent more than 1,670 ten thousand different identity.
5. valid data (20 byte), certain one piece of data of certain bar information.(response packet is this field not)
6. and verification, comprise the data sum of each byte, for example, before each byte data sum from " type " byte to " and verification ".