[go: up one dir, main page]

CN101345681B - Operation method for connecting main unit of intelligent electric appliance through serial bus - Google Patents

Operation method for connecting main unit of intelligent electric appliance through serial bus Download PDF

Info

Publication number
CN101345681B
CN101345681B CN200810120125A CN200810120125A CN101345681B CN 101345681 B CN101345681 B CN 101345681B CN 200810120125 A CN200810120125 A CN 200810120125A CN 200810120125 A CN200810120125 A CN 200810120125A CN 101345681 B CN101345681 B CN 101345681B
Authority
CN
China
Prior art keywords
packet
host
data
module
endpoint
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.)
Active
Application number
CN200810120125A
Other languages
Chinese (zh)
Other versions
CN101345681A (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.)
Jiangsu Daosheng Energy Technology Co.,Ltd.
Original Assignee
PEOPLE ELECTRICAL APPLIANCES GROUP 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 PEOPLE ELECTRICAL APPLIANCES GROUP CO Ltd filed Critical PEOPLE ELECTRICAL APPLIANCES GROUP CO Ltd
Priority to CN200810120125A priority Critical patent/CN101345681B/en
Publication of CN101345681A publication Critical patent/CN101345681A/en
Application granted granted Critical
Publication of CN101345681B publication Critical patent/CN101345681B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

本发明涉及一种通过串行总线连接智能电器的主机的工作方法。该系统包括:主机通过RS-485总线连接有至少1个智能电器;主机包括:主模块、巡呼模块、包处理模块、包发送模块、包接收模块、字节发送模块和字节接收模块;主模块用于初始化主机的通讯端口、初始化总线、巡呼各个端点、绘制网络拓扑图并显示参数;巡呼模块用于对各从端点进行巡回查看;包处理模块用于完成主机与各端点之间的数据交换;包发送模块用于发送131个字节的数据;包接收模块用于接收131个字节数据,接收完毕后进行CRC校验,不正确时发送不确认握手信号,要求端点重发数据,主机重新接收。

Figure 200810120125

The invention relates to a working method for connecting a host computer of an intelligent electrical appliance through a serial bus. The system includes: the host is connected to at least one smart appliance through the RS-485 bus; the host includes: a main module, a patrol module, a packet processing module, a packet sending module, a packet receiving module, a byte sending module and a byte receiving module; The main module is used to initialize the communication port of the host, initialize the bus, patrol each endpoint, draw a network topology map and display parameters; the patrol module is used to check each slave endpoint; the packet processing module is used to complete the communication between the host and each endpoint. The data exchange between; the packet sending module is used to send 131 bytes of data; the packet receiving module is used to receive 131 bytes of data, after the reception is completed, the CRC check is performed, and if it is incorrect, it sends a non-confirmation handshake signal, requiring the endpoint to re-check Send data, the host receives again.

Figure 200810120125

Description

