CN1148765C - Detection method for real-time state of switch - Google Patents
Detection method for real-time state of switch Download PDFInfo
- Publication number
- CN1148765C CN1148765C CNB00127614XA CN00127614A CN1148765C CN 1148765 C CN1148765 C CN 1148765C CN B00127614X A CNB00127614X A CN B00127614XA CN 00127614 A CN00127614 A CN 00127614A CN 1148765 C CN1148765 C CN 1148765C
- Authority
- CN
- China
- Prior art keywords
- stitch
- switch
- detected switch
- computer
- detected
- 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.)
- Expired - Fee Related
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 22
- 230000008676 import Effects 0.000 claims description 3
- 238000000034 method Methods 0.000 abstract description 7
- 238000010586 diagram Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 3
- 238000001755 magnetron sputter deposition Methods 0.000 description 3
- 230000007812 deficiency Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
Images
Landscapes
- Testing Electric Properties And Detecting Electric Faults (AREA)
Abstract
A method for detecting the real-time state of a switch adopts computer parallel port detection. The method specifically comprises the steps that the detected switch is connected to a D-shaped socket which is provided with 25 pins and is used for being connected with a parallel port of a printer on a computer shell, the input instruction of the parallel port of the computer is utilized to input the instruction connected to the corresponding pins, the real-time state of the corresponding pins is detected, and therefore the real-time state of the detected switch is judged. When there is radio frequency interference in the detection working occasion, the detected switch needs to be connected with one or more relays in series. One computer can detect eight switches simultaneously. Has the characteristics of simple use, low cost and wide application.
Description
Technical field
The present invention relates to a kind of detection method of switch real time state, be used for detecting in real time the state that various switches are opened and closed.
Background technology
It is to be operated under two states of folding that many devices are arranged at present, and regular tap is exactly an exemplary.The real-time status that all needs to detect them in a lot of occasions of routine work.Because the A/D capture card 3 that is connected with computer 4 can be gathered analog signal, so, can detect the state of detected switch 1 with A/D capture card 3.Detection method is: 3, one power supply V of an A/D capture card and detected switch 1 and resistance R 2 are connected into as shown in Figure 1.Use A/D capture card 3 built-in address commands to programme, just can judge the state of switch then by the magnitude of voltage of gathering resistance R 2 two ends.Must open case of computer when but capture card is installed, and will take slot limited on the computer motherboard, and may produce conflict with other integrated card (as sound card, display card etc.) on the mainboard.Everything all can bring inconvenience to use.On the other hand, because the price comparison height of capture card, and need power supply of configuration, so use cost is also than higher.
Summary of the invention
The objective of the invention is provides a kind of method of sense switch real-time status for overcoming the deficiency of technology formerly, and used condition is simple, and is easy to operate, and cost is low.
Technical solution of the present invention is as follows:
A kind of detection method of switch real time state adopts COMPUTER DETECTION, and its concrete steps are as follows:
1. get two end connectors of detected switch;
2. get on the computer housing for the D type socket that contains 25 stitch that connects printer parallel port;
3. the 1st stitch on an end of above-mentioned detected switch and the above-mentioned D type socket or the 10th stitch or the 11st stitch or the 12nd stitch or the 13rd stitch or the 14th stitch or the 15th stitch or the 16th stitch or the 17th stitch are connected; The 18th stitch on the other end of detected switch and the D type socket or the 19th stitch or the 20th stitch or the 21st stitch or the 22nd stitch or the 23rd stitch or the 24th stitch or the 25th stitch are connected;
4. utilize the input instruction of parallel port of computer, import the instruction of the corresponding stitch of above-mentioned connection, detect the real-time status of corresponding stitch, judge the real-time status of detected switch:
When an end of detected switch is when the 10th, 11,12,13 or the 15th stitch on the D type socket links to each other, then read I/O address X ' 3BD ' by computer 8088IN, or the data of X ' 379 ', if the data bit value of the stitch that this end is corresponding is 1, then detected switch is to be in off-state, otherwise detected switch is closed;
When an end of detected switch is when the 16th stitch on the D type socket links to each other, then at first instruct to I/O address X ' 3BE ' with computer 8088OUT, or X ' 37a ' output 0X0F, then with 8088IN instruction input I/O address X ' 3BE ', or the data of X ' 37a ', if the data bit value of the 16th stitch correspondence is 1, then detected switch disconnects, otherwise detected switch is closed;
When an end of detected switch is that the 1st, 14 or the 17th stitch on the D type socket is when linking to each other, then at first instruct to address X ' 3BE ' with computer 8088OUT, or X ' 37a ' output 0X00, then with 8088IN instruction input X ' 3BE ', or the data of X ' 37a ', if the pairing data bit of this end is 0, then detected switch disconnects, otherwise detected switch is closed.
If there is radio frequency interference in the workplace of detected switch, the one or more relay of then need between the parallel port of detected switch and computer, connecting.
The advantage of the inventive method be utilized on the casing of computer existing one specially for connecting the 25 pin D type sockets that parallel printer designs.Parallel port be exactly by this D type socket realize with printer between communicate by letter.Utilize the parallel port of computer can realize the detection of the real-time status of switch very easily.As long as make one 25 pin D type plug, just can possess the function of " plug and play ", that is to say, no matter be inserted on the existing computer of which platform and can use.Thereby overcome the inconvenience that the A/D capture card brings is installed, has reduced the cost that uses simultaneously again.In a word, the present invention uses simply, and cost is low, so can be widely used in the detection of the real-time status of the device with switching characteristic.
Description of drawings:
Fig. 1 detects the device schematic diagram of detected on off state with computer and A/D capture card for technology formerly.
Fig. 2 is detection method of the present invention used checkout gear schematic diagram when not having radio frequency interference in the testing occasion.
Fig. 3 for detection method of the present invention when in the testing occasion radio frequency interference being arranged, used checkout gear schematic diagram.
Fig. 4 is detection method of the present invention used device schematic diagram in experimental example.
Fig. 5 is the flow chart of detection method of the present invention in experimental example.
Below in conjunction with embodiment this invention is further described.
Embodiment:
See also Fig. 2 and Fig. 3 earlier, in the detection method of switch real time state of the present invention, the jockey of detected switch and parallel port of computer such as Fig. 2, shown in Figure 3.
Find out that by above-mentioned specific practice the present invention at first couples together the specific stitch of the parallel port of detected switch and computer, by detecting the real-time status of corresponding stitch, just can realize detection then switch real time state.Above-mentioned specific practice can be summed up as two big concrete steps:
(1) detected switch is connected on the specific stitch of parallel port, as shown in Figure 2.If there is radio frequency interference in the workplace of detected switch, the one or more relay of then need between the parallel port of detected switch and computer, connecting, as shown in Figure 3.
(2) utilize the input instruction of parallel port to detect the real-time status of corresponding stitch, just can judge the real-time status of detected switch then.
Device shown in Figure 2 is applicable to the detected switch that does not have radio frequency interference in the testing occasion.Among Fig. 21 is detected switch; The 6th, the special-purpose D type of the parallel printer on computer socket; 5 and 7 is two stitch on the D type socket 6, and wherein 5 can be the 1st on the D type socket 6, or 10, or 11, or 12, or 13, or 14, or 15, or in 16 or 17 stitch any one, 7 can be the 18th on the D type socket 6, or 19, or 20, or 21, or 22, or 23, or 24, or in 25 stitch any one; 4 is computers.
Device shown in Figure 3 is applicable to the detected switch that has radio frequency interference in the testing occasion.Among Fig. 38 is relay J
1A plurality of relays if connect, better to the shield effectiveness of radio frequency interference.
Can detect the state of parallel port stitch with following 2 input instructions, be elaborated below.
I/O address to this instruction of the monochromatic CRT-printer parallel port of IBM is X ' 3BD ', is X ' 379 ' to the I/O address of this instruction of parallel printer parallel port.
Read in | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
The socket stitch | 11 | 10 | 12 | 13 | 15 | - | - | - |
If 5 among Fig. 2 is one of the 10th, 11,12,13 or 15 stitch on the D type socket 6, then need to use this input instruction.Read the data of 379H address by the 8088IN instruction.If the data bit value of the stitch of 5 correspondences is 1 among Fig. 2, then the detected switch in the key diagram 2 is to be in off-state; Otherwise then detected switch 1 is closed.
Input instruction 2
I/O address for this instruction of the monochromatic CRT-printer parallel port of IBM is X ' 3BE ', is X ' 37a ' to the I/O address of this instruction of parallel printer parallel port.
Read in | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
The socket stitch | - 17 | 16 | - 14 | - 1 |
At this moment, according to 5 selected stitch differences among Fig. 2, and in two kinds of situation.
(1) if 5 are the 16th stitch on the D type socket 6 among Fig. 2, then at first with the 8088OUT instruction to 37a address output 0x0F, then with the value of 8088IN input 37aH address.If the data bit input value of the 16th stitch correspondence is 1, then detected switch 1 disconnects in the key diagram 2; Otherwise then detected switch 1 is closed.
(2) if 5 are one of the 1st, 14 and 17 stitch in the D type socket among Fig. 2, then at first with the 8088OUT instruction to 37aH address output 0X00, then with the data of 8088IN instruction input 37aH address.If 5 pairing data bit are 0 among Fig. 2, then detected switch 1 disconnects; Otherwise detected switch 1 is closed.
As long as import 5 pairing data bit among Fig. 2 incessantly, just can realize the detection of detected switch real time state.If the residing environment of detected switch has radio frequency interference, then checkout gear will adopt device shown in Figure 3.Among Fig. 38 is relay J
1Relay 8 and computer 4 be placed on does not have radio frequency interference or the more weak place of radio frequency interference.Relay 8 and detected switch 1 are cascaded, and promptly in the time of detected switch 1 closure, a pair of haptic element of often holding on the relay 8 also can become closure; When detected switch 1 disconnected, this on the relay 8 also can disconnect often holding haptic element.Therefore, detect on the relay 8 this and state of often opening haptic element is just equaled to have detected the state of detected switch 1.
Because relay 8 is placed in the place that does not have radio frequency interference, so this on the detection relay 8 is identical to the direct method that detects detected switch 1 of method and front of often opening haptic element.The purpose that connects relay 8 is to isolate radio frequency interference, if more relay is connected with relay 8, then can obtain better effect, and this depends on the power of radio frequency interference in detected switch 1 occasion of living in.Can detect simultaneously the real-time status of 8 detected switches at most for a computer with detection method of the present invention.
The present invention had once obtained successful application on a magnetron sputtering coater.Fig. 4 is the use schematic diagram of the embodiment of the invention.Detected switch 1 is a sensitive switch among the figure; The 4th, computer; The 5th, the 15th stitch in the D type socket 6; The 6th, the D type socket of connection printer on the computer housing; The 7th, the 25th stitch in the D type socket 6,8 and 9 is respectively relay J
1And J
2The 10th, the plated film operating room; The 11st, the control machine room; The 12nd, the vacuum chamber of magnetron sputtering coater.The vacuum chamber 12 of magnetron sputtering coater is placed in the plated film operating room 10.The sensitive switch of detected switch 1 is in vacuum chamber 12.First relay 8 and sensitive switch 1 are cascaded, and second relay 9 and first relay 8 are cascaded.The a pair of haptic element J that often opens of second relay 9
2The 15th stitch and 25 stitch with D type socket 6 link together respectively.Control machine room 11 and plated film operating room 10 isolate mutually, and first relay 8 and second relay 9 and computer 4 are placed in the control machine room 11.
Use the 8088IN instruction to read the data of 379H address when detecting, just use inportb (0x379) order in the C language.The flow process of program is seen Fig. 5.
It can be seen from the above, and the present invention not only uses simply, and cost is very low, so can be widely used in Industry Control.
Claims (2)
1. the detection method of a switch real time state adopts COMPUTER DETECTION, it is characterized in that its concrete steps are as follows:
1. get two end connectors (5,7) of detected switch (1);
2. get on computer (4) casing for the D type socket (6) that contains 25 stitch that connects printer parallel port;
3. the 1st stitch on the end (5) of above-mentioned detected switch (1) and the above-mentioned D type socket (6) or the 10th stitch or the 11st stitch or the 12nd stitch or the 13rd stitch or the 14th stitch or the 15th stitch or the 16th stitch or the 17th stitch are connected; The 18th stitch on the other end (7) of detected switch (1) and the D type socket (6) or the 19th stitch or the 20th stitch or the 21st stitch or the 22nd stitch or the 23rd stitch or the 24th stitch or the 25th stitch are connected;
4. utilize the input instruction of computer (4) parallel port, import the instruction of the corresponding stitch of above-mentioned connection, detect the real-time status of corresponding stitch, judge the real-time status of detected switch (1):
When the end (5) of detected switch (1) is when the 10th, 11,12,13 or the 15th stitch on the D type socket (6) links to each other, then read I/O address X ' 3BD ' by computer 8088IN, or the data of X ' 379 ', if the data bit value of the stitch that end (5) is corresponding is 1, then detected switch (1) is to be in off-state, otherwise detected switch (1) is closed;
When the end (5) of detected switch (1) is when the 16th stitch on the D type socket (6) links to each other, then at first instruct to I/O address X ' 3BE ' with computer 8088OUT, or X ' 37a ' output 0X0F, then with 8088IN instruction input I/O address X ' 3BE ', or the data of X ' 37a ', if the data bit value of the 16th stitch correspondence is 1, then detected switch (1) disconnects, otherwise detected switch (1) is closed;
When the end (5) of detected switch (1) is that the 1st, 14 or the 17th stitch on the D type socket (6) is when linking to each other, then at first instruct to address X ' 3BE ' with computer 8088OUT, or X ' 37a ' output 0X00, then with 8088IN instruction input X ' 3BE ', or the data of X ' 37a ', if end (5) pairing data bit is 0, then detected switch (1) disconnects, otherwise detected switch (1) is closed.
2, the detection method of switch real time state according to claim 1, when there is radio frequency interference in the workplace that it is characterized in that described detected switch, the one or more relay of then need between the parallel port of detected switch (1) and computer (4), connecting.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB00127614XA CN1148765C (en) | 2000-11-30 | 2000-11-30 | Detection method for real-time state of switch |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB00127614XA CN1148765C (en) | 2000-11-30 | 2000-11-30 | Detection method for real-time state of switch |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1319854A CN1319854A (en) | 2001-10-31 |
CN1148765C true CN1148765C (en) | 2004-05-05 |
Family
ID=4592627
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB00127614XA Expired - Fee Related CN1148765C (en) | 2000-11-30 | 2000-11-30 | Detection method for real-time state of switch |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN1148765C (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE102007019339B4 (en) * | 2007-04-24 | 2009-12-17 | Siemens Ag | Arrangement for monitoring a switching state of a switch |
-
2000
- 2000-11-30 CN CNB00127614XA patent/CN1148765C/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN1319854A (en) | 2001-10-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1245687C (en) | Method and device for testing USB port | |
CN1459731A (en) | Method of operating mode for controlling general sequence bus device and related, instrument | |
CN1256643C (en) | Power managing in a system having internal USB hub | |
US20030233507A1 (en) | Electronic card with multiple interfaces | |
CN1148765C (en) | Detection method for real-time state of switch | |
US20020161938A1 (en) | Increasing control information from a single general purpose input/output (GPIO) mechanism | |
CN1449526A (en) | Identification of a peripheral connection state with a universal serial bus | |
CN2457654Y (en) | Switch controller for remote distance start computer | |
CN1458559A (en) | Electronic peripheral card with multiple I/O interfaces | |
CN1154926C (en) | Detection method for system host board and input/output system | |
CN1276331C (en) | USB interface mobile storage | |
CN2604691Y (en) | Universal therapeutic equipment test platform | |
CN104484305A (en) | Server debugging analysis interface device | |
CN200965667Y (en) | Expansion card with shutdown protector | |
CN101059769A (en) | Universal serial bus device test system and its method | |
CN1152315C (en) | Double-bus industrial control computer and its control method | |
CN1317743A (en) | Hardware and method for detecting switch-in or-off of microcomputer protecting device | |
CN2497316Y (en) | Electronic circuit test box operated by computer network | |
CN1258300C (en) | Directional sensor interface device of mobile communication terminal and its control method | |
CN1304947C (en) | Switching equipment of memory analog device | |
CN211554846U (en) | Embedded industrial control computer based on Loongson processor | |
CN1129847C (en) | Computer system and method for outputting system error signal from display port | |
CN200979675Y (en) | A computer device with separate module | |
CN2543134Y (en) | Double-bus industrial controller | |
CN2418519Y (en) | Detection device for automatically detecting input and output interface |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C06 | Publication | ||
PB01 | Publication | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C19 | Lapse of patent right due to non-payment of the annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |