Fig. 2 is the skeleton view of expression embodiment of keyboard according to the present invention.Keyboard according to the present invention comprises a plurality of keys and is used for the plug-in card hole 22 of receiving card 30.Key data and card data all are transferred to PC by PS/2 line 23.
Fig. 3 is an in-built block scheme of schematically representing the keyboard according to the present invention.The keyboard that has card processing function according to the present invention comprises: be used for the key of key matrix is outputed to PC, and activate card holding device so that the card data transmission that will block arrives the control section 31 of PC; The key matrix 32 that links to each other with control section 31 is used for institute's key codes of pushbuttons is outputed to control section 31; Operation under control section 31 control, and from institute's plug-in card reading of data or to the card holding device 33 of institute's plug-in card write data; The clock generator 34 of operation is used for generation and makes card holding device 33 clock signal synchronous under control section 31 controls; With the pilot lamp part 35 of operation under control section 31 controls, be used to indicate the mode of operation of keyboard.
Fig. 4 is the circuit diagram of expression structure of keyboard according to the present invention,
Control section 31 comprises: microprocessor 311; The oscillating part 312 of reference signal is provided for microprocessor 311; When powering, initial power supply the reset circuit part 313 of reset signal is provided for microprocessor 311; The numeral that links to each other with key matrix 32 and letter key coupling part 314 and 315 are used for the key of key matrix 32 is sent to microprocessor 311; With the PC coupling part 316 that links to each other with PC, be used for input signal to PC or from the PC output signal.
Clock generation part 34 comprises: comprise the oscillatory circuit of capacitor C 2 and C3, resistance R 2 and crystal oscillator X2, be used to produce certain frequency; Convert the logical circuit NAG1 and the NAG2 of dagital clock signal to oscillator signal with oscillatory circuit.
Pilot lamp part 35 comprises for example pilot lamp LED1-LED3 of mode of operation, card holding device mode of operation and the analog of NUM LOCK, CAPS LOCK of a plurality of indication keyboards.
As mentioned above, in the keyboard with card processing function according to the present invention, card data processing and key are handled by a control section control.In addition, card data and key data arrive PC by a transmission line.Therefore, PC is by a connectivity port and a kind of communication protocol receiving card data and key data.
In this keyboard, control procedure relies on keyboard and whether is applied to General System or belief system and dissimilates.The operation of General System and belief system situation lower keyboard will be described in respectively.
Fig. 5 is the process flow diagram of expression General System control procedure according to the present invention.
According to Fig. 5, if the request of a smart card instruction is arranged, just based on general process transmission keyboard data.On the other hand, if PC provides the processing instruction of smart card,, and before resetkey is handled, at first carry out the intelligent card in processing instruction with regard to the Pause key transmission.This situation can be applied to use in the electronic transaction of smart card, and is particularly useful as under the situation of payment means at smart card.
To describe this operation in detail below.
When system begins (401), provide reset signal to microprocessor 311 from the part 313 that resets, the initialization control section 31 (501) thus.Afterwards, repeat next procedure up to turning off power supply.Be next procedure below.
Carry out keyboard scan to check whether by next key (502).If by next key, so relevant key deposits impact damper (503) in.Then carry out check to check from PC whether received instruction (504).
On the other hand, if also do not press next key, so directly carry out check to check from PC whether received instruction (504) in step 502.
If do not receive instruction, just there is no need processing instruction, and therefore, the data that also temporarily deposited impact damper as institute's key codes of pushbuttons in are transferred to PC (510) in step 504.Carry out then whether check has inserted smart card and whether insertion back smart card ejects.Then insertion that will block or eject notification PC (512).
On the other hand, when the instruction of check PC,, receive instruction (505) from PC so if instruction (504) from PC is arranged.Judge that then this instruction is to (506) key or to blocking.In this case, if instruction to key, so to the key processing instruction, and is followed transmission response message to PC (507).On the other hand, if instruction is handled the smart card sign indicating number so to card, and then transmission response message arrives PC (508).
As the example of smart card instruction, electrical instruction, the card existence/do not confirming that instruction, card holding device option are provided with instruction and read/write instruction of card holding device are arranged.When carrying out these intelligent card in processing instructions, the keyboard processing instruction of useful mistake.
But if the instruction that receives judges that so it is a mistake or a false command neither keyboard instruction neither instruct by smart card, and therefore, request PC sends instruction again.
Therefore when finishing instruction process, the keyboard data that has deposited impact damper in is transferred to PC (510).Then the generation of check card insertion/ejection is so that be notified to PC (511) with assay.
Step 511 repeats.
The keyboard that has data processing function according to the present invention is operated in the above described manner.Therefore, the card data of PC request keyboard no matter when, PC can both be from keyboard receiving card reading of data.
As an alternative embodiment of the invention, will be described below the situation of keyboard applications in belief system.At Fig. 6 this situation is described.
Here, putting letter PC system only is meant just can uses PC or situation that can visit data behind card of having registered of identification.
In this case, whether the card of at first testing has inserted card holding device 33 (601).
If in card holding device 33, do not block, so the non-existent sign indicating number of indicating card is transferred to PC (605).Then system places stand-by state up to inserting card (606).
After receiving the message that card do not insert, the message that PC output request card inserts, and make monitor suspend other program implementation.
When being stuck in stand-by state when inserting, the card reading of data (608) of control section 31 from inserting, and give PC (609) with the data transmission that reads.
But when having card to insert, if run into "Yes" in step 601, whether control section 31 judges PC output card request of data instruction (602) so.If also do not receive the instruction of card request of data, execute key scans so, and the sign indicating number of institute's button is transferred to PC (603).Then carry out check to check the hot key (604) of whether pressing the request Card Reader.If also do not press hot key, just from step 601 beginning execution in step (existence of check card).If pressed hot key, with regard to Card Reader (608).
In step 602, if input card request of data instruction, just direct Card Reader (608).
The card data that then read are transferred to PC (609), and then system turn back to check card and exist/not step 601.
That is, under the situation of belief system, when the operation beginning, the at first insertion of verifying smart card.If inserted card, with regard to Card Reader to transmit data to PC.Then can carry out normal keyboard operation.In addition, in operating process, carry out check to check from PC whether received the card processing instruction.If the instruction of reception is arranged, then before carrying out the transmission of key scanning and key, at first carry out relevant treatment.
If therefore do not insert smart card, just can not carry out normal keyboard operation.In addition, in initial operation or no matter when during the instruction of input card request of data, Card Reader is given PC so that will block data transmission, and so has only those cards of having registered could visit PC.
The order code that is transferred to keyboard of the present invention from PC is divided into key processing instruction and card processing instruction.
The card processing instruction comprises the sign indicating number except key.Shown in Fig. 7 a, instruction comprises the data division of operation part and any byte of a byte.Response from PC simultaneously comprises: the part of expression respond style; With the expression section data.Data division can comprise or not comprise option.
Fig. 7 b describes in detail from PC and receives instruction process after the instruction of intelligent card in processing, and it is a part of Fig. 5 process flow diagram.At first receive an instruction (505), and judge that then the instruction that is received is intelligent card in processing instruction or key processing instruction (506) from PC.If it is the key processing instruction, just handle key instruction (507).On the other hand, if instruction is the intelligent card in processing instruction, just at first reads card processing instruction (508a), and then receive data options (508b).Then according to the instruction of therefore reading, and, that is,, control signal is offered card holding device 33 based on the instruction of control section 31 based on the card processing instruction of reality.By being controlled by this control signal, card holding device 33 operations are so that whether check provides data or response signal (508c).Then result is transferred to PC, finishes the execution (508d) of card processing instruction thus.
Fig. 8 is the process flow diagram that is illustrated in the communication means that card is handled between keyboard and the PC.
From the card processing instruction of PC comprise except the sign indicating number of keyboard yard.For example, the LED set/reset state indicator (0xed) that provides of the LED that can use at keyboard.That is, if provide twice set/reset state indicator (0xed) from PC, and if the data of coming subsequently be 0x07 and 0x00 (801 and 802), so just recognizing provides the card processing instruction.Therefore, prepare card control.If set/reset state indicator (0xed) is provided then once more, and if the next data that receive are 0xa5 (803), just the instruction and data execute card that provides based on the next one instructs.
Then the card deal with data that has received from PC is handled by control section 31.Then by using scan code to give PC with response transmission.In this case, the card deal with data is placed between " [" and "] ".
As the pith of card control data, have the existence of card/not affirmation, card data read and ID request of data.For example, if the ID of PC request card, the microprocessor 311 of control section 31 just reads ID signal and offers card holding device 33.If therefore card holding device 33 will read ID and offer microprocessor 311, microprocessor 311 just sends to PC with the ID that receives.The then ID and the registered ID that relatively receive of PC, and if two ID mutually the same, just allow to use PC.If two ID are inequality, just or do not allow to use PC, perhaps ID is identified as the electronic transaction or the means of similarly paying the bill.
According to above-mentioned the present invention, key data and card data are transmitted by single PS/2 line, and have therefore solved the interface problem between smart card and PC.Therefore reduced the PC control load.In addition, in this process, use a controller and an order wire, and therefore not only reduced expense, also improved space utilization, also guarantee convenience.In addition, keyboard of the present invention also can be applied to belief system, so that can guarantee security.