The method of work of the main frame through universal serial bus connection of intelligent electrical equipment
Technical field
The present invention relates to a kind of method of work of passing through the main frame of universal serial bus connection of intelligent electrical equipment.
Background technology
In the prior art, intelligent electric appliance is linked to each other with main frame, have multiple mode.For example, adopt USB interface.The deficiency of this mode is that the data transmission distance of USB interface is a 1-2 rice, can't satisfy the demand of practical application.Simultaneously, the plug-in USB device number of USB interface often has only several, and this has influenced user's use.
Chinese patent document publication number CN2566355 discloses a kind of serial management bus interface module that is applied in the series bus integrated type NMS; It includes a standard 485 chips, is serially connected with two protective resistances at the drive end of said standard 485 chips.Use its serial management bus interface module, under the situation about in being not more than 8 scope, changing regardless of the loadtype at the terminal of network, number of loads, can guarantee the communication robust, reliable between system equipment.
Carry out the technical barrier of data communication function between the unresolved master of said prior art, the intelligent electric appliance through the interface specification of RS-485.
Summary of the invention
Technical problem to be solved by this invention provide a kind of through the RS-485 interface in the method for work of leading, realize between the intelligent electric appliance main frame that passes through universal serial bus connection of intelligent electrical equipment of serial bus communication.
For solving the problems of the technologies described above, the invention provides a kind of method of work of passing through the main frame of universal serial bus connection of intelligent electrical equipment, main frame is connected with at least 1 intelligent electric appliance through the RS-485 bus; 1 intelligent electric appliance constitutes an end points; Main frame comprises: primary module, be used for patrolling the packet handing module of exhaling module, being used to accomplish the data exchanging function between main frame and the intelligent electric appliance, the bag sending module that is used to send data, the bag receiver module that is used to receive data, byte sending module and byte receiver module to what each end points went the rounds to check; Primary module be used for initializes host PORT COM, initialization bus, patrol and exhale each end points, draw network topological diagram and display parameters; Patrol and exhale module to be used for respectively going the rounds to check from end points; Packet handing module is used to accomplish the exchanges data between main frame and each end points, and the packet of handling during its exchanges data comprises: parameter bag, configuration packet, controlling packet, token packet, path are cancelled bag; The bag sending module is used to send the data of 131 bytes, after transmission finishes, waits for the handshake that receives end points, and when not confirming, main frame is with retransmission data; The bag receiver module is used to receive 131 byte datas, receives the laggard capable CRC check that finishes, and sends when incorrect and does not confirm handshake, requires the end points retransmission data, and main frame receives again; Comprise overtime judgement in byte sending module and the byte receiver module, be provided with when overtime the sign and return.
Comprise an equipment connection table in the said main frame, it is corresponding with said each endpoint number that this equipment connects table; Said patrolling exhales module to the process of respectively going the rounds to check from end points to be: at first confirm an endpoint number, call packet handing module then, send token packet, when the handshake packet of affirmation is arranged, an intelligent electric appliance is arranged on the corresponding endpoint then; Then, main frame is checked the equipment connection table of this end points, if corresponding equipment connects when showing to sky, judges that then it is the intelligent electric appliance that newly is connected on the bus; Main frame sends packet, requires this intelligent electric appliance to transmit its configuration information; After main frame receives the valid data from this intelligent electric appliance, fill in the said equipment connection of end points table; If it is not empty that corresponding equipment connects table, judge that then the device category that connects on this end points is known, and by the state of intelligent electric appliance transmission own, circuit parameter on this end points, or send Control Parameter; If no response after the main frame transmission token packet, or the parameter that receives is invalid, thinks that all this end points does not have equipment, empties endpoint device connection table.
This intelligent electric appliance serial bus communication system comprises: main frame and at least 1 intelligent electric appliance; Link to each other through the RS-485 bus between main frame and the intelligent electric appliance; Main frame all has unique endpoint number with each intelligent electric appliance, after main frame searches an intelligent electric appliance, sets up a data communication channel with it; Then, main frame and intelligent electric appliance send packet each other, and when intelligent electric appliance received correct data, intelligent electric appliance sends to main frame confirmed handshake packet; When intelligent electric appliance received misdata, intelligent electric appliance sends to main frame did not confirm handshake packet, and main frame resends a last packet to this intelligent electric appliance; When main frame received correct data, main frame sends to intelligent electric appliance confirmed handshake packet; When main frame received misdata, main frame sends to intelligent electric appliance did not confirm handshake packet, and this intelligent electric appliance resends a last packet to main frame; Cancel when bag when main frame sends a path to intelligent electric appliance, the said data communication channel between main frame and the intelligent electric appliance is cancelled.
When said main frame was searched for intelligent electric appliance, main frame sent token packet through the RS-485 bus earlier; The intelligent electric appliance that is connected on the RS-485 bus receives this token packet, beams back the affirmation handshake packet to main frame through the RS-485 bus then, sets up a data communication channel between main frame and the intelligent electric appliance thereby make.
Said packet comprises: cyclic redundancy check field; Main frame and intelligent electric appliance judge that according to this cyclic redundancy check field the said packet that receives is misdata or correct data.
The present invention has positive effect: (1) intelligent electric appliance serial bus IASB of the present invention (Intellect Apparatus Serial Bus) is a kind of data/address bus cheaply for the intelligent electric appliance data transmission scheme; In the intelligent electric appliance serial bus communication system of the present invention, the method for work of main frame and intelligent electric appliance is suitable for realizing that the interface specification through RS-485 carries out data communication between main frame and the intelligent electric appliance.The intelligent electric appliance serial bus communication system adopts the RS-485 bus, and its interface is a general-purpose interface, and an interface is applicable to the electrical equipment of different model.Need not prepare different interface and agreement for different electrical equipment.Secondly, it has automatic identification and configuration feature.When the user is connected to intelligent electric appliance serial bus with electrical equipment, if when computer is in running status, computer can be discerned the type that inserts electrical equipment automatically, and loads the corresponding driving program, realizes data communication function.The RS-485 standard adopts twisted-pair feeder conveniently to connect.Computer cabinet need do not opened, for each peripheral hardware increases expansion card.Once more, it supports hot plug.Electrical equipment be can at any time connect and break off, and, computer and external electrical equipment can not damaged no matter whether computer system starts shooting.After electrical equipment inserted, computer system can detect the electrical equipment of access.Its transmission speed reaches 100Kb/s, and to compare data transmission bauds fast with RS-232, can satisfy the requirement of general power distribution system data communication speed.(2) in the intelligent electric appliance serial bus communication system of the present invention, directly adopt pay station line, can save human and material resources and financial resources in a large number as holding wire, and easy to install.
Description of drawings
Fig. 1 is the structural representation of intelligent electric appliance serial bus communication system of the present invention.
Fig. 2 is the circuit diagram of the physical interface of intelligent electric appliance serial bus communication system of the present invention.
Fig. 3 is another distortion of the structure of intelligent electric appliance serial bus communication system of the present invention.
Fig. 4 is the sketch map that calls of the intelligent electric appliance of intelligent electric appliance serial bus communication system.
Fig. 5 is the main program block diagram of above-mentioned intelligent electric appliance.
Fig. 6 is the flow chart of the data reception module of above-mentioned intelligent electric appliance.
Fig. 7 is the flow chart of the processing data packets module of above-mentioned intelligent electric appliance.
Fig. 8 is the flow chart of the packet sending module of above-mentioned intelligent electric appliance.
Fig. 9 is the flow chart of the byte sending module of above-mentioned intelligent electric appliance.
Figure 10 is the sketch map that calls of the main frame of intelligent electric appliance serial bus communication system.
Figure 11 is the main program block diagram of above-mentioned main frame.
Figure 12 exhales flow chart for patrolling of above-mentioned main frame.
Figure 13 is the packet handler block diagram of above-mentioned main frame.
Figure 14 is the packet sending module flow chart of above-mentioned main frame.
Figure 15 is the packet receiver module flow chart of above-mentioned main frame.
Figure 16 is the byte sending module flow chart of above-mentioned main frame.
Figure 17 is the byte receiver module flow chart of above-mentioned main frame.
Embodiment
(embodiment 1)
See Fig. 1, the intelligent electric appliance serial bus communication system of present embodiment comprises: main frame 1 (being computer) and 3 (can be the arbitrary value in 1-30 among other embodiment) intelligent electric appliances 3; Link to each other through RS-485 bus 2 between main frame 1 and the intelligent electric appliance 3.Spacing between main frame 1 and the intelligent electric appliance 3 is less than 1200 meters.Said main frame 1 comprises with intelligent electric appliance 3: central processing unit and the RS-485 interface that links to each other with this central processing unit.Main frame 1 can be a computer with intelligent electric appliance 3, also can be the multi-functional smart machine that photocopier, communication apparatus etc. have single-chip microcomputer or flush bonding processor of beating.
See Fig. 3,, be provided with repeater 4 between main frame 1 and the intelligent electric appliance 3 for prolonging communication distance.For increasing the quantity of the intelligent electric appliance 3 that connects on the RS-485 bus 2, intelligent electric appliance 3 links to each other with hub 5 through RS-485 bus 2, and hub 5 links to each other with main frame 1 through RS-485 bus 2.Be provided with repeater 4 between hub 5 and the main frame 1.Be provided with repeater 4 between intelligent electric appliance 3 and the hub 5.
See Fig. 2, the physical interface of intelligent electric appliance serial bus comprises: balance driver 10 and differential receiver 30; Balance driver 10 has pair of output, and differential receiver 30 has a pair of input, links to each other through holding wire 20 respectively between a pair of input of the pair of output of balance driver 10 and differential receiver 30.
Said balance driver 10 has data input pin.Said differential receiver 30 has data output end.Balance driver 10 will be transformed into potential difference signal from the logic level signal of data input pin, and a pair of holding wire 20 that is linked to each other by the pair of output with balance driver 10 carries out the signal transmission; Differential receiver 30 is transformed to logic level signal with one of which to the potential difference signal that input received, and from its data output end output, thereby realizes the transmission and the reception of data.
When presentation logic " 1 ", a signal line is exported positive high level, the negative high level of another signal line output; When presentation logic " 0 ", the opposite states of this two signal line.Receiver is judged the potential difference of this two signal line, confirms logic " 1 " and logic " 0 ".The minimum voltage that differential receiver 30 can be differentiated is ± 200mV.This transmission and accepting method are called as balance and drive differential received.
Said balance driver 10 has the level reference edge that is connected with each other with differential receiver 30.
With respect to the level reference edge, the output of balance driver 10 is respectively+V T,-V T, the input V of differential receiver 30 then RVoltage: V R=+V T-(V T)=2V T
The pair of output of balance driver 10 can weaken the influence of interference not altogether, can obtain longer transmission range again, allows bigger signal attenuation.
The transmission rate maximum of the physical interface of the intelligent electric appliance serial bus of present embodiment can reach 10Mb/s, and when transmission rate was 10Mb/s, transmission range was 12m; When transmission rate was 1Mb/s, transmission range was 120m; When transmission rate was 100Kb/s, transmission range can reach 1200m.
Balance driver 10 can drive 32 load equipments.Load equipment can be passive balance driver or differential receiver.
Among other embodiment, said holding wire 20 is a pay station line, and is provided with terminal resistance R between two leads of pay station line.Directly adopt pay station line as holding wire, can save human and material resources and financial resources in a large number, and easy to install.
Comprise the DIP switch that is used to be provided with its endpoint number on the intelligent electric appliance 3, main frame 1 all has unique endpoint number with each intelligent electric appliance 3, after main frame 1 searches an intelligent electric appliance 3, sets up a data communication channel with it; Then, main frame 1 sends packet each other with intelligent electric appliance 3, and when intelligent electric appliance 3 received correct data, intelligent electric appliance 3 sends to main frame 1 confirmed handshake packet; When intelligent electric appliance 3 received misdata, intelligent electric appliance 3 sends to main frame 1 did not confirm handshake packet, and main frame 1 resends a last packet to this intelligent electric appliance 3; When main frame 1 received correct data, main frame 1 sends to intelligent electric appliance 3 confirmed handshake packet; When main frame 1 received misdata, main frame 1 sends to intelligent electric appliance 3 did not confirm handshake packet, and this intelligent electric appliance 3 resends a last packet to main frame 1; When main frame 1 when intelligent electric appliance 3 sends a path and cancels bag, the said data communication channel between main frame 1 and the intelligent electric appliance 3 is cancelled.
When said main frame 1 was searched for intelligent electric appliance 3, main frame 1 sent token packet through RS-485 bus 2 earlier; The intelligent electric appliance 3 that is connected on the RS-485 bus 2 receives this token packet, beams back through RS-485 bus 2 then and confirms handshake packet to main frame 1, sets up a data communication channel thereby make between main frame 1 and the intelligent electric appliance 3.
Said packet comprises: the data field and the cyclic redundancy check field of bag identification field, address field, 128 bytes; Main frame 1 judges that according to this cyclic redundancy check field the said packet that receives is misdata or correct data with intelligent electric appliance 3.
Comprise an equipment connection table in the said main frame 1, it is corresponding with each endpoint number that this equipment connects table; Main frame 1 sends token packet to an endpoint number, if in Preset Time, do not receive corresponding affirmation handshake packet, then main frame 1 is confirmed not have intelligent electric appliance 3 on this endpoint number, is the dead end point, is recorded as sky accordingly on this equipment connection table; If in Preset Time, receive corresponding affirmation handshake packet; Then main frame 1 is confirmed to have intelligent electric appliance 3 on this endpoint number, is the non-NULL end points, makes corresponding record on this equipment connection table; Read its product marking then; With identification production firm and product category, fill in equipment connection table, and the corresponding driving program is installed.
The 1 pair of non-NULL end points of main frame sends token packet, and after when obtaining confirming handshake packet, sends the direction that packet comes specified data to transmit again; When said packet was the input packet, intelligent electric appliance 3 began to receive data after sending and confirming handshake packet; When said packet was the dateout bag, intelligent electric appliance 3 began to send data after sending and confirming handshake packet.
After 1 pair of non-NULL end points of main frame sends token packet, in Preset Time, do not obtain confirming handshake packet, main frame 1 confirms that the intelligent electric appliance 3 on this endpoint number breaks off, and this moment, main frame 1 emptied corresponding record on the said equipment connection table; When main frame 1 after an endpoint number is sent packet, if in Preset Time, do not obtain confirming handshake packet, main frame 1 confirms that the intelligent electric appliance 3 on this endpoint number breaks off, this moment, main frame 1 emptied corresponding record on the said equipment connection table; When main frame 1 is being accepted the packet from the intelligent electric appliance on the endpoint number 3, in Preset Time, can not receive next byte, main frame 1 confirms that this intelligent electric appliance 3 breaks off, this moment, main frame 1 emptied corresponding record on the said equipment connection table.
Main frame 1 is after the data communication of the intelligent electric appliance 3 on a completion and the endpoint number, and main frame 1 transmission path is cancelled bag to this intelligent electric appliance 3, and disconnection and its data communication channel.
Said main frame 1 all comprises with intelligent electric appliance 3: central processing unit, RS-485 interface and signal procedure, the RS-485 interface comprises data buffer.
See Fig. 4, the signal procedure of intelligent electric appliance 3 comprises: data reception module 12, processing data packets module 13, packet sending module 14 and the byte sending module 15 of main mould communication piece 11, interrupt mode; Main mould communication piece 11, processing data packets module 13, packet sending module 14 and step-by-step mode constitute call relation successively to the byte sending module 15 that intelligent electric appliance serial bus sends data; For the interrupt call relation, be call relation between data reception module 12 and the processing data packets module 13 between main mould communication piece 11 and the data reception module 12; Byte sending module 15 judges that whether said data buffer is empty, if empty, then sends, otherwise waits for before sending data.
See Fig. 5, after the central processing unit in the intelligent electric appliance 3 powers on, shielded communication interface at first, its all of the port of beginningization, memory block, timer and interrupt service routine.Afterwards, allow communication interface work.This process has been guaranteed the interruption that the correct response data communication of central processing unit produces.
See Fig. 6, Data Receiving adopts interrupt mode, and this program is an interrupt service routine.
Microprocessor has serial line interface, through the docking port initialization, the working method of interface can be set.A kind of working method is, when the data back one (the 9th) that receive just produce interruption when being 1; Another kind of working method is, no matter the 9th is 0 or 1, as long as there are data all to produce interruption.
Token packet is utilized these characteristics just.Interface at first is set, makes that sending data back one (the 9th) is at 1 o'clock, just produce the working method of interrupting.The 9th of token packet is set to 1, and when sending token packet, microprocessor linked all produces interruption on all end points.Having only the end points identical with own address to change the working method of interface, is 0 or 1 no matter form the 9th, as long as there are data all to produce interrupt function, is referred to as the data-interface state.The working method of other end points is constant.It is non-1 to send the 9th of information with aft engine 1 like this, therefore, has only this end points to receive.Other end points does not respond.Formed a data pipe between main frame 1 and the end points (i.e. intelligent electric appliance 3 on the endpoint number) like this.
After the data communication between main frame 1 and the end points was accomplished, main frame 1 transmission path was cancelled bag, and the microprocessor on this end points changes the working method of interface, cancels data pipe.
When interface receives information, produce and interrupt, microprocessor just can conclude it is data through judging the state of interface, and still bag is a token packet, or the bag of other type.If token packet and identical with end-point addresses just changes interface and becomes data-interface.If this end points is the Data Receiving interface,, just can conclude the type of bag through judge receiving first byte of bag---confirm bag, do not confirm to wrap, path cancels bag, packet.
Different data are surrounded by different processing methods, confirm bag, do not confirm that bag is provided with corresponding sign; Cancel when bag when receiving path, microprocessor changes Interface status, becomes non-data-interface; When receiving packet, when receiving 131 bytes, be provided with and receive packet sign and bag processing sign, when main program detects bag processing sign, call packet handler.
See Fig. 7, this program mainly realizes receiving main frame 1 and sends the information processing program.The total three major types of bag that end points receives from main frame 1:
1) packet class
Packet is divided into 8 kinds of forms again, and each byte has clear and definite definition (the data stipulations of IASB bus are seen in concrete definition) in every kind of form.After receiving packet, at first carry out CRC check, when incorrect, send and do not confirm bag, requesting host 1 resends; When correct, send and confirm bag, and carry out the fractionation of packet, or the group bag sends according to the data type of input, output.
2) handshake packet class
Handshake packet is divided into to be confirmed handshake packet and not to confirm handshake packet.When end points after main frame 1 sends packet, main frame 1 just sends the bag of this type to end points.Confirm handshake packet, explain that the data that end points sends are correctly received by main frame 1.The affirmation handshake packet is handled in the Data Receiving program; Do not confirm handshake packet, explain that data host 1 reception of end points transmission is incorrect, at this moment, end points should resend data.For fear of sending data repeatedly, cause intelligent electric appliance 3 microprocessor deadlock phenomenons, be provided with retransmission counter here, when retransmitting number of times above a certain limit, end points stops retransmit operation.
3) path is cancelled bag
Path is cancelled bag, and after main frame 1 finished with endpoint communication, main frame 1 was cancelled the bag of communication data pipeline.Path is cancelled bag and in the Data Receiving program, is handled.
See Fig. 8, the information router is divided into two levels, bag router and byte router.What the former realized is the sending function towards bag; What the latter realized is will wrap by the byte sending function.
After calling bag transmission journey, at first differentiate the type of the packets of information that will send.The type decided of packets of information the byte number that will send.According to the communication protocol of IASB, handshake packet is 1 byte, and packet is 131 bytes.At this moment, send one by one in order and get final product.
There are many situation can produce end points and send overtime mistake.For simplified process method, when time-out error occurring, end points will change the data receiving state of COM1, and disconnection is connected with main frame 1.If general mistake, during call endpoints, will once more set up once more by connection for main frame 1.Can not bring serious consequence.
See Fig. 9, the byte router, the main peace that realizes is sent the function of data to the IASB bus according to the position mode.Before sending data, judge whether transmission buffer is empty in the serial line interface, for sky then sends, otherwise waits for.
Cause the deadlock phenomenon for fear of makeing mistakes, added the wait timeout judgement in this program.The method that realizes is that transmission buffer of every judgement adds 1 for the chronoscope counting unit.When this unit numerical value exceeds certain limit, think overtime makeing mistakes.
Overtime reason is a lot, and one of them is because end points and bus are broken off, and causes NULI character in the transmission buffer, if do not handle, can cause the microprocessor of intelligent electric appliance 3 to crash.For avoiding the generation of this phenomenon, adopted the method for end points active with main frame 1 disconnection path.If not because bus failure, but that accidental cause causes is overtime, and processing method can cause main frame 1 to think that end points is the result of sky like this.But main frame 1 during the paging end points, promptly can recover to connect next time, can not cause serious consequence.
See Figure 10, the communication program of main frame 1 comprises: primary module 21, be used for patrolling the packet handing module 23 of exhaling module 22, being used to accomplish the data exchanging function between main frame 1 and the intelligent electric appliance 3, the bag sending module 24 that is used to send data, the bag receiver module 25 that is used to receive data, byte sending module 26 and byte receiver module 27 to what each end points went the rounds to check; Primary module 21, patrol and exhale module 22 and packet handing module 23 to constitute call relation packet handing module 23 successively to constitute call relations with bag sending module 24, bag receiver module 25, byte sending module 26 and byte receiver module 27 respectively; Bag sending module 24 constitutes call relation with byte sending module 26 and byte receiver module 27 respectively, and bag receiver module 25 constitutes call relation with byte sending module 26 and byte receiver module 27 respectively.
See Figure 11, the function of primary module 21 comprises, initialization PORT COM, initialization bus, patrols and exhales each end points, draws functions such as network topological diagram, display parameters.
See Figure 12, patrol and exhale the function of module 22 to be: go the rounds to check from end points 1 to 30.Detailed process is: at first confirmed an endpoint number, called packet handler then, sent token packet, had on when the affirmation explanation end points intelligent electric appliance 3 is arranged.At this moment, check endpoint device connection table, when this table was empty, then explanation was the intelligent electric appliance 3 that newly is connected on the bus.Main frame 1 sends packet, and requiring endpoint device is that intelligent electric appliance 3 transmits its configuration information.After main frame 1 receives the valid data from this intelligent electric appliance 3, fill in the said equipment connection of end points table.It is not empty that equipment connects table, explain that the device category that connects on the end points is known, lets the state of end points transmission own, circuit parameter or transmission Control Parameter as requested.No response after the transmission token packet, or the parameter that receives is invalid, thinks that all this end points does not have equipment, empties endpoint device connection table.
See Figure 13, packet handing module 23 main completion main frames 1 and each end points are the data exchanging function between the intelligent electric appliance 3.What it was handled is surrounded by: parameter bag, configuration packet, controlling packet, token packet, path are cancelled bag.
Parameter bag, configuration packet, controlling packet all are packets, and still, end points is different to the processing method of these three kinds of bags.Parameter bag and configuration packet are the output bag concerning end points, require end points to return the data of some, are the packets that has data to return to main frame 1.Therefore, after sending packet, should wait for receiving the return data bag to end points.And controlling packet is just different, and controlling packet is the input bag concerning end points, does not need end points return data bag.
After main frame 1 sent token packet, after receiving confirmation signal, main frame 1 was thought and is being connected equipment on the end points.Path is cancelled bag and is used to cancel the data pipe between main frame 1 and the end points.
See Figure 14-15, bag sending module 24 is used to send the data of 131 bytes, after transmission finishes, waits for the handshake that receives end points, and when not confirming, main frame 1 is with retransmission data.Bag receiver module 25 is used to receive 131 byte datas, receives the laggard capable CRC check that finishes, and sends when incorrect and does not confirm handshake, requires the end points retransmission data, and main frame 1 receives again.No matter be to receive or send, all added overtime judgement in the program, occur receptions, transmission error flag being set when overtime and returning.
See in Figure 16-17 byte sending module 26 and the byte receiver module 27 to have added overtime judgement, sign is set when overtime and returns.

Claims (7)

1.一种通过串行总线连接智能电器的主机的工作方法,其特征在于:主机(1)通过RS-485总线(2)连接有至少1个智能电器(3);1个智能电器(3)构成一个端点;1. A working method for connecting a host computer of an intelligent electrical appliance through a serial bus, characterized in that: the host computer (1) is connected with at least one intelligent appliance (3) through the RS-485 bus (2); one intelligent appliance (3) ) constitutes an endpoint; 主机(1)包括:主模块(21)、巡呼模块(22)、包处理模块(23)、包发送模块(24)和包接收模块(25);The host (1) comprises: a main module (21), a patrol module (22), a packet processing module (23), a packet sending module (24) and a packet receiving module (25); 工作时,主模块(21)先初始化主机(1)的通讯端口、初始化总线、巡呼各个端点、绘制网络拓扑图并显示参数;When working, the main module (21) first initializes the communication port of the host (1), initializes the bus, patrols each endpoint, draws a network topology map and displays parameters; 然后,巡呼模块(22)对各个端点进行巡回查看;Then, the patrolling module (22) patrols and checks each endpoint; 然后,由包处理模块(23)完成主机(1)与各端点之间的数据交换,其数据交换时处理的数据包包括:参数包、配置包、控制包、令牌包、通路撤消包;Then, the data exchange between the host (1) and each endpoint is completed by the packet processing module (23), and the data packets processed during its data exchange include: parameter packets, configuration packets, control packets, token packets, and path cancellation packets; 然后,由包发送模块(24)发送131个字节的数据,发送完毕后,等待接收端点的握手信号,不确认时,主机(1)将重发数据;或,由包接收模块(25)接收131个字节数据,接收完毕后进行CRC校验,不正确时发送不确认握手信号,要求端点重发数据,主机(1)重新接收;Then, send the data of 131 bytes by the packet sending module (24), after sending, wait for the handshake signal of the receiving end point, when not confirming, the host computer (1) will resend the data; or, by the packet receiving module (25) Receive 131 bytes of data, perform CRC check after receiving, send a non-confirmation handshake signal if it is incorrect, request the endpoint to resend the data, and the host (1) receives it again; 所述主机(1)中包括一个设备连接表,该设备连接表与各端点号相对应;The host (1) includes a device connection table corresponding to each endpoint number; 所述巡呼模块(22)对各个端点进行巡回查看的过程是:The process that described patrolling module (22) carries out patrol inspection to each end point is: 首先确定一个端点号,然后调用包处理模块(23),发送令牌包,有确认握手包时,则相应端点号上有一个智能电器(3);First determine an endpoint number, then call the packet processing module (23), send a token packet, and when there is a confirmation handshake packet, there will be a smart appliance (3) on the corresponding endpoint number; 然后,主机(1)核对该设备连接表中与该端点号对应的记录,若设备连接表中与该端点号对应的记录为空时,则判断连接到该端点号上的智能电器为新连接到总线上的智能电器(3);主机(1)发送数据包,要求该智能电器(3)传送其配置信息;当主机(1)接收到来自该智能电器(3)的有效数据后,填写所述端点号对应的所述设备连接表;若设备连接表中与该端点号对应的记录不为空,则判断该端点号上连接的设备种类已知,并由连接到该端点号上的智能电器(3)传送本身状态、电路参数,或发送控制参数;若主机(1)发送令牌包后无应答,或是接收到的参数无效,均认为该端点号未连接设备,清空设备连接表中与该端点号对应的记录;Then, the host (1) checks the record corresponding to the endpoint number in the device connection table, and if the record corresponding to the endpoint number in the device connection table is empty, then it is judged that the smart appliance connected to the endpoint number is a new connection to the smart appliance (3) on the bus; the host (1) sends a data packet to request the smart appliance (3) to transmit its configuration information; when the host (1) receives the valid data from the smart appliance (3), fill in The device connection table corresponding to the endpoint number; if the record corresponding to the endpoint number in the device connection table is not empty, then it is judged that the type of equipment connected to the endpoint number is known, and is connected to the endpoint number The smart appliance (3) transmits its own status, circuit parameters, or sends control parameters; if the host (1) does not respond after sending the token packet, or the received parameters are invalid, it is considered that the endpoint number is not connected to the device, and the device connection is cleared. The record corresponding to the endpoint number in the table; 主机(1)向一端点号发送令牌包,若在预设时间内未收到相应的确认握手包,则主机(1)确认该端点号上不存在智能电器(3),即为空端点,清空设备连接表上相应的记录;若在预设时间内收到相应的确认握手包,则主机(1)确认该端点号上存在智能电器(3),即为非空端点,在该设备连接表上作相应的记录,然后读取其产品标志,以识别生产厂商以及产品种类,填写设备连接表,并安装相应的驱动程序;The host (1) sends a token packet to an endpoint number, if the corresponding confirmation handshake packet is not received within the preset time, the host (1) confirms that there is no smart appliance (3) on the endpoint number, that is, an empty endpoint , clear the corresponding record on the device connection table; if the corresponding confirmation handshake packet is received within the preset time, the host (1) confirms that there is a smart appliance (3) on the endpoint number, which is a non-empty endpoint, and the device Make corresponding records on the connection form, and then read the product logo to identify the manufacturer and product type, fill in the device connection form, and install the corresponding driver; 主机(1)对非空端点发送令牌包,并得到确认握手包时后,再发出数据包来确定数据传送的方向;当所述数据包为输入数据包时,智能电器(3)发出确认握手包后,开始接收数据;当所述数据包为输出数据包时,智能电器(3)发出确认握手包后,开始发送数据。The host (1) sends a token packet to a non-empty endpoint, and after receiving a confirmation handshake packet, sends a data packet to determine the direction of data transmission; when the data packet is an input data packet, the smart appliance (3) sends a confirmation Start to receive data after the handshake packet; when the data packet is an output data packet, the smart appliance (3) starts to send data after sending a confirmation handshake packet. 2.根据权利要求1所述的通过串行总线连接智能电器的主机的工作方法,其特征在于:主机(1)和各智能电器(3)都具有唯一的端点号,主机(1)搜索到一个智能电器(3)后,与其建立一数据通信通道;然后,主机(1)与智能电器(3)相互发送数据包,当智能电器(3)接收到正确数据时,智能电器(3)向主机(1)发送确认握手包;当智能电器(3)接收到错误数据时,智能电器(3)向主机(1)发送不确认握手包,主机(1)向该智能电器(3)重新发送上一数据包;当主机(1)接收到正确数据时,主机(1)向智能电器(3)发送确认握手包;当主机(1)接收到错误数据时,主机(1)向智能电器(3)发送不确认握手包,该智能电器(3)向主机(1)重新发送上一数据包;2. The working method of connecting the host computer of smart electrical appliance through serial bus according to claim 1, characterized in that: the host computer (1) and each smart appliance (3) have unique endpoint numbers, and the host computer (1) searches for After a smart appliance (3), a data communication channel is established with it; then, the host computer (1) and the smart appliance (3) send data packets to each other, and when the smart appliance (3) receives correct data, the smart appliance (3) sends The host (1) sends a confirmation handshake packet; when the smart appliance (3) receives wrong data, the smart appliance (3) sends a non-confirmation handshake packet to the host (1), and the host (1) resends to the smart appliance (3) Previous data packet; when the host (1) receives correct data, the host (1) sends a confirmation handshake packet to the smart appliance (3); when the host (1) receives wrong data, the host (1) sends a confirmation handshake packet to the smart appliance (3) 3) Send a handshake packet without confirmation, and the smart appliance (3) resends the previous data packet to the host (1); 当主机(1)向智能电器(3)发送一通路撤销包时,主机(1)与智能电器(3)之间的所述数据通信通道撤销。When the host (1) sends a path revocation packet to the smart appliance (3), the data communication channel between the host (1) and the smart appliance (3) is canceled. 3.根据权利要求1所述的通过串行总线连接智能电器的主机的工作方法,其特征在于:所述主机(1)搜索智能电器(3)时,主机(1)先通过RS-485总线(2)发送令牌包;连接在RS-485总线(2)上的智能电器(3)接收该令牌包,然后通过RS-485总线(2)发回确认握手包至主机(1),从而使主机(1)与智能电器(3)之间建立一数据通信通道。3. The working method according to claim 1 of claim 1, wherein the host computer (1) first passes through the RS-485 bus when the host computer (1) searches for the smart electrical appliance (3). (2) Send a token packet; the smart appliance (3) connected to the RS-485 bus (2) receives the token packet, and then sends back a confirmation handshake packet to the host (1) through the RS-485 bus (2), Thus, a data communication channel is established between the host computer (1) and the smart electrical appliance (3). 4.根据权利要求3所述的通过串行总线连接智能电器的主机的工作方法,其特征在于:所述数据包包括:循环冗余校验字段;主机(1)和智能电器(3)根据该循环冗余校验字段来判断接收到的所述数据包为错误数据或正确数据。4. The working method of the host connected to the smart electrical appliance through the serial bus according to claim 3, wherein: the data packet includes: a cyclic redundancy check field; the host (1) and the smart electrical appliance (3) according to The cyclic redundancy check field is used to judge whether the received data packet is wrong data or correct data. 5.根据权利要求1所述的通过串行总线连接智能电器的主机的工作方法,其特征在于:主机(1)对非空端点发送令牌包后,在预设时间内未得到确认握手包,主机(1)确认该端点号上的智能电器(3)断开,此时主机(1)将所述设备连接表上相应的记录清空;5. The working method according to claim 1 of claim 1, wherein the host computer connected to the smart electrical appliance via the serial bus is characterized in that: after the host computer (1) sends the token packet to the non-empty endpoint, the handshake packet is not confirmed within the preset time , the host (1) confirms that the smart appliance (3) on the endpoint number is disconnected, and at this time the host (1) clears the corresponding record on the device connection table; 当主机(1)向一端点号发送数据包后,若在预设时间内未得到确认握手包,主机(1)确认该端点号上的智能电器(3)断开,此时主机(1)将所述设备连接表上相应的记录清空;When the host (1) sends a data packet to an endpoint number, if the handshake packet is not confirmed within the preset time, the host (1) confirms that the smart appliance (3) on the endpoint number is disconnected, and the host (1) Empty the corresponding records on the device connection table; 当主机(1)正在接受来自一端点号上的智能电器(3)的数据包时,在预设时间内收不到下一个字节,主机(1)确认该智能电器(3)断开,此时主机(1)将所述设备连接表上相应的记录清空。When the host (1) is receiving the data packet from the smart appliance (3) on an endpoint number, the next byte cannot be received within the preset time, the host (1) confirms that the smart appliance (3) is disconnected, At this time, the host (1) clears the corresponding records on the device connection table. 6.根据权利要求5所述的通过串行总线连接智能电器的主机的工作方法,其特征在于:所述主机(1)在完成与一端点号上的智能电器(3)的数据通信后,主机(1)发送通路撤消包至该智能电器(3),并断开与其的数据通信通道。6. The working method of the host connected to the smart electrical appliance by the serial bus according to claim 5, characterized in that: after the host (1) completes the data communication with the smart appliance (3) on an endpoint number, The host (1) sends a channel cancel packet to the smart electrical appliance (3), and disconnects the data communication channel with it. 7.根据权利要求6所述的通过串行总线连接智能电器的主机的工作方法,其特征在于:所述主机(1)包括:主模块(21)、字节发送模块(26)和字节接收模块(27)、用于对各端点进行巡回查看的巡呼模块(22)、用于完成主机与智能电器(1和3)之间的数据交换功能的包处理模块(23)、用于发送数据的包发送模块(24)、用于接收数据的包接收模块(25);主模块(21)、巡呼模块(22)和包处理模块(23)依次构成调用关系,包处理模块(23)分别与包发送模块(24)、包接收模块(25)、字节发送模块(26)和字节接收模块(27)构成调用关系,包发送模块(24)分别与字节发送模块(26)和字节接收模块(27)构成调用关系,包接收模块(25)分别与字节发送模块(26)和字节接收模块(27)构成调用关系。7. The working method of the host connected to the smart electrical appliance through the serial bus according to claim 6, characterized in that: the host (1) comprises: a master module (21), a byte sending module (26) and a byte A receiving module (27), a paging module (22) for patrolling and checking each end point, a packet processing module (23) for completing the data exchange function between the host and the smart appliances (1 and 3), and a The packet sending module (24) of sending data, the packet receiving module (25) that is used to receive data; Main module (21), patrolling module (22) and packet processing module (23) constitute calling relation successively, packet processing module ( 23) form calling relationship with packet transmission module (24), packet reception module (25), byte transmission module (26) and byte reception module (27) respectively, packet transmission module (24) and byte transmission module ( 26) constitutes a calling relationship with the byte receiving module (27), and the packet receiving module (25) forms a calling relationship with the byte sending module (26) and the byte receiving module (27) respectively.
CN200810120125A 2008-07-29 2008-07-29 Operation method for connecting main unit of intelligent electric appliance through serial bus Active CN101345681B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200810120125A CN101345681B (en) 2008-07-29 2008-07-29 Operation method for connecting main unit of intelligent electric appliance through serial bus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200810120125A CN101345681B (en) 2008-07-29 2008-07-29 Operation method for connecting main unit of intelligent electric appliance through serial bus

Publications (2)

Publication Number Publication Date
CN101345681A CN101345681A (en) 2009-01-14
CN101345681B true CN101345681B (en) 2012-09-05

Family

ID=40247576

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200810120125A Active CN101345681B (en) 2008-07-29 2008-07-29 Operation method for connecting main unit of intelligent electric appliance through serial bus

Country Status (1)

Country Link
CN (1) CN101345681B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102141970B (en) * 2011-03-21 2012-12-19 深圳市理邦精密仪器股份有限公司 Serial communication system
CN107229586B (en) * 2017-06-09 2019-07-30 厦门尚为科技股份有限公司 Communication means based on RS485 bridge circuit device
CN112558492A (en) * 2020-12-03 2021-03-26 深圳市欧瑞博科技股份有限公司 Control method and device of intelligent multi-way switch, server and storage medium
CN114754924A (en) * 2022-04-29 2022-07-15 东风电驱动系统有限公司 Processing method, device and equipment for sensor calibration interruption and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6230224B1 (en) * 1998-03-05 2001-05-08 Samsung Electronics Co., Ltd. Fan-out expansion circuit for RS-485 multidrop connection
CN1460950A (en) * 2003-01-15 2003-12-10 西安交通大学 Restructurable hardware designing platform for intelligent electric equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6230224B1 (en) * 1998-03-05 2001-05-08 Samsung Electronics Co., Ltd. Fan-out expansion circuit for RS-485 multidrop connection
CN1460950A (en) * 2003-01-15 2003-12-10 西安交通大学 Restructurable hardware designing platform for intelligent electric equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
孙曙光.智能电器信息化技术的研究.《中国优秀硕士学位论文全文数据库》.2005,(第5期),C042-126. *
杜太行等.智能电器信息化技术的研究.《低压电器》.2004,(第6期),18-21,48. *

Also Published As

Publication number Publication date
CN101345681A (en) 2009-01-14

Similar Documents

Publication Publication Date Title
US4597082A (en) Transceiver for multi-drop local area networks
CN100366029C (en) Communication controller, host-side controller, communication equipment, communication system and method
CN105205021B (en) Disconnect the method and apparatus linked between PCIe device and main frame
CN103064815B (en) A kind of single spi bus controls the control method of many CAN interface
CN105259806B (en) Controller upgrading method and system, master controller and slave controller
CN104794089B (en) The method, apparatus and system to be communicated suitable for the modified UART of single-chip microcomputer
CN101345680B (en) Operation method of communication system
CN102053935A (en) MODBUS serial communication protocol-based communication method
CN101345681B (en) Operation method for connecting main unit of intelligent electric appliance through serial bus
CN109756588A (en) An automatic address allocation system and method for RS485 communication
CN107819659B (en) Intelligent cascade communication network based on SPI
US4430700A (en) System and method for communication between nodes of a closed loop local communication path
CN103997533B (en) A kind of dynamic terminal long-distance maintenance method based on wireless network
CN114422288A (en) Communication system based on Modbus protocol
US4723208A (en) System and method for communication between nodes of a closed loop local communication path
US4604693A (en) System and method for communication between nodes of a closed loop local communication path
CN101345682B (en) Operation method for main unit of intelligent electric appliance serial bus
CN107844441A (en) The means of communication and device of veneer
CN208015725U (en) Multi-split system
CN201274495Y (en) Host communication module
KR20160025135A (en) System, Apparatus and Method for Packet Trasmission and Receiption
Cisco SNA Host Configuration for SDLC Networks
Cisco SNA Host Configuration for SDLC Networks
Cisco SNA Host Configuration for SDLC Networks
Cisco SNA Host Configuration for SDLC Networks

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
ASS Succession or assignment of patent right

