CN103076998A - Method for realizing shared printing of serial printers through RS485 bus - Google Patents

Method for realizing shared printing of serial printers through RS485 bus Download PDF

Info

Publication number
CN103076998A
CN103076998A CN201210582550XA CN201210582550A CN103076998A CN 103076998 A CN103076998 A CN 103076998A CN 201210582550X A CN201210582550X A CN 201210582550XA CN 201210582550 A CN201210582550 A CN 201210582550A CN 103076998 A CN103076998 A CN 103076998A
Authority
CN
China
Prior art keywords
control device
network
protective relay
printing
printer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201210582550XA
Other languages
Chinese (zh)
Other versions
CN103076998B (en
Inventor
桂勇华
潘前华
陈晓
黄小大
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
HNAC Technology Co Ltd
Original Assignee
HNAC Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by HNAC Technology Co Ltd filed Critical HNAC Technology Co Ltd
Priority to CN201210582550.XA priority Critical patent/CN103076998B/en
Publication of CN103076998A publication Critical patent/CN103076998A/en
Application granted granted Critical
Publication of CN103076998B publication Critical patent/CN103076998B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Accessory Devices And Overall Control Thereof (AREA)

Abstract

The invention discloses a method for realizing shared printing of serial printers through an RS485 bus. The method comprises the following steps of: setting a unique node ID (Identity) value for each microcomputer relay protection measure and control device; monitoring whether data are transmitted on a network through the microcomputer relay protection measure and control device, and continuously sending heartbeat messages to the network for N times at a time interval of T3 through the microcomputer relay protection measure and control device if data are not available on the network within a time interval of T2; if the microcomputer relay protection measure and control device fails to receive any datum from the network after N heartbeat messages are sent, obtaining the use right of the network through the microcomputer relay protection measure and control device; and sending printing commands and data to the printer through the microcomputer relay protection measure and control device, and sending heartbeat messages at a time interval of T1. According to the method, the problem of sharing of the serial printers by a plurality of protection measure and control devices under the condition of not increasing any hardware equipment additionally can be solved.

Description

A kind of method that realizes the shared printing of serial printer by the RS485 bus
Technical field
The present invention relates to the Method of printing of printer, relate in particular a kind of method that realizes the shared printing of serial printer by the RS485 bus.
Background technology
The microcomputer protective relay measure and control device all requires configuring print equipment in many application scenarios at present; and the universal printer sharing based on Ethernet; the one, price is more expensive, the 2nd, and is bulky; inconvenient group screen is installed; therefore major applications all is the configuration small volume; the serial printer that price is relatively cheap; but the serial printer function is simple; do not support to share printing function; can only with protection measure and control device configuring print one to one; have what protection measure and control devices will how many platform printers, this obviously causes huge waste.For the problems referred to above; a kind of printing sharing means has appearred; realize that a plurality of protection measure and control devices share a serial printer; each protection measure and control device links to each other with the printing sharing means and communicates; then print by printing sharing means unified driving printer; solve the problem of sharing conflict with this, but this method to increase a new hardware unit and the communication network wiring is complicated.
Summary of the invention
In view of this, the invention provides and a kind ofly realize that by the RS485 bus serial printer shares the method for printing, in the situation that additionally do not increase hardware device, solve the problem that a plurality of protection measure and control devices are shared serial printer to realize.
For solving the problems of the technologies described above, the technical solution used in the present invention is: a kind of method that realizes the shared printing of serial printer by the RS485 bus comprises:
For each microcomputer protective relay measure and control device is set a unique node ID value;
Whether the microcomputer protective relay measure and control device is intercepted has data to send on the RS485 network, if T2 in the time on the described RS485 network without any data, described microcomputer protective relay device sends heartbeat message on described RS485 network, and N continuous time sends heartbeat message in 3 times of every interval T on described RS485 network;
After sending N heartbeat message, if described microcomputer protective relay measure and control device does not receive data from described RS485 network yet, then described microcomputer protective relay measure and control device obtains the right to use of described RS485 network;
The microcomputer protective relay measure and control device sends print command and data to printer, and 1 time of every interval T sends heartbeat message to described RS485 network.
Preferably, send print command and data at described microcomputer protective relay measure and control device to printer, and 1 time of every interval T after sending heartbeat message, described RS485 network comprises also:
After printing was finished, described microcomputer protective relay measure and control device sent the order of abandoning using printer.
Preferably, described T1 is desirable less than the 1/n time value of second, and wherein n is the maximum number of microcomputer protective relay measure and control device described in the network.
Preferably, described T2=node ID * is 1 second.
Preferably, described T3=ID*T1.
Preferably, described N time is three times.
Preferably, described microcomputer protective relay measure and control device is DMP300C1 protection measure and control device.
Preferably, described serial printer is SP-EF32.
Can find out from above-mentioned technical scheme; a kind of method that realizes the shared printing of serial printer by the RS485 bus disclosed by the invention; by being unique node ID value of each microcomputer protective relay measure and control device setting; whether the microcomputer protective relay measure and control device is intercepted has data to send within a period of time on the RS485 network; if the microcomputer protective relay measure and control device does not receive data in the time on one point; then send print command and data to printer, and every certain interval of time sends heartbeat message to the RS485 network.Be a kind of simple, be easy to realize, practical and do not need to increase extra hardware device and can realize that just a plurality of microcomputer protective relay measure and control devices share serial printer.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, the below will do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art, apparently, accompanying drawing in the following describes only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is a kind of system that realizes the shared printing of serial printer by the RS485 bus disclosed by the invention;
Fig. 2 is a kind of method flow diagram of realizing the shared printing of serial printer by the RS485 bus disclosed by the invention;
Fig. 3 is that another kind disclosed by the invention is realized the shared method flow diagram of printing of serial printer by the RS485 bus.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is a part of embodiment of the present invention, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
The embodiment of the invention discloses and a kind ofly realize that by the RS485 bus serial printer shares the method for printing, in the situation that additionally do not increase hardware device, solve the problem that a plurality of protection measure and control devices are shared serial printer to realize.
As shown in Figure 1; be a kind of system that realizes the shared printing of serial printer by the RS485 bus disclosed by the invention; comprise several microcomputer protective relay measure and control devices and a serial printer; described several microcomputer protective relay measure and control devices link to each other with serial printer by the RS485 bus; if serial printer without the RS485 interface, then need to be set up the RS485/RS232 conversion equipment at serial printer.Wherein, the microcomputer protective relay measure and control device is DMP300C1 protection measure and control device, and the model of serial printer is SP-EF32.
As shown in Figure 2, be a kind of method that realizes the shared printing of serial printer by the RS485 bus disclosed by the invention, comprise:
S101, be that each microcomputer protective relay measure and control device is set a unique node ID value;
Whether S102, microcomputer protective relay measure and control device are intercepted has data to send on the RS485 network, if T2 in the time on the described RS485 network without any data, described microcomputer protective relay device sends heartbeat message on described RS485 network, and N continuous time sends heartbeat message in 3 times of every interval T on described RS485 network;
S103, after sending N heartbeat message, if described microcomputer protective relay measure and control device does not receive data from described RS485 network yet, then described microcomputer protective relay measure and control device obtains the right to use of described RS485 network;
S104, microcomputer protective relay measure and control device send print command and data to printer, and 1 time of every interval T sends heartbeat message to described RS485 network.
Concrete, several microcomputer protective relay measure and control devices on the RS485 network are all set a unique node ID value.
Before will printing, arbitrary microcomputer protective relay measure and control device on the RS485 network all must obtain first the right to use of bus network and printer.Have the usufructuary microcomputer protective relay measure and control device of printer and must send heartbeat message on every backward RS485 network of 1 time of interval T; T1 desirable less than the random time value of 1/n second; wherein: n represents the maximum number of microcomputer protective relay measure and control device on the network, and the content of heartbeat message must have no side effect to printer.
It is as follows that the microcomputer protective relay measure and control device obtains the usufructuary method of printer: whether this microcomputer protective relay measure and control device is at first intercepted has data to send on the RS485 network; if T2 in the time on the network without any data; then this device has the right to use of network; and on the RS485 network, send heartbeat message at once, wherein: T2=device node ID * 1 second.Device sends three frame heartbeat messages continuously, 3 times of interval T between per two frames wherein, T3=device node ID * T1, after device whenever sends a frame heartbeat message, intercept immediately network, if do not receive any data from network after sending three frame heartbeat messages, then this device has the right to use of printer, otherwise restarts to intercept network.
After the microcomputer protective relay measure and control device obtains the printer right to use, can send print command and data to printer, when the idle condition of printing, must send the right to use that heartbeat message is kept network.
On the basis of above-described embodiment, as shown in Figure 3, another embodiment of the present invention also discloses a kind of method that realizes the shared printing of serial printer by the RS485 bus, comprising:
S201, be that each microcomputer protective relay measure and control device is set a unique node ID value;
Whether S202, microcomputer protective relay measure and control device are intercepted has data to send on the RS485 network, if T2 in the time on the described RS485 network without any data, described microcomputer protective relay device sends heartbeat message on described RS485 network, and N continuous time sends heartbeat message in 3 times of every interval T on described RS485 network;
S203, after sending N heartbeat message, if described microcomputer protective relay measure and control device does not receive data from described RS485 network yet, then described microcomputer protective relay measure and control device obtains the right to use of described RS485 network;
S204, microcomputer protective relay measure and control device send print command and data to printer, and 1 time of every interval T sends heartbeat message to described RS485 network;
After S205, printing were finished, described microcomputer protective relay measure and control device sent the order of abandoning using printer.
Concrete; on the basis of the description of above-described embodiment, when the microcomputer protective relay measure and control device print finish after, can send and abandon the right to use of initiatively selling printer with printer command; can not send out data any yet, wait for the right to use of other device competition printer.
Each embodiment adopts the mode of going forward one by one to describe in this instructions, and what each embodiment stressed is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.
To the above-mentioned explanation of the disclosed embodiments, make this area professional and technical personnel can realize or use the present invention.Multiple modification to these embodiment will be apparent concerning those skilled in the art, and General Principle as defined herein can be in the situation that do not break away from the spirit or scope of the present invention, in other embodiments realization.Therefore, the present invention will can not be restricted to these embodiment shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.

Claims (9)

1. a method that realizes the shared printing of serial printer by the RS485 bus is characterized in that, comprising:
For each microcomputer protective relay measure and control device is set a unique node ID value;
Whether the microcomputer protective relay measure and control device is intercepted has data to send on the RS485 network, if T2 in the time on the described RS485 network without any data, described microcomputer protective relay device sends heartbeat message on described RS485 network, and N continuous time sends heartbeat message in 3 times of every interval T on described RS485 network;
After sending N heartbeat message, if described microcomputer protective relay measure and control device does not receive data from described RS485 network yet, then described microcomputer protective relay measure and control device obtains the right to use of described RS485 network;
The microcomputer protective relay measure and control device sends print command and data to printer, and 1 time of every interval T sends heartbeat message to described RS485 network.
2. according to claim 1 by the shared method of printing of RS485 bus realization serial printer; it is characterized in that: send print command and data at described microcomputer protective relay measure and control device to printer, and 1 time of every interval T comprises also after described RS485 network sends heartbeat message:
After printing was finished, described microcomputer protective relay measure and control device sent the order of abandoning using printer.
3. according to claim 1 and 2 by the shared method of printing of RS485 bus realization serial printer, it is characterized in that: described T1 is desirable less than the 1/n time value of second, and wherein n is the maximum number of microcomputer protective relay measure and control device described in the network.
4. the method that realizes the shared printing of serial printer by the RS485 bus according to claim 3 is characterized in that: described T2=node ID * 1 second.
5. the method that realizes the shared printing of serial printer by the RS485 bus according to claim 4 is characterized in that: described T3=ID*T1.
6. according to claim 5 by the shared method of printing of RS485 bus realization serial printer, it is characterized in that: described N time is three times.
7. according to claim 6 by the shared method of printing of RS485 bus realization serial printer, it is characterized in that: described microcomputer protective relay measure and control device is DMP300C1 protection measure and control device.
8. according to claim 7 by the shared method of printing of RS485 bus realization serial printer, it is characterized in that: described serial printer is SP-EF32.
9. according to claim 1 by the shared method of printing of RS485 bus realization serial printer, it is characterized in that: the content of described heartbeat message has no side effect to printer, be printer after receiving heartbeat message, any impact can not arranged on follow-up print result.
CN201210582550.XA 2012-12-28 2012-12-28 A kind ofly realize by RS485 bus the method that printing shared by serial printer Active CN103076998B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210582550.XA CN103076998B (en) 2012-12-28 2012-12-28 A kind ofly realize by RS485 bus the method that printing shared by serial printer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210582550.XA CN103076998B (en) 2012-12-28 2012-12-28 A kind ofly realize by RS485 bus the method that printing shared by serial printer

Publications (2)

Publication Number Publication Date
CN103076998A true CN103076998A (en) 2013-05-01
CN103076998B CN103076998B (en) 2015-11-18

Family

ID=48153537

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210582550.XA Active CN103076998B (en) 2012-12-28 2012-12-28 A kind ofly realize by RS485 bus the method that printing shared by serial printer

Country Status (1)

Country Link
CN (1) CN103076998B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050071746A1 (en) * 2003-09-25 2005-03-31 Hart Peter E. Networked printer with hardware and software interfaces for peripheral devices
CN102566949A (en) * 2012-01-05 2012-07-11 石家庄科林电气股份有限公司 Shared printing method of printers for intelligent devices in transformer substation
CN102724065A (en) * 2012-05-22 2012-10-10 长沙中联消防机械有限公司 Network communication system and engineering mechanical equipment comprising same

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050071746A1 (en) * 2003-09-25 2005-03-31 Hart Peter E. Networked printer with hardware and software interfaces for peripheral devices
CN102566949A (en) * 2012-01-05 2012-07-11 石家庄科林电气股份有限公司 Shared printing method of printers for intelligent devices in transformer substation
CN102724065A (en) * 2012-05-22 2012-10-10 长沙中联消防机械有限公司 Network communication system and engineering mechanical equipment comprising same

Also Published As

Publication number Publication date
CN103076998B (en) 2015-11-18

Similar Documents

Publication Publication Date Title
CN102801551B (en) Open systems and the corresponding interfaces for automotive electronics (OSEK) network management-based controller area network (CAN) management method
JP2013520944A5 (en)
CN104243265A (en) Gateway control method, device and system based on virtual machine migration
CN103312528A (en) Heartbeat message sending method and user terminal
CN107104867A (en) The communication means and master-slave system of master-slave system
CN105119793A (en) Identifier distribution method of sensor network CAN bus frame format
CN104038570B (en) A kind of data processing method and device
WO2014130412A3 (en) Signaling method for handling of desynchronized default bearer context of the last remaining pdn connection
CN103914007A (en) Method and system for reprogramming
KR101380118B1 (en) Ethernet network for vehicles and vehicles using the same
CN107360012B (en) Link state processing method and network node equipment
CN110233750B (en) Private cloud management system and method
CN102349271B (en) Multicast protocol message monitoring method, device and switch
CN102984082A (en) Network service quality control method and device
CN103957272A (en) Method for achieving interconnection and interaction control between devices of Internet of Things
CN108923882A (en) Point-to-point Communication Method, computer readable storage medium and master and slave node device
CN103476058A (en) Data communication method and device in ZIGBEE network
CN105530157A (en) Method for sharing credit by multiple virtual links in AFDX (Avionics Full Duplex Switched Ethernet) network switch
CN103076998B (en) A kind ofly realize by RS485 bus the method that printing shared by serial printer
WO2016028279A1 (en) Cloud services activation for a printing device
CN107454208A (en) A kind of is the method that network address is distributed from node device
CN101577732B (en) Multi-node communication link and asynchronous serial communication method thereof
CN104935614A (en) Data transmission method and device thereof
EP3148209B1 (en) Data processing method and apparatus
CN106937240A (en) A kind of method and apparatus for obtaining resource

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant