[0001] The present invention relates to a portable electronic device such as an IC card
having a function of supporting two or more communication protocols.
[0002] An IC card is available as a conventional portable recording medium. This IC card
comprises a ROM for storing control programs, a data memory for storing various types
of data, a CPU for performing various control operations on the basis of the control
programs stored in the ROM, and contacts brought into electrical contact with an external
device to exchange data therewith. A communication protocol for performing data communication
with the external device is stored in the ROM.
[0003] In recent years, IC cards are used in a variety of applications. The IC cards must
exchange data with various external devices such as bank terminals and credit terminals
at different positions. For this reason, a plurality of communication protocols are
prepared in advance, and a desired communication protocol is appropriately selected.
Demand has arisen for an IC card capable of accurately performing communication with
external devices having different types of communication protocols.
[0004] In a system including this IC card and external devices, a desired communication
protocol used at the time of data communication in the system must be selected and
designated at the start time of the system. In any case, even a frequently used communication
protocol cannot be used without performing predetermined procedures for designating
the communication protocol.
[0005] As described above, in a conventional portable electronic device compatible with
a plurality of protocols, a user must designate a communication protocol prior to
data communication. Data communication cannot therefore be started at the start time
of the system, resulting in inconvenience.
[0006] It is, therefore, an object of the present invention to provide a portable electronic
device compatible with a plurality of protocols and capable of starting data communication
at the start time of a system.
[0007] In order to achieve the above object of the present invention, there is provided
a portable electronic device comprising means for storing different types of communication
protocols, priority order setting means for setting a priority order for the different
types of communication protocols stored in the storing means, means for selecting
a predetermined communication protocol from the different types of communication protocols
on the basis of the priority order set by the priority order setting means, and communicating
means for performing communication using the predetermined communication protocol
selected by the selecting means.
[0008] A priority order is preset for the plurality of communication protocols stored in
the storing means of the electronic portable device. At the start time of a system,
a communication protocol having the highest priority is automatically selected. Consequently,
when the communication protocol having the highest priority is used, data communication
can be started simultaneously with the start of the system.
[0009] This invention can be more fully understood from the following detailed description
when taken in conjunction with the accompanying drawings, in which:
Fig. 1 is a block diagram showing an internal arrangement of an IC card according
to an embodiment of the present invention;
Figs. 2A and 2B are flow charts for explaining processing flows for performing data
communication with the IC card shown in Fig. 1;
Fig. 3 is a flow chart for explaining an operation of an external device shown in
Fig. 1;
Fig. 4 is a flow chart for explaining a processing flow for updating initial data
in the IC card shown in Fig. 1; and
Fig. 5 is a view showing a format of an initial data updating command.
[0010] An IC card according to an embodiment of the present invention will be described
below with reference to the accompanying drawings.
[0011] An internal arrangement of IC card 1 according to this embodiment will be described
with reference to Fig. 1. IC card 1 incorporates mask ROM 2 for storing control programs,
data memory 3 constituted by an EEPROM and/or a battery backed-up RAM for storing
various types of data, CPU 4 for performing various control operations on the basis
of the contents of the control programs in mask ROM 2, contact portion 5 brought into
electrical contact with external device 7 such as a reader/writer to perform data
exchange with external device 7, and communication I/O circuit 6 for communicating
with external device 7 with a predetermined communication protocol at a predetermined
baud rate.
[0012] Two different protocols A and B for performing communication are stored in mask ROM
2. When IC card 1 is to communicate with external device 7, CPU 4 performs communication
control in accordance with protocol A or B stored in mask ROM 2. RAM 40 is incorporated
in CPU 4.
[0013] An operation for causing IC card 1 to perform data communication with external device
(reader/writer) 7 will be described with reference to Figs. 2A to 5.
[0014] CPU 4 reads out data at address $0000 of data memory 3 to determine whether the upper
nibble of this readout data is 0
H (step ST1) where "H" indicate hexadecimal notation. An asterisk of 0*H in step ST1
indicates a wildcard character which can be substituted with an arbitrary number.
[0015] If the upper nibble of address $0000 is 0
H, CPU 4 determines that IC card 1 supports only protocol A or B (to be referred to
as case 1 hereinafter), and processing starting from step ST2 to be described later
is performed.
[0016] If the upper nibble of the data at address $0000 of data memory 3 is a value except
for 0
H, CPU 4 determines that IC card 1 supports two different protocols A and B and that
protocol A or B can be designated by an external device (to be referred to as case
2 hereinafter). In this case, processing starting from step ST14 to be described later
is performed.
[0017] Note that an address in step ST1 may be any value other than $0000 and may be exemplified
by $FFFF. In this case, F*H is checked in step ST1, and *FH is checked in step ST2
or ST14.
[0018] Processing under the condition that IC card 1 supports either protocol A or B, i.e.,
case 1, will be described with reference to Fig. 2A. IC card 1 receives a power and
a clock signal from external device 7 and is controlled by CPU 4.
[0019] Prior to data communication, a reset signal is supplied from external device 7 to
CPU 4. When this reset signal is disabled, initial data called "Answer to Reset" (ANS-TO-RESET)
is output from CPU 4 in IC card 1 to external device 7. The "Answer to Reset" information
includes data defining the type of communication protocol supported by IC card 1.
External device 7 receives "Answer to Reset" information and checks the communication
protocol used with IC card 1 (cf. ISO/IEC DIS 7816-3).
[0020] Fig. 3 is a flow chart for explaining how external device 7 communicates with IC
card 1.
[0021] When the "Answer to Reset" information is output from IC card 1 (steps ST3 and ST6
in Fig. 2A or steps ST15 and ST21 in Fig. 2B), external device 7 receives this "Answer
to Reset" information (step ST201). A protocol used until the "Answer to Reset" information
is output is standardized in accordance with ISO standards. This "Answer to Reset"
information includes data representing the protocol supported by IC card 1.
[0022] External device (e.g., a bank terminal or a credit terminal) 7 supports one protocol.
A CPU (not shown) in external device 7 checks (step ST202) on the basis of the input
"Answer to Reset" information whether its own protocol is supported by IC card 1.
[0023] If the protocol of external device 7 is supported by IC card 1 (YES in step ST202),
external device 7 outputs information for selecting its own protocol (step ST203)
and then outputs various commands to IC card 1 (step ST204). If the protocol of external
device 7 is not supported by IC card 1 (NO in step ST202), error information is output
(step ST205).
[0024] That is, on the basis of protocol selection information from external device 7, IC
card 1 sends "Answer to Reset" information including the data representing the protocol
supported by this IC card 1. Therefore, one of the plurality of protocols supported
by this IC card is selected by external device 7.
[0025] IC card 1 can correspond to different types of protocols supported by different types
of external devices 7 in the arrangement of Fig. 1 and the processing operations of
Figs. 2A and 2B. Each external device 7 automatically switches and selects one of
the protocols from IC card 1 which supports multi-protocols.
[0026] Protocol switching is mainly assumed as switching between the IC card protocol and
basic procedures of processing performed using an IC card. A semiduplex block transmission
scheme is used as the IC card protocol.
[0027] Referring back to Fig. 2A, CPU 4 in IC card 1 reads out data at address $0000 of
data memory 3 before CPU 4 outputs the "Answer to Reset" information to external device
7. After CPU 4 determines (step ST1) that the upper nibble of the data is 0H, CPU
4 determines (step ST2) whether the lower nibble of the data is 0
H.
[0028] If the lower nibble of address $0000 is set to be 0
H, CPU 4 outputs the "Answer to Reset" information representing that the "communication
protocol is protocol A" (step ST3). In protocol A, control transits to a state for
waiting a command from external device 7 (step ST4). The command waiting state is
maintained in protocol A until any command input is entered (step ST5).
[0029] If the lower nibble at address $0000 is any value other than 0
H in step ST2, CPU 4 outputs the "Answer to Reset" information representing that the
"communication protocol is protocol B" (step ST6). CPU 4 is then set in an external
command waiting state in protocol B (step ST7). In this case, CPU 4 continues the
command waiting state in protocol B until any command input is entered (step ST8).
[0030] When CPU 4 receives a command (cf. step ST204 in Fig. 3) from external device 7,
CPU 4 determines (step ST9) whether this command is a data communication end command.
If this command is determined not to be a data communication end command, processing
corresponding to the determined command is performed (step ST10). CPU 4 checks the
value of address $0000 in data memory 3 to check if the lower nibble of the data is
0
H (step ST11).
[0031] If the lower nibble of address $0000 is 0
H in step ST11, a processing result is output to the external device in protocol A
(ST12), and CPU 4 returns to the command waiting state in protocol A in step ST3 described
above. If the lower nibble of address $0000 is a value other than 0
H in step ST11, a processing result is output to the external device in protocol B
(step ST13). CPU 4 then returns to the command waiting state in protocol B in step
ST6.
[0032] In step ST9, if the received command is the data communication end command, CPU 4
ends data communication processing.
[0033] Data communication processing of IC card 1 under the condition that IC card 1 supports
two different communication protocols and one of them can be designated by the external
device, i.e., case 2, will be described with reference to Fig. 2B.
[0034] IC card 1 receives external power and an external clock signal to set CPU 4 operative,
as described above. After the reset signal is disabled, CPU 4 reads out data at address
$0000 and determines (step ST1) whether the upper nibble of the data at address $0000
is any value other than 0
H. CPU 4 determines (step ST14) whether the lower nibble of the data is 0
H.
[0035] In this case, if the lower nibble of the data at address $0000 is 0
H, CPU 4 outputs "Answer to Reset" information representing protocol A as a protocol
having the first priority (to be referred to as the first protocol hereinafter) and
protocol B as a protocol having the second priority (to be referred to as the second
protocol hereinafter) to external device 7 (step ST15). Data "00
H" is stored at a specific address of RAM 40 in CPU 4 (step ST16), and CPU 4 is set
in protocol A in a state for receiving a command from the external device (step ST17).
[0036] When CPU 4 receives any data in the command waiting state in protocol A, CPU 4 determines
(step ST18) whether the input data is PTS (Protocol Type Selection) data for selecting
a communication protocol.
[0037] If the received data is the protocol type selection data (PTS data), CPU 4 determines
(step ST19) whether the PTS data is data for designating protocol B. If so, data "01
H" is stored at a specific address of the RAM in CPU 4 (step ST22), and CPU 4 is set
in a command waiting state with protocol B in step ST23 (to be described later).
[0038] If the received data is not PTS data in step ST18 or the PTS data is not the PTS
data for designating protocol B in step ST19, CPU 4 determines (step ST20) whether
the received data is a command. If NO in step ST20, CPU 4 is set in a command waiting
state in protocol A (step ST17).
[0039] In step ST14, if the lower nibble of the data at address $0000 is a value other than
0
H, CPU 4 outputs to external device 7 "Answer to Reset" information representing protocol
B as the first protocol and protocol A as the second protocol (step ST21), and data
"01
H" is stored at a specific address of the RAN in CPU 4 (step ST22). CPU 4 is then set
in an external command waiting state in protocol B (step ST23).
[0040] When CPU 4 receives any data in the command waiting state in protocol B, CPU 4 determines
(step ST24) whether the data is protocol type selection data (PTS data). If the received
data is determined to be PTS data, CPU 4 determines (step ST25) whether the PTS data
is data for designating protocol A. If YES in step ST25, data "00
H" is stored at a specific address of RAM 40 in CPU 4 (step ST16). CPU 4 is set in
the command waiting state in protocol A in step ST17 described above.
[0041] If the received data is not PTS data in step ST24 or the PTS data is not PTS data
for designating protocol A in step ST25, CPU 4 determines (step ST26) whether the
subsequently received data is a command. If NO in step ST26, CPU 4 is set in the command
waiting state in protocol B again (step ST23).
[0042] When CPU 4 determines in steps ST20 and ST26 that the data received from external
device 7 is a command, CPU 4 determines (step ST27) whether the command is a data
communication end command. If NO in step ST27, processing of this command is performed
(step ST28). The content of the specific address of RAM 40 incorporated in CPU 4 is
checked (step ST29).
[0043] If the content of the specific address of RAM 40 is 00
H, a command processing result is output in protocol A (step ST30). CPU 4 is set in
the command waiting state in protocol A in step ST17 described above. If the content
of the specific address of RAN 40 is not 00
H, a command processing result is output in protocol B (step ST31). CPU 4 is then set
in the command waiting state in protocol B in step ST23 described above.
[0044] If CPU 4 determines in step ST27 that the received command is a data communication
end command, data communication processing is ended.
[0045] A communication baud rate (9,600 bps, 4,800 bps, or 1,200 bps) with external device
7 can be set simultaneously when a protocol is set in steps ST4, ST7, ST15, and ST21.
[0046] Hardware of a variable baud rate (multi-baud rate) can be performed by changing the
frequency of a communication clock in I/O circuit 6.
[0047] When data communication is to be performed between IC card 1 and external device
7, CPU 4 in IC card 1 refers to the data content at address $0000 of data memory 3
as initial data (step ST1) and determines whether protocol A or B is used in data
communication on the basis of the initial data. In order to change the communication
protocol, the initial data (0*H) in memory 3 must be updated. This processing will
be described with reference to Fig. 4.
[0048] In order to update the initial data, an initial data updating command having a format
shown in Fig. 5 is sent from external device 7 to CPU 4 in IC card 1. This command
consists of function code FC representing that a change is to be made in initial data,
and data DA to be updated. When CPU 4 in IC card 1 receives this command, data DA
is written at address $0000 of data memory 3 (step ST101) and checks (step ST102)
whether the data is properly written. If YES in step ST102, a response indicating
OK is generated (step ST103). Otherwise, a response indicating a write error is generated
(step ST104).
[0049] The generated response is output to external device 7 in accordance with processing
result output processing (step ST12 or ST13 in case 1 and step ST30 or ST31 in case
2). By using this command, for example, the communication protocol (A or B) supported
by IC card 1 can be changed from external device 7 even in case 1.
[0050] As described above, IC card 1 of this embodiment can change the communication protocol
from the side of external device 7 in accordance with the specifications of external
device 7 which performs data communication. Accurate data communication can be performed
with external devices 7 having different types of communication protocol. Therefore,
versatility of the IC card can be improved, and a system using an IC card can be flexibly
arranged.
[0051] Selection or switching of a baud rate and/or a communication protocol can be performed
by external device 7. Even if a plurality of terminals having different communication
protocols and baud rates are connected to each other and data is exchanged therebetween,
accurate data communication can be performed by switching to a proper communication
protocol and a proper baud rate.
[0052] Assuming that a plurality of communication protocols can be supported (NO in steps
ST1 in Fig. 2A; Fig. 2B), a priority order is given to these plurality of protocols
(A and B) and a communication protocol (e.g., A) having a higher priority can be selected
by default. For example, if communication protocol A which is more frequently used
has a higher priority (i.e., protocol A has a higher priority if $0000 = *0H in step
ST4 of Fig. 2B), data communication can be automatically performed in communication
protocol A, which is more frequently used, at the start time of the system.
[0053] IC card 1 of this embodiment may support a plurality of protocols (A and B) or only
one communication protocol (either A or B). Even if IC card 1 is set to support only
one communication protocol (YES in step ST1 of Fig. 2A), the type of communication
protocol (A or B) can be changed by the procedures in Fig. 4. An IC card which is
used for only one terminal can be set to support only one communication protocol (e.g.,
only protocol A) for this terminal.
[0054] In addition, various setup operations and changes can be very easily performed by
only updating the content of address $0000 of data memory 3 from external device 7
in accordance with the procedures in Fig. 3.
[0055] The number of types of communication protocols supported by an IC card is not limited
to two. An IC card can have three or more communication protocols, and these protocols
can be appropriately selected and used.
[0056] The portable electronic apparatus of the present invention, as has been described
above, can automatically select a communication protocol (A) having the highest priority
at the start time of the IC card under the condition that a priority order (A > B)
is set for a plurality of communication protocols stored in storing means (2). For
this reason, when data communication is performed using the communication protocol
(A) having the highest priority, data communication can be started simultaneously
when the system is started.
1. A portable electronic device connectable to an external device, comprising:
first storing means (2) for storing software programs respectively using different
communication protocols (A and B);
second storing means (3) for storing prescribed information (O*H, *OH) serving
to discriminate a specific protocol (A or B) which is to be used by the portable electronic
device (1) for a communication with the external device (7);
means (4) for discriminating the specific protocol (A or B) from the programs stored
in said first storing means (2) in accordance with the prescribed information (O*H,
*OH) stored in said second storing means (3); and
means (5, 6) for supplying the external device (7) with data (PTS data at ST18,
ST24) indicating said specific protocol to be used for the communication.
2. A portable electronic device according to claim 1, characterized by further comprising:
means (4) for updating the prescribed information (O*H, *OH) stored in said second
storing means (3) in accordance with a command (Fig. 5) delivered from the external
device (7).
3. A portable electronic device according to claim 1, characterized in that said second
storing means (3) includes:
a first area for storing first prescribed information (O*H) used to determine (ST1)
whether only one protocol is employed for said specific protocol (A or B); and
a second area for storing second prescribed information (*OH) used to check (ST2)
a content of the one protocol (A or B) when only one protocol is employed for said
specific protocol (A or B).
4. A portable electronic device according to claim 3, characterized in that said discriminating
means (4) includes means (ST1, ST2, ST14) for determining whether only one protocol
is to be employed for said specific protocol (A or B) in accordance with the prescribed
information (O*H) stored in said second storing means (3), to thereby provide a determining
result (Y/N at ST1, ST2, ST14); and
said supplying means (5, 6) includes means (6) for sending data representing said
different communication protocols (A and B) which are to be used for the communication,
in accordance with the determining result (Y/N at ST1, ST2, St14) provided by said
determining means (ST1, ST2, ST14).
5. A portable electronic device according to claim 4, characterized in that said second
storing means (3) includes:
a third area for storing priority order information (priority of A > priority of
B) with respect to a priority of each of said different communication protocols (A
and B); and
said supplying means (5, 6) includes means (6; ST15, ST21) for sending said priority
order information as well as said different communication protocols (A and B) to be
used for the communication, in accordance with the determining result (Y/N at ST1,
ST2, ST14) provided by said determining means (ST1, ST2, ST14).
6. An IC card system employing an IC card connectable to an external device, said IC
card (1) comprising:
first storing means (2) for storing a plurality of programs respectively using
different communication protocols (A and B);
second storing means (3) for storing prescribed information (O*H, *OH) serving
to discriminate communication protocols (A and B) of the programs stored in said first
storing means (2); and
means (5, 6) for supplying the external device (7) with data (PTS) indicating said
specific protocol to be used for the communication, and
said external device (7) comprising:
means (ST203) for selecting one of the communication protocols (A and B) in accordance
with the specific protocol indicating data (PTS) supplied by said supplying means
(5, 6), to thereby provide a result of selecting; and
means (ST204) for sending the result provided by said selecting means (ST203) to
said IC card (1), so that the external device (7) communicates with the IC card (1)
using the one communication protocol (A or B) selected by said selecting means (ST203).