Owner name: ZHEJIANG PEOPLE ELECTRICAL APPLIANCE CO., LTD.

Free format text: FORMER OWNER: PEOPLE ELECTRICAL APPLIANCES GROUP CO., LTD.

Effective date: 20140529

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20140529

Address after: 325604, Yueqing, Zhejiang province Liushi town wide industrial zone

Patentee after: ZHEJIANG PEOPLE ELE. APPLIANCE Co.,Ltd.

Address before: 325604 Liushi people's Industrial Park, Zhejiang, Yueqing

Patentee before: People Electric Appliance Group Co.,Ltd.

TR01 Transfer of patent right

Effective date of registration: 20200917

Address after: 325604 people's Industrial Park, Liushi Town, Wenzhou City, Zhejiang Province (Yueqing Economic Development Zone)

Patentee after: PEOPLE ELECTRICAL APPLIANCE GROUP INSTRUMENT Co.,Ltd.

Address before: 325604, Yueqing, Zhejiang province Liushi town wide industrial zone

Patentee before: ZHEJIANG PEOPLE ELE. APPLIANCE Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230824

Address after: 325604 Zhiguang Industrial Zone, Liushi Town, Yueqing City, Wenzhou City, Zhejiang Province

Patentee after: ZHEJIANG PEOPLE ELE. APPLIANCE Co.,Ltd.

Address before: 325604 people's Industrial Park, Liushi Town, Wenzhou City, Zhejiang Province (Yueqing Economic Development Zone)

Patentee before: PEOPLE ELECTRICAL APPLIANCE GROUP INSTRUMENT Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20241223

Address after: 325604 Zhiguang Industrial Zone, Liushi Town, Yueqing City, Wenzhou City, Zhejiang Province

Patentee after: Zhongtong Holdings Co.,Ltd.

Country or region after: China

Address before: 325604 Zhiguang Industrial Zone, Liushi Town, Yueqing City, Wenzhou City, Zhejiang Province

Patentee before: ZHEJIANG PEOPLE ELE. APPLIANCE Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20241230

Address after: 226236 Tonghai Road, Qidong High tech Industrial Development Zone, Nantong City, Jiangsu Province

Patentee after: Jiangsu Daosheng Energy Technology Co.,Ltd.

Country or region after: China

Address before: 325604 Zhiguang Industrial Zone, Liushi Town, Yueqing City, Wenzhou City, Zhejiang Province

Patentee before: Zhongtong Holdings Co.,Ltd.

Country or region before: China