Summary of the invention
Place in view of above-mentioned deficiencies of the prior art, the purpose of the present invention is to provide a kind of detections of more cards of mobile terminal
Devices and methods therefor, to achieve the purpose that realize that more cards skid off identification function using less detection pin.
The technical proposal for solving the technical problem of the invention is as follows:
A kind of more card detection apparatus of mobile terminal comprising master controller and detection module are set in the detection module
It is equipped with the detent of several ranks arrangement;
The master controller powers to each detent, and detection module is stuck in the corresponding interruption of a state output according to each detent
Signal is stuck in a state to master controller, to identify in every row detent;
Master controller successively powers to each column detent, detection module according to be stuck in the corresponding level signal of a state output,
A state is stuck in identify each detent in each column;What master controller will identify that is stuck in a state transfer showing to mobile terminal
Display screen is shown.
In more card detection apparatus of the mobile terminal, the master controller includes supply control unit, input detection
Unit and processing unit;
It powers when the supply control unit is for receiving enabling signal to all detents, to each when receiving switching signal
The detent of column is successively powered;
The input detection unit is used to detect the interrupt signal and level signal of every row detent output, according to interrupt signal
A state is stuck in what level signal identified each detent;And interrupt signal is sent to processing unit;
The processing unit exports switching signal when receiving interrupt signal for exporting enabling signal to supply control unit
To supply control unit, and the state transfer that is stuck in that input detection unit is identified is shown to the display screen of mobile terminal.
In more card detection apparatus of the mobile terminal, the successively power supply is in order first to the detent of first row
The detent of power supply, remaining column is not powered;It powers after the preset time that is delayed to the detent of secondary series, the detent of remaining column is not powered;
It powers after the preset time that is delayed to tertial detent, the detent of remaining column is not powered;And so on until to last column
Detent power supply, the detent of remaining column are not powered.
In more card detection apparatus of the mobile terminal, the detection module further includes several switches and several electricity
Resistance;One column detent is correspondingly arranged a switch, and a line/column detent is correspondingly arranged a resistance;
In one column, one end of each detent is all connected with the output end of a switch, also by a resistance eutral grounding;In a line,
The other end of each detent is all connected with a detection foot of input detection unit, also by a resistance eutral grounding;The switch it is defeated
Enter end connection power end, the control terminal respectively switched is separately connected a power supply foot of supply control unit.
In more card detection apparatus of the mobile terminal, the detent includes pull-up resistor, triode and elastic construction;
One end of the base stage connection elastic construction of the triode also by pull-up resistor connects power end;The other end of elastic construction
Ground connection;The drain electrode of triode is one end of detent, and the source electrode of triode is the other end of detent.
A kind of more card test methods of more card detection apparatus using the mobile terminal comprising:
A, master controller powers to each detent, and detection module is believed according to the corresponding interruption of a state output that is stuck in of each detent
Number a state is stuck in master controller, to identify in every row detent;
B, master controller successively powers to each column detent, and detection module is believed according to the corresponding level of a state output is stuck in
Number, with identify each detent in each column be stuck in a state;
C, the display screen for being stuck in a state transfer to mobile terminal that master controller will identify that is shown.
In more card test methods of more card detection apparatus of the mobile terminal, the step A is specifically included:
A1, master controller power to all detents;
A2, master controller detect the interrupt signal whether every row detent exports rising edge, are then right in recognition detection module
The detent that should be gone has that card is not in place, otherwise identifies that all cards of corresponding row are in place.
In more card test methods of more card detection apparatus of the mobile terminal, the step B is specifically included:
B1, r=1 is enabled;
B2, master controller power to the detent that r is arranged, and the detent of remaining column is not powered;Detect whether every row detent exports
High level signal is that r-th of detent for identifying in the row has that card is not in place, otherwise identifies that r-th of detent is stuck in position;
After B3, delay preset time, enables r add 1, judge return step B2 when r≤m, when judging r > m, r is reset and executed
Step C;Wherein, m is the columns of detent.
In more card test methods of more card detection apparatus of the mobile terminal, after the step C, further includes:
D, master controller powers to all detents.
Compared to the prior art, the more card detection apparatus and its method of mobile terminal provided by the invention, more card detection dresses
It sets including master controller and detection module, the detent of several ranks arrangement is provided in the detection module;The main control
Device powers to each detent, detection module according to each detent be stuck in the corresponding interrupt signal of a state output to master controller, with
It identifies in every row detent and is stuck in a state;Master controller successively powers to each column detent, and detection module is defeated according to a state is stuck in
Out corresponding level signal, with identify each detent in each column be stuck in a state;What master controller will identify that is stuck in a state
The display screen for being transmitted to mobile terminal is shown;By arranging detent by linescan method, the number of detection foot can be saved, is saved
Board area reduces the layout difficulty of circuit board;Reach using less detection pin and has realized that more cards skid off identification
The purpose of function.
Specific embodiment
The present invention provides the more card detection apparatus and its method of a kind of mobile terminal.To make the purpose of the present invention, technical side
Case and advantage are clearer, clear, and the present invention is described in more detail as follows in conjunction with drawings and embodiments.It should be appreciated that
Described herein specific examples are only used to explain the present invention, is not intended to limit the present invention.
Referring to Fig. 1, more card detection apparatus of mobile terminal provided by the invention include master controller 10 and detection module
20.The detent of several ranks arrangement is provided in the detection module 20.In a detection mode, the master controller 10 is to each
Detent power supply, detection module are stuck in the corresponding interrupt signal of a state output to master controller 10, in this way master according to each detent
Controller 10 may recognize that the state that is stuck in every row detent (it is i.e. in place still not in place, not may be in place card skid off or
Poor contact causes to be identified).Master controller 10 successively powers to each column detent, and each detent is according to being stuck in a state output
Corresponding level signal, such master controller 10 according to the height of level signal be may recognize that each detent in each column be stuck in position
State.The display screen for being stuck in a state transfer to mobile terminal for each detent that master controller 10 will identify that is shown.
Master controller 10 and detection module 20 execute above-mentioned detection automatically when booting can be set in user.After the completion of detection,
Continue real-time detection in use, user can be facilitated to understand in use process, whether blocks because external force skids off or poor contact
Lead to the problem of not in place and then influence mobile terminal using effect occur.Then after the completion of master controller 10 detects for the first time,
It also needs to restore the power supply to each detent.Corresponding interrupt signal will be exported when any card skids off in this way, makes master controller 10
Detect there is card to skid off in any row detent.Master controller 10 successively powers to each column detent, to successively identify each in every row
Detent is stuck in a state
As shown in Figure 1, the master controller 10 includes supply control unit 110, input detection unit 120 and processing unit
130.The processing unit 130 connects supply control unit 110 and input detection unit 120.
It is provided with power supply foot on the supply control unit 110, the confession of each column detent is controlled for exporting opening and closing signal
Electricity condition.Specific control includes powering when receiving enabling signal to all detents, to the detent of each column when receiving switching signal
Successively power.The successively power supply is first to power in order to the detent of first row, and the detent of remaining column is not powered;Delay is pre-
If powering after the time to the detent of secondary series, the detent of remaining column is not powered;Tertial detent is supplied after the preset time that is delayed
The detent of electricity, remaining column is not powered;And so on until last column.
It is provided with detection foot on the input detection unit 120, for detecting the interrupt signal and electricity of every row detent output
Ordinary mail number is stuck in a state according to what interrupt signal and level signal identified each detent;Interrupt signal is also sent to processing
Unit 130.Effectively, level signal is divided into high level and low level to the triggering of interrupt signal rising edge.
The processing unit 130 for exporting enabling signal when detection pattern just starts to supply control unit 110,
To power to all detents;Switching signal is exported when receiving interrupt signal to supply control unit 110, is successively supplied with realizing
Electricity;And the state transfer that is stuck in for each detent that input detection unit 120 identifies is shown to the display screen of mobile terminal.
In the present embodiment, the detection module 200 includes several detents Wx, several switches Cy and several resistance
Rz(resistance value is preferably 10K Ω).Each detent arranges in the way of row × column, and the number of switch Cy is equal with columns, resistance Rz's
Sum is the sum of line number and columns, and a line/mono- arranges a corresponding resistance.In one column, one end PA of each detent is all connected with one and opens
The output end 3 of pass also passes through a resistance eutral grounding.In a line, the other end PB of each detent is all connected with input detection unit 120
One detection foot also passes through a resistance eutral grounding.The input terminal 1 of the switch connects power end VDD, and the control terminal 2 of switch connects
Connect supply control unit 110.The number of the power supply foot of supply control unit 110 is equal with columns, and power supply foot exports open signal
It can make to close the switch, power to the column, shutdown signal control switch, which disconnects, stops power supply.
If being arranged in n row m column, the number of pins needed altogether is n+m,.Greatly reduce the number (prior art of pin
The corresponding pin of one detent), save board area.Wherein, x, y, z, n, m are positive integer.Preferably, line number and column
Number is equal, and the pin number used is minimum.
Referring to Figure 2 together and Fig. 3, the circuit structure of all detents is identical, and the detent includes pull-up resistor R, three poles
Pipe Q and elastic construction S;One end coa of the base stage connection elastic construction S of the triode Q, also pass through pull-up resistor R connection electricity
Source VDD;The other end cob of elastic construction S is grounded;The drain electrode of triode Q is one end PA of detent, and the source electrode of triode Q is
The other end PB of detent.The triode Q is NPN triode.The elastic construction S can there are many structure or deformation, this implementations
Example is not construed as limiting it, if can elastic construction S be able to achieve the fashionable base stage by triode Q of card insertion and be connected to ground, card extract or
The function of being disconnected when skidding off.
As shown in Fig. 2, (skidding off or extracting) when card is not in place, the both ends (coa, cob) of elastic construction S are not contacted, then
It is high level that the base stage of triode Q, which is pulled up resistance R pull-up, and triode Q conducting connects one end PA and other end PB of detent
It connects.As shown in figure 3, elastic construction S, which is under pressure, contacts its both ends (coa, cob), then triode when being stuck in (insertion)
The base stage of Q is pulled low, and triode Q cut-off disconnects one end PA and other end PB of detent.
9 detents (W1 ~ W9) need to be set, then detect mould by taking 9 cards (card 1 ~ card 9) as an example please continue to refer to Fig. 1 to Fig. 3
3 switches (C1 ~ C3), 6 resistance (Ra1 ~ Ra3, Rb1 ~ Rb3) are correspondingly arranged in block 200.The correspondence of supply control unit 110 is set
3 power supply feet (GPIO_A1 ~ GPIO_A3) are set, input detection unit 120 is correspondingly arranged 3 detection foot (GPIO_B1 ~ GPIO_
B3).
The first detent W1, the second detent W2, third detent W3 form the first row, the 4th detent W4, the 5th detent W5,
6th detent W6 forms the second row, and the 7th detent W7, the 8th detent W8, the 9th detent W9 form the third line.First detent W1,
Four detent W4, the 7th detent W7 form first row, and the second detent W2, the 5th detent W5, the 8th detent W8 form secondary series, third
Detent W3, the 6th detent W6, the 9th detent W9 composition third column.
The first detent W1, the 4th detent W4, the 7th detent W7 one end PA be all connected with the output end of first switch C1
3, it is also grounded by first resistor Ra1.Second detent W2, the 5th detent W5, the 8th detent W8 one end PA be all connected with second and open
It closes the output end 3 of C2, be also grounded by second resistance Ra2.One end PA of third detent W3, the 6th detent W6, the 9th detent W9
It is all connected with the output end 3 of third switch C3, is also grounded by 3rd resistor Ra3.
The first detent W1, the second detent W2, third detent W3 other end PB be all connected with the of input detection unit
One detection foot GPIO_B1, also pass through the 4th resistance Rb1 ground connection.4th detent W4, the 5th detent W5, the 6th detent W6 it is another
End PB is all connected with the second detection foot GPIO_B2 of input detection unit, also by the 5th resistance Rb2 ground connection.7th detent W7,
Eight detent W8, the 9th detent W9 other end PB be all connected with the third detection foot GPIO_B3 of input detection unit, also by the 6th
Resistance Rb3 ground connection.
The first switch C1, second switch C2, third switch C3 input terminal 1 be all connected with power end VDD.First switch
The control foot 2 of C1 connects the first power supply foot GPIO_A1 of supply control unit 110.The control foot 2 of second switch C2 connects power supply
Second power supply foot GPIO_A2 of control unit 110.The third that the control foot 2 of third switch C3 connects supply control unit 110 supplies
Electric foot GPIO_A3.
When detection pattern starts, processing unit exports enabling signal to supply control unit 110, supply control unit 110
Three power supply feet export closure signal control three close the switch, start to 3 column detents power.
When card is not in place, one end PA of detent is connect with other end PB.When being stuck in, one end PA of detent with it is another
PB is held to disconnect.When card any in a line is not in place, detection foot can detect the interrupt signal (getting higher from low) of rising edge, input
The identification of detection unit 120 has that card is not in place, subsequent to continue judgement to be which blocks not in place.Only have all cards in place in a line
When, detection foot can detect low level, input detection unit 120 identify it is all be stuck in position, do not handle.
Assuming that the first detection foot GPIO_B1 of input detection unit 120 detects the interrupt signal for generating rising edge, then will
Interrupt signal is transferred to processing unit 130.Processing unit 130 exports switching signal to supply control unit 110, and successively judgement blocks
K1, card K2, the situation in place for blocking K3: i.e. supply control unit 110 first controls first switch C1 closure, second switch C2 and third
Switch C3 is disconnected;Indicate that card K1 does not exist if the first detection foot GPIO_B1 of input detection unit 120 detects high level
Position, conversely, low level is then in place.Then it being delayed after preset time, supply control unit 110 controls second switch C2 closure, the
One switch C1 and third switch C3 is disconnected;It is not in place to block K2 if the first detection foot GPIO_B1 detects high level.It is delayed again
After preset time, supply control unit 110 controls third switch C3 closure, and first switch C1 and second switch C2 are disconnected;If
It is not in place that first detection foot GPIO_B1 detects that high level then blocks K3.
When input detection unit 120 second detection foot GPIO_B2 detect generate rising edge interrupt signal, then will in
Break signal is transferred to processing unit 130.Processing unit 130 exports switching signal to supply control unit 110, and successively judgement blocks
K4, card K5, the situation in place for blocking K6: i.e. supply control unit 110 first controls first switch C1 closure, second switch C2 and third
Switch C3 is disconnected;It is not in place to block K4 if the second detection foot GPIO_B1 detects high level.(pre- after the preset time that is delayed
If completing switching and level detection in the time, detection foot is avoided not detect just switching switch also), supply control unit
110 control second switch C2 closures, first switch C1 and third switch C3 are disconnected;If the second detection foot GPIO_B1 is detected
It is not in place that high level then blocks K5.It is delayed after preset time again, supply control unit 110 controls third switch C3 closure, and first opens
C1 and second switch C2 is closed to disconnect;It is not in place to block K6 if the second detection foot GPIO_B1 detects high level.
When input detection unit 120 third detection foot GPIO_B3 detect generate rising edge interrupt signal, then will
Interrupt signal is transferred to processing unit 130.Processing unit 130 exports switching signal to supply control unit 110, and successively judgement blocks
K7, card K8, the situation in place for blocking K9: i.e. supply control unit 110 first controls first switch C1 closure, second switch C2 and third
Switch C3 is disconnected, and it is not in place to block K7 if the third of input detection unit 120 detection foot GPIO_B3 detects high level.Prolong
When preset time after, supply control unit 110 control second switch C2 closure, first switch C1 and third switch C3 disconnection;Such as
It is not in place that fruit third detection foot GPIO_B3 detects that high level then blocks K8.It is delayed after preset time again, supply control unit 110
Third switch C3 closure is controlled, first switch C1 and second switch C2 are disconnected, if input detection unit 120 detects GPIO_
B1 is that then to block K9 not in place for high level.
If there are multiple feet to generate the interrupt signal of rising edge among GPIO_B1, GPIO_B2, GPIO_B3, carry out simultaneously
Switching can determine whether to be stuck in a state further according to the low and high level on GPIO_B1, GPIO_B2, GPIO_B3 foot.It is logical in this way
It crosses 6 feet (detecting foot and foot of powering) and achieves that skid off (not in place) of 9 cards detects, need 9 GPIO with the prior art
Foot is compared to detect, and saves 1/3 GPIO foot, saves resource for system.It is to be appreciated that successively being supplied when completion is above-mentioned
After the operation of electricity, the supply control unit also control it is all close the switch, to restore power supply to each detent, so as to it is subsequent after
Whether there is card to skid off in continuous detection use process.
Assuming that the first detection foot GPIO_B1, the second detection foot GPIO_B2 detect the interrupt signal of rising edge, third
Detection foot GPIO_B3 is low level.Have that card is not in place in the identification of input detection unit 120 the 1st, the detents of 2 rows, letter will be interrupted
Number it is transferred to processing unit 130, processing unit 130 exports switching signal and successively powered to supply control unit 110.Power supply
3 power supply feet (GPIO_A1 ~ GPIO_A3) of control unit 110 export shutdown signal, open signal, open signal respectively, make
The column power supply of first switch C1 closed pair the 1st, other switches (C2 and C3) disconnect.It in this way can be simultaneously to the first detent W1 and the 4th
Detent W4 is detected.Although having power supply to the 7th detent W7, its corresponding detection foot GPIO_B3 is continuously low level, no
Influence testing result.Input detection unit 120 detects the level signal of foot GPIO_B2 according to the first detection foot GPIO_B1, second
Low and high level can recognize the state in place blocked in each detent.What input detection unit 120 will test out is stuck in a state
130 display screens for being transferred to mobile terminal are shown through the processing unit.
More card detection apparatus based on above-mentioned mobile terminal, the present invention also provides a kind of detections of more cards of mobile terminal to fill
The more card test methods set, referring to Figure 4 together, more card test methods include:
S100, master controller power to each detent, detection module according to each detent be stuck in a state output it is corresponding in
Break signal is stuck in a state to master controller, to identify in every row detent;
S200, master controller successively power to each column detent, and detection module is according to being stuck in the corresponding level of a state output
Signal is stuck in a state with identify each detent in each column;
The display screen that S300, master controller will identify that be stuck in a state transfer to mobile terminal is shown.
The step S100 is specifically included:
Step 101, master controller power to all detents;
Step 102, master controller detect the interrupt signal whether every row detent exports rising edge, are then recognition detection modules
The detent of middle corresponding row has that card is not in place, otherwise identifies that all cards of corresponding row are in place.Specifically refer to above-described embodiment.
The step S200 is specifically included:
Step 201, master controller enable r=1;
Step 202, master controller power to the detent that r is arranged, and the detent of remaining column is not powered;Whether detect every row detent
High level signal is exported, is that r-th of detent for identifying in the row has that card is not in place, otherwise identifies that r-th of detent is stuck in position;
After step 203, delay preset time, enables r add 1, judge return step B2 when r≤m, when judging r > m, r is reset
And execute step C;Wherein, m is the columns of detent, and r is variable.Specifically refer to above-described embodiment.
It after the completion of this detection of master controller, also needs to restore the power supply to each detent, i.e., after the step S300, also
Include:
S400, master controller power to all detents.Corresponding interrupt signal will be exported when any card skids off in this way,
Master controller can detect have card to skid off in which row detent.
In conclusion the more card detection apparatus and its method of mobile terminal of the invention, by being arranged in detection module
The detent of several ranks arrangement;Powered by master controller to each detent, detection module according to each detent to be stuck in a state defeated
Corresponding interrupt signal is stuck in a state to master controller, to identify in every row detent out;Master controller to each column detent successively
Power supply, detection module is according to being stuck in the corresponding level signal of a state output, be stuck in a state with identify each detent in each column;
The display screen that master controller will identify that be stuck in a state transfer to mobile terminal is shown;By the way that detent is arranged by linescan method
Column, first judge every row, judge each column again, can correctly identify the state that is stuck in of each detent, also save the number of detection foot,
Board area has been saved, the layout difficulty of circuit board is reduced;Reach using less detection pin and has realized that more cards are slided
The purpose of identification function out.
It should be understood that the application of the present invention is not limited to the above for those of ordinary skills can
With improvement or transformation based on the above description, all these modifications and variations all should belong to the guarantor of appended claims of the present invention
Protect range.