home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / etc / misc / howchips.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  45.3 KB  |  2,121 lines

  1. ===============================================================================
  2.  
  3.              What you need to know about electronics telecards
  4.  
  5. ===============================================================================
  6.  
  7.                  Version 1.18 (Last revised: 08-09-1995)
  8.  
  9.  
  10.  
  11.                     (C) Stephane BAUSSON - (93,94,95)
  12.  
  13.  
  14.  
  15.                             4, Rue de Grand
  16.  
  17.                            F-88630 Chermisey
  18.  
  19.                                 France
  20.  
  21.  
  22.  
  23.  
  24.  
  25. -------------------------------------------------------------------------------
  26.  
  27. >>> Any suggestions or comments about phonecards and smartcards are welcome <<<
  28.  
  29. -------------------------------------------------------------------------------
  30.  
  31.  
  32.  
  33. This file is archived at nic.funet.fi:/pub/doc/telecom/phonecard/chips
  34.  
  35.  
  36.  
  37. Thanks to the following people:
  38.  
  39. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  40.  
  41.    Kimble
  42.  
  43.    XRed                   xxxxxx@etsit.upv.es
  44.  
  45.    Proux Jean-Philippe ## proux@idr
  46. l@hut.fi
  47.  
  48.    Gerrit Telkamp      ## telkamp@eis.cs.tu-bs.de
  49.  
  50.    Martin Schulte      ## schulte@thp.Uni-Koeln.DE
  51.  
  52.    Georges Zotos       ## picard@hol.ath.forthnet.gr
  53.  
  54.    Ales "MCA" Markarov ## xmarkarov@sun.felkcvut.cz
  55.  
  56.    Toni Cebrian        ## acebrian@etsit.upv.es
  57.  
  58.  
  59.  
  60. Document History:
  61.  
  62. ~~~~~~~~~~~~~~~~
  63.  
  64.    V1.18 : New coutries:  Argentina, Burkina Faso, Cameroon, Croatia,
  65.  
  66.            Djibouti, Gambia, Hungary, Mali, Mexico (Telmex), Morocco,
  67.  
  68.            French Polynesia, New Caledonia, St Maarten, Slovakia.
  69.  
  70.    V1.17 : Greek Serial Number added.
  71.  
  72.    V1.16 : German Telefonkarte Serial Number.
  73.  
  74.    V1.15 : New readers (Telecards+ISO7816 cards).
  75.  
  76.    V1.14 : New 512 bit Greek telecards + modification of Mexican cards.
  77.  
  78.    V1.13 : Checksums for french cards + modification for 'G+D' spanish cards.
  79.  
  80.    V1.12 : Chip builder code added.
  81.  
  82.    V1.11 : Croatian cards added.
  83.  
  84.    V1.10 : Romanian telecards added.
  85.  
  86.    V1.09 : Spanish card reading.
  87.  
  88.    V1.08
  89. for greek cards.
  90.  
  91.    V1.07 : Modification of the 5 stage octal counter for 128 bit cards.
  92.  
  93.    V1.06 : Schematic of a new reader [DELETED].
  94.  
  95.    V1.02 : Introduction of the German cards.
  96.  
  97.    V1.00 : First version of the document.
  98.  
  99.  
  100.  
  101. Glossary of terms:
  102.  
  103. ~~~~~~~~~~~~~~~~~~
  104.  
  105.    [TBC] : to be confirmed
  106.  
  107.    [TBD] : to be defined
  108.  
  109.  
  110.  
  111.    b(i) : Bit i
  112.  
  113.    B(I) : Byte I
  114.  
  115.    x^y  : x at the power y  (in mathematical expresssions)
  116.  
  117.  
  118.  
  119. -------------------------------------------------------------------------------
  120.  
  121.  
  122.  
  123.                                * Content *
  124.  
  125.                                ~~~~~~~~~~~
  126.  
  127.  
  128.  
  129. I ) The 1st generation Telecards:
  130.  
  131.  
  132.  
  133.    1.1 - Introduction:
  134.  
  135.    1.2 - SCHEMATICS of the chip:
  136.  
  137.    1.3 - PINOUT of the connector:
  138.  
  139.    1.4 - Main features:
  140.  
  141.    1.5 - TIME DIAGRAMS:
  142.  
  143.    1.6 - Memory Map for cards from FRANCE and MONACO:
  144.  
  145.    1.7 - Memory Map for cards from other countries:
  146.  
  147.    1.8 - Memory Map for cards from SPAIN, CROATIA and MEX
  148.  
  149.  
  150.  
  151.  
  152. II ) The 2nd and 3rd generations Telecards:
  153.  
  154.  
  155.  
  156.    2.1 - Introduction:
  157.  
  158.    2.2 - Pinout:
  159.  
  160.    2.3 - Main features:
  161.  
  162.    2.4 - Time Diagrams:
  163.  
  164.    2.5 - Memory Map:
  165.  
  166.  
  167.  
  168.      2.5.1 - Memory Map for 5 satge octal unit counter:
  169.  
  170.      2.5.2 - Memory Map for 4 satge octal unit counter:
  171.  
  172.      2.5.3 - Memory Map for new 512 bit Greek telecards
  173.  
  174.  
  175.  
  176.    2.6 - Electrical features:
  177.  
  178.  
  179.  
  180.  
  181.  
  182. III) Schematics of Readers:
  183.  
  184.  
  185.  
  186.    3.1 - Reader 1 (very simple one, only for telecards)
  187.  
  188.    3.2 - Reader 2 (for telecards and ISO7816 cards too)
  189.  
  190.  
  191.  
  192.  
  193.  
  194. -------------------------------------------------------------------------------
  195.  
  196.  
  197.  
  198. I ) The 1st generation Telecards:
  199.  
  200.     ============================
  201.  
  202.  
  203.  
  204.    1.1 - Introduction:
  205.  
  206.          ~~~~~~~~~~~~
  207.  
  208.  
  209.  
  210.        Since the middle of 80's have appeared a new generation of cards  ( the
  211.  
  212. smart-cards  or  chip cards )  that have  replaced most of the magnetics cards
  213.  
  214. applications  notably  for  telecom payement an
  215. e magnetics cards, and there are several kind
  216.  
  217. of  cards following  the application.  The simplier ones are the Simple Memory
  218.  
  219. cards  like the  one used as  Telecard  for the telecom payement in the public
  220.  
  221. phone-booths  ( Generaly all the memory content is  readable,  and there  is a
  222.  
  223. maker-area that is unwritable ) , then there are  more sofisticated  cards:
  224.  
  225. Memeory Cards with some area read protected by a key, these cards can  contain
  226.  
  227. some  private informations in  the read-protected area.   At the end there are
  228.  
  229. microprocessor-cards (cards working following the ISO-7816 protocol), that are
  230.  
  231. the safiest ones  since these cards  have their own internal  Operating System
  232.  
  233. that prevent  I/O  if the PIN (Personal Idenfication Number) has not been ent-
  234.  
  235. -ered in the cards before ( These cards are used  when confidentiality is
  236.  
  237. needed,  like in  credit cards (bank), crypted TV access cards, health cards,
  238.  
  239. SIM cards for GSM, etc ... ).
  240.  
  241.  
  242.  
  243.  
  244.  
  245.        About tele
  246.  the less safe ones, don't think
  247.  
  248. that  you  are  going  to  phone freely for that, in fact no.  All the data are
  249.  
  250. readable since  there are  no confidential data inside, the cards are well done
  251.  
  252. enough to be  very secure for  the payement of telecom communications in public
  253.  
  254. booth.
  255.  
  256.  
  257.  
  258.        So, what is a phonecard exactly ? In fact generaly it's a 256 bits EPROM
  259.  
  260. ( French likde cards ),  or a 128 bits EEPROM (German like cards) with a serial
  261.  
  262. output and some other control pins.
  263.  
  264.  
  265.  
  266.        Then why can it not be refilled ?   Well,  indeed to refill the card you
  267.  
  268. will  have to erase the cards with UV,  knowing that the cards is coated in  UV
  269.  
  270. opaqued resin that prevent  UV from reaching the silicium chip, and even if you
  271.  
  272. could  to erase the chip  you will have to program the manufactuer area that is
  273.  
  274. write-protected by a lock-out fuse that was fused after the card programming in
  275.  
  276. factory.
  277.  
  278.  
  279.  
  280.        Neithertheless it can be very interesting to study how
  281. kind of data are inside and  how the data are maped  inside or to
  282.  
  283. see  how many units are left  inside for exemple.  Besides  there  are a  great
  284.  
  285. number of  applications of  these cards when there  are used (only for personal
  286.  
  287. use of course) , since  you can use them as key to open a door, or you can also
  288.  
  289. use them as key to secure a program, etc ....
  290.  
  291.  
  292.  
  293.        French Telecards have been created in 1984 and at this time constructors
  294.  
  295. decided to build these cards in NMOS technology but now, they plan to change by
  296.  
  297. 1994 all readers  in the public booths  and use CMOS technology. Also they plan
  298.  
  299. to use  EEPROM to secure the cards and to add many usefull infornations in, and
  300.  
  301. you will perhaps use phone cards to buy you bread or any thing else.
  302.  
  303.  
  304.  
  305. These cards are called Second Generation Telecards.
  306.  
  307.  
  308.  
  309.  
  310.  
  311.    1.2 - SCHEMATICS of the chip:
  312.  
  313.          ~~~~~~~~~~~~~~~~~~~~~~
  314.  
  315.  
  316.  
  317.         .-----------------.
  318.  
  319.       --|>_ Clk           |
  320.  
  321.       --| R/W
  322.    --| Fuse            |
  323.  
  324.       --| Vpp             |
  325.  
  326.         '-,             ,-'
  327.  
  328.         .-'-------------'-.
  329.  
  330.         |             Out |-- serial output
  331.  
  332.         '-----------------'
  333.  
  334.  
  335.  
  336.  
  337.  
  338.    1.3 - PINOUT of the connector:
  339.  
  340.          ~~~~~~~~~~~~~~~~~~~~~~~
  341.  
  342.  
  343.  
  344.  
  345.  
  346.                                AFNOR CHIP
  347.  
  348.                                ----------
  349.  
  350.         Afnor Position                              ISO position
  351.  
  352.    (in the left top corner)                     (in the middle left)
  353.  
  354.  
  355.  
  356. ,-------------+-------------,               ,-------------+-------------,
  357.  
  358. |   8         |         4   |               |   1         |         5   |
  359.  
  360. +-------\     |     /-------+               +-------\     |     /-------+
  361.  
  362. |   7    +----+----+    3   |               |   2    +----+    +    6   |
  363.  
  364. +--------|         |--------+               +--------|         |--------+
  365.  
  366. |   6    +    +----+    2   |               |   3    +----+----+    7   |
  367.  
  368. +-------/     |
  369.   \-------+
  370.  
  371. |   5         |         1   |               |   4         |         8   |
  372.  
  373. '-------------+-------------'               '-------------+-------------'
  374.  
  375.  
  376.  
  377. NB: only the position of the chip is ISO standardized and not the pinout.
  378.  
  379.  
  380.  
  381. PINOUT:   1 : Vcc = 5V     5 : Gnd
  382.  
  383. ~~~~~~    2 : R/W          6 : Vpp = 21V   (*)
  384.  
  385.           3 : Clock        7 : I/O
  386.  
  387.           4 : RAS          8 : Fus         (*)
  388.  
  389.  
  390.  
  391.   (*) Not used with the new G+D cards compatible with the 256 bit memory
  392.  
  393.       Exemple: spannish G+D cards.
  394.  
  395.  
  396.  
  397.  
  398.  
  399.    1.4 - Main features:
  400.  
  401.          ~~~~~~~~~~~~~
  402.  
  403.  
  404.  
  405.        - Synchronous protocol.
  406.  
  407.        - N-MOS technology or CMOS for the new ones.
  408.  
  409.        - 256x1 bit organisation.
  410.  
  411.        - 96 written protected by a lock-out fuse.
  412.  
  413.        - Low power 85mW in read mode.
  414.  
  415.        - 21 V programming voltage.
  416.  
  417.        - Access time: 500ns
  418.  
  419.        - Operating range: -10°C +70°C
  420.  
  421.        - Ten year data rentention.
  422.  
  423.  
  424.  
  425.  
  426.  
  427.    1.5 - Tim
  428. lumberger, Solaic, Gemplus
  429.  
  430.        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  431.  
  432.  
  433.  
  434. +21V                                     _____________
  435.  
  436. +5V ____________________________________|             |_________________ VPP
  437.  
  438.                                         :             :
  439.  
  440. +5V                  ___________________:_____________:_________________ ___
  441.  
  442. 0V  ________________|                   :             :                  RST
  443.  
  444.                     :                   :             :
  445.  
  446. +5V     ____        :      ____         :       ______:______
  447.  
  448. 0V  ___|    |_______:_____|    |________:______|      :      |__________ CLK
  449.  
  450.        :    :       :     :    :        :      :      :      :
  451.  
  452. +5V    :    :       :     :    :        :______:______:      :           _
  453.  
  454. 0V  ___:____:_______:_____:____:________|      :      |______:__________ R/W
  455.  
  456.        :    :       :     :    :        :      :      :      :
  457.  
  458. +5V    :    :       :_____:    :________:      :      :      :__
  459. X_____XXXXXX________XXXXXXXXXXXXXXXXXXXXXX__________ OUT
  460.  
  461.        :    :       :     :    :        :<-----><---->:      :
  462.  
  463.        :    :       :     :    :        :10 to   10 to       :
  464.  
  465.        :    :       :     :    :        :50 ms   50ms        :
  466.  
  467.         Reset        Bit 1        Bit2                           Bit 3
  468.  
  469.         card        reading      reading  Bit2 writing to 1     reading
  470.  
  471.  
  472.  
  473.  
  474.  
  475. NOTE: Vpp Idle state is 5V, thus Vpp will have to be connected to Vcc to read
  476.  
  477.       the card.
  478.  
  479.  
  480.  
  481.  
  482.  
  483.    b - Cards from G+D (Spanish cards labeled with the 5th byte = $30)
  484.  
  485.        ~~~~~~~~~~~~~~
  486.  
  487.  
  488.  
  489. +5V                  ___________________________________________________ ___
  490.  
  491. 0V  ________________|                                                    RST
  492.  
  493.  
  494.  
  495. +5V     ____               ____                 _____________
  496.  
  497. 0V  ___|    |_____________|    |_______________|             |__________ CLK
  498.  
  499.        :    :             :    :               :             :
  500.  
  501.  
  502. _____:______       :           _
  503.  
  504. 0V  ___:____:_____________:____:________|      :      |______:__________ R/W
  505.  
  506.        :    :             :    :               :      :      :
  507.  
  508. +5V    :____:_____________:____:_______________:______:______:__________
  509.  
  510. 0V  XXXX    X_____________X    X_______________X      :      X__________ OUT
  511.  
  512.        :    :             :    :               :<---->:      :
  513.  
  514.        :    :             :    :               : 1 ms        :
  515.  
  516.        :    :             :    :               :             :
  517.  
  518.         Reset     Bit 1              Bit 2          Bit 2         Bit 2
  519.  
  520.         card     reading            reading      writing to 1    reading
  521.  
  522.  
  523.  
  524.  
  525.  
  526.    1.6 - Memory Map for cards from FRANCE, MONACO and St MAARTEN:
  527.  
  528.          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  529.  
  530.  
  531.  
  532. Byte (Bit)      Hexa
  533.  
  534.  
  535.  
  536.               +-----+
  537.  
  538. 1 (1..8)      |     | --> Checksum for bytes 2, 3, 4 (*)
  539.  
  540.               +-----+
  541.  
  542.               | $03 |
  543.  
  544.  
  545.  
  546.               | $05 |     Serial Number (1st byte)
  547.  
  548.               + - - +
  549.  
  550.               | $80 | --> St Maarten
  551.  
  552.               +-----+
  553.  
  554. 3 (17..24)    |     | --> Serial Number (2nd byte)
  555.  
  556.               +-----+
  557.  
  558. 4 (25..32)    |     | --> Serial Number (3rd byte)
  559.  
  560.               +-----+
  561.  
  562. 5 (33..40)    |     | --> checksum for bytes 6, 7, 8  (*)
  563.  
  564.               +-----+
  565.  
  566. 6 (41..48)    |     | --> Serial Number (4th byte)
  567.  
  568.               +-----+
  569.  
  570. 7 (49..56)    |     | --> Serial Number (5th byte)
  571.  
  572.               +-----+
  573.  
  574. 8 (57..64)    |     | --> ? [TBD]
  575.  
  576.               | $FF | --> St Maarten
  577.  
  578.               +-----+
  579.  
  580. 9 (65..72)    |     | --> checksum for byte 10, 11, 12 (*)
  581.  
  582.               +-----+
  583.  
  584. 10 (73..80)   |     | --> ? [TBD]
  585.  
  586.               | $FF | --> St Maarten
  587.  
  588.               +-----+
  589.  
  590. 11 (81..88)   | $10 | --> France and Monaco
  591.  
  592.               | $14 | --> St Maarten
  593.  
  594.               +-----+
  595.  
  596. 12 (33..40)   | $13 | --> 120 units
  597.  
  598.  
  599. 0 units
  600.  
  601.               +-----+
  602.  
  603. 13 (97..104)  |     | --> The units area: each time a unit is used
  604.  
  605.      .        |     |     then a bit is set to "1"; Usualy the 1st
  606.  
  607.      .        |     |     10 units are fused in factory for test.
  608.  
  609.      .        |     |
  610.  
  611.      .        |     |
  612.  
  613.      .        |     |
  614.  
  615. 31 (241..248) |     |
  616.  
  617.               +-----+
  618.  
  619. 32 (249..256) | $FF | --> $FF is set when all the units are used.
  620.  
  621.               +-----+
  622.  
  623.  
  624.  
  625. (*) checksum is calculated by the following expresion:
  626.  
  627.  
  628.  
  629.               max                | min=32*(j-1)+9
  630.  
  631.     $E3 - 4 * Sum b(i)     where | max=32*j
  632.  
  633.              i=min               | and j is the checksum number (1, 2 or 3)
  634.  
  635.  
  636.  
  637. NOTE: The card number is the concatenation in a single string of the 5 bytes
  638.  
  639.       written in hexadecimal.
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.    1.7 - Memory Map for cards from other countries:
  648.  
  649.          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  650.  
  651.  
  652.  
  653.  
  654.  
  655. Byte (Bit)     Hexa
  656.  
  657.  
  658.  
  659.               +--
  660.  --> Check Sum Byte = 216 - Sum b(i)
  661.  
  662.               +-----+                             i=9
  663.  
  664. 2 (9..16)     | $83 |  --> Telecard
  665.  
  666.               | $80 |  --> Other Applications (See below)
  667.  
  668.               | $9A |  --> PIAF card [TBC]
  669.  
  670.               | $C0 |  --> AVANT card [TBC]
  671.  
  672.               +-----+-----+
  673.  
  674. 3-4 (17..32)  | $1x | $xx |  --> Units+2
  675.  
  676.               | $11 | $52 |  --> Exemple for 150u
  677.  
  678.               + - - - - - +
  679.  
  680.               | $C0 | $25 |  --> 120u (Hungary)
  681.  
  682.               | $3D | $13 |  -->  80u (Morocco)
  683.  
  684.               | $DB | $B5 |  -->  40u (Morocco)
  685.  
  686.               +-----+-----+
  687.  
  688. 5 (33..40)    | $00 |  --> Schlumberger
  689.  
  690.               | $10 |  --> Solaic [TBC]
  691.  
  692.               | $30 |  --> Gemplus [TBC] (finnish cards)
  693.  
  694.               | $40 |  --> Gemplus
  695.  
  696.               +-----+
  697.  
  698. 6 (41..48)    |     |
  699.  
  700. 7 (49..56)    |     |
  701.  
  702. 8 (57..64)    |     |  --> Serial Number
  703.  
  704. 9 (65..72)    |     |
  705.  
  706. 10 (73..80)   |     |
  707.  
  708.  
  709. Djibouti
  710.  
  711.               |     | $16 |  --> French Polynesia
  712.  
  713.               | $11 | $1D |  --> French Cinécarte [TBC]
  714.  
  715.               |     | $1E |  --> Sweden
  716.  
  717.               |     | $30 |  --> Norway
  718.  
  719.               |     | $31 |  --> New Caledonia
  720.  
  721.               |     | $32 |  --> Cameroon
  722.  
  723.               |     | $33 |  --> Andorra
  724.  
  725.               |     | $39 |  --> Luxembourg
  726.  
  727.               |     | $3C |  --> Ireland
  728.  
  729.               |     | $3D |  --> Gambia
  730.  
  731.               |     | $47 |  --> Portugal
  732.  
  733.               |     | $55 |  --> Czech Republic / Yougoslavia [TBC]
  734.  
  735.               |     | $5C |  --> Argentina
  736.  
  737.               |     | $5D |  --> Burkina Faso
  738.  
  739.               |     | $5E |  --> Mali
  740.  
  741.               |     | $5F |  --> Gabon
  742.  
  743.               |     | $65 |  --> Finland
  744.  
  745.               |     | $86 |  --> Slovakia
  746.  
  747.               |     | $E0 |  --> Hungary
  748.  
  749.               |     | $E1 |  --> Cameroon (CamTel)
  750.  
  751.               |     | $E2 |  --> Mor
  752. .104)  |     |  --> The units area: each time a unit
  753.  
  754.      .        |     |      is used, then a bit is set to "1";
  755.  
  756.      .        |     |
  757.  
  758.      .        |     |      The first two units are fused in
  759.  
  760.      .        |     |      factory as test.
  761.  
  762.      .        |     |
  763.  
  764. 32 (249..256) |     |
  765.  
  766.               +-----+
  767.  
  768.  
  769.  
  770.  
  771.  
  772.    1.8 - Memory Map for cards from Argentina, Spain, Croatia and Mexico:
  773.  
  774.          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  775.  
  776.    The spanish telecards are made from different manufacturers, and these cards
  777.  
  778.    should be read and written with a different protocol following the 5th byte
  779.  
  780.    of the memory (see subclause 1.6-a for the cards with the 5th byte=$90 and
  781.  
  782.    see the subclause 1.6-b for the cards with the 5th byte=$30).
  783.  
  784.  
  785.  
  786.  
  787.  
  788. Byte (Bit)       Binary    Hexa
  789.  
  790.  
  791.  
  792.               +-----------+-----+                            96
  793.  
  794. 1 (1..8)      |           |     | ---> Checksum byte = 216 - Sum b(i)
  795.  
  796.  
  797.          i=9
  798.  
  799. 2 (9..16)     | 1000 0011 | $83 | ---> Telecard
  800.  
  801.               +-----------+-----+
  802.  
  803. 3 (17..24)    | 1111 1111 | $FF |
  804.  
  805.               +-----------+-----+
  806.  
  807. 4 (25..32)    | 1111 1111 | $FF |
  808.  
  809.               +-----------+-----+
  810.  
  811. 5 (33..40)    | 1001 0000 | $90 | ---> Oberthur
  812.  
  813.               | 1001 1110 | $9E | ---> Oberthur (Argentina)
  814.  
  815.               | 0011 0000 | $30 | ---> G+D
  816.  
  817.               | 0101 1010 | $5A | ---> Gemplus
  818.  
  819.               +-----------+-----+
  820.  
  821. 6 (41..48)    |           |     |
  822.  
  823. 7 (49..56)    |           |     | ---> Serial Number (*)
  824.  
  825. 8 (57..64)    |           |     |
  826.  
  827.               +-----------+-----+-----------+-----+
  828.  
  829. 9-10 (65..80) | 0001 0100 | $14 | 1000 1010 | $8A | --> 1000 pesetas (spain)
  830.  
  831.               | 0010 0101 | $25 | 0000 0100 | $04 | --> 2000 pesetas (spain)
  832.  
  833.               | 0010 0101 | $25 | 0000 0110 | $06 | --> 2100 pesetas (spain)
  834.  
  835.               | 0001 0100 | $14 | 1100 1010 | $CA | --> N$ 25.00 (Mexico
  836. 000 0011 | $03 | --> 25 (Argentina)
  837.  
  838.               | 0000 0000 | $00 | 0000 1010 | $0A | --> 100u (Croatia)
  839.  
  840.               | 0010 1010 | $2A | 0010 0101 | $85 | --> 1000u (Croatia)
  841.  
  842.               +-----------+-----+-----------+-----+
  843.  
  844. 11 (81..88)   | 0001 1110 | $1E |
  845.  
  846.               +-----------+-----+
  847.  
  848. 12 (89..96)   | 0010 0010 | $22 | --> Spain
  849.  
  850.               | 0010 0100 | $24 | --> Mexico
  851.  
  852.               | 0010 0110 | $26 | --> Croatia
  853.  
  854.               | 0010 1000 | $28 | --> Argentina
  855.  
  856.               +-----------+-----+
  857.  
  858. 13 (97..104)  | 1111 1111 | $FF | ---> the first 10 units are fused
  859.  
  860.     .         | 11xx xxxx | $xx |      in factory for testing.
  861.  
  862.     .         | xxxx xxxx | $xx |
  863.  
  864.     .         | xxxx xxxx | $xx | ---> Slow counter area
  865.  
  866.     .         | xxxx xxxx | $xx |
  867.  
  868.     .         +-----------+-----+
  869.  
  870.     .         | xxxx xxxx | $xx |
  871.  
  872.     .         | xxxx xxxx | $xx | ---> Fast counter area
  873.  
  874. 32 (249..256) | xxxx xxxx | $xx |
  875.  
  876.  
  877. counter area:
  878.  
  879.    ----------------------
  880.  
  881.        - Increment: counts units by an increment of 5 pesetas
  882.  
  883.        - size:
  884.  
  885.                 o [b107 ... b206] for 1000 pesetas cards
  886.  
  887.                 o [b127 ... b166] for 2000 pesetas cards
  888.  
  889.                 o [b107 ... b166] for 2100 pesetas cards
  890.  
  891.  
  892.  
  893.    The Fast counter area:
  894.  
  895.    ----------------------
  896.  
  897.        - Increment: counts units by an increment of
  898.  
  899.                 o 10 pesetas for the 1000 pesetas cards
  900.  
  901.                 o 20 pesetas for the 2000 pesetas cards
  902.  
  903.                 o 20 pesetas for the 2100 pesetas cards
  904.  
  905.  
  906.  
  907.        - size:
  908.  
  909.                 o [b207 ... b256] for the 1000 pesetas cards
  910.  
  911.                 o [b167 ... b256] for the 2000 pesetas cards
  912.  
  913.                 o [b167 ... b256] for the 2100 pesetas cards
  914.  
  915.  
  916.  
  917.    Exemple of an fast units area: (1000 pesetas cards)
  918.  
  919.    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  920.  
  921.                 00 -,
  922.  
  923.          0000 0000  |
  924.  
  925.          0000 0000  |-> Unused uni
  926.  
  927.  
  928.          0011 1110 ---> 14*10 pesetas are used
  929.  
  930.          1000 1110
  931.  
  932.  
  933.  
  934.    NB: Several units can be used, in this case only the last unit is set as
  935.  
  936.        used, like in the previous exemple, where some units are set to 0 but
  937.  
  938.        are nonetheless used.
  939.  
  940.  
  941.  
  942.    (*) Serial Number for spanish telecards: The serial number for G+D and
  943.  
  944.        Gemplus telecards is directly obtained by the following formula:
  945.  
  946.  
  947.  
  948.                  Byte[6]*$10000 + Byte[7]*$100 + Byte[8]
  949.  
  950.  
  951.  
  952.    1.9 - Memory Map for Mexican cards from Telmex:
  953.  
  954.          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  955.  
  956.  
  957.  
  958. Byte (Bit)     Hexa
  959.  
  960.  
  961.  
  962.               +-----+                              96
  963.  
  964. 1 (1..8)      |     | ---> Check Sum Byte = 216 - Sum b(i)
  965.  
  966.               +-----+                             i=9
  967.  
  968. 2 (9..16)     | $80 |
  969.  
  970.               +-----+
  971.  
  972. 3 (17..24)    |     |
  973.  
  974. 4 (25..32)    |     |     | --> Serial Number [TBC]
  975.  
  976.               +-----+
  977.  
  978. 5 (33..40)    | $00 | --> Schlumber
  979.        | $40 | --> Gemplus
  980.  
  981.               +-----+
  982.  
  983. 6 (41..48)    |     |
  984.  
  985. 7 (49..56)    |     | --> Serial Number [TBC]
  986.  
  987. 8 (57..64)    |     |
  988.  
  989.               +-----+-----+
  990.  
  991. 9-10 (65..80) | $41 | $4C | --> 20u
  992.  
  993.               | $82 | $8C | --> 40u
  994.  
  995.               +-----+-----+
  996.  
  997. 11-12(81..96) | $32 | $59 | --> Mexico
  998.  
  999.               +-----+-----+
  1000.  
  1001. 13 (97..104)  |     | ---> The units area: each time a unit
  1002.  
  1003.      .        |     |      is used, then a bit is set to "1";
  1004.  
  1005.      .        |     |
  1006.  
  1007.      .        |     |      The first two units are fused in
  1008.  
  1009.      .        |     |      factory as test.
  1010.  
  1011.      .        |     |
  1012.  
  1013. 32 (249..256) |     |
  1014.  
  1015.               +-----+
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023. II ) The 2nd and 3rd generation Telecards:
  1024.  
  1025.      =====================================
  1026.  
  1027.  
  1028.  
  1029.    2.1 - Introduction:
  1030.  
  1031.          ~~~~~~~~~~~~
  1032.  
  1033.  
  1034.  
  1035.    These cards are in fact 128 bit memory in NMOS technology, and the map of
  1036.  
  1037.    these cards are the following:
  1038.  
  1039.  
  1040.  
  1041.         64
  1042. t EEPROM (5x8 bits).
  1043.  
  1044.         24 bits set to "1".
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.    2.2 - Pinout:
  1051.  
  1052.          ~~~~~~
  1053.  
  1054.  
  1055.  
  1056.            ISO 7816-2
  1057.  
  1058.  
  1059.  
  1060.  ,-------------+-------------,
  1061.  
  1062.  |   1         |         5   |   Pinout:
  1063.  
  1064.  +-------\     |     /-------+   ~~~~~~
  1065.  
  1066.  |   2    +----+    +    6   |     1 : VCC=5V    5 : Gnd
  1067.  
  1068.  +--------|         |--------+     2 : Reset     6 : n.c.
  1069.  
  1070.  |   3    +----+----+    7   |     3 : Clock     7 : I/O
  1071.  
  1072.  +-------/     |     \-------+     4 : n.c.      8 : n.c.
  1073.  
  1074.  |   4         |         8   |
  1075.  
  1076.  '-------------+-------------'     (n.c. : not connected)
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.    2.3 - Main features:
  1083.  
  1084.          ~~~~~~~~~~~~~
  1085.  
  1086.  
  1087.  
  1088.         - ISO 7816- 1/2 compatible.
  1089.  
  1090.         - use a single 5V power supply.
  1091.  
  1092.         - low power consuption.
  1093.  
  1094.         - NMOS technology.
  1095.  
  1096.  
  1097.  
  1098.    2.4 - Time Diagrams:
  1099.  
  1100.          ~~~~~~~~~~~~~
  1101.  
  1102.  
  1103.  
  1104. Reset:
  1105.  
  1106. ------
  1107.  
  1108.   The address counter is reset to 0 when the clock line CLK is raised while
  1109.  
  1110. the control line R is high. Note th
  1111. o 7.
  1112.  
  1113.  
  1114.  
  1115.       __________________
  1116.  
  1117. _____|                  |_____________________________________________ Reset
  1118.  
  1119.      :                  :
  1120.  
  1121.      :        _____     :  _____       _____       _____       _____
  1122.  
  1123. _____:_______|     |____:_|     |_____|     |_____|     |_____|     |_ Clk
  1124.  
  1125.      :       :          : :     :     :     :     :     :     :     :
  1126.  
  1127. _____:_______:__________:_:_____:_____:_____:_____:_____:_____:_____:_
  1128.  
  1129. _____:___n___|_____0____:_|_____1_____|_____2_____|_____3_____|___4_:_(Address)
  1130.  
  1131.      :                  :       :           :           :           :
  1132.  
  1133. _____:                  :_______:___________:___________:___________:_
  1134.  
  1135. _____XXXXXXXXXXXXXXXXXXXX_______|___________|___________|___________|_ Data
  1136.  
  1137. Bit n                      Bit 0    Bit 1        Bit2       Bit3
  1138.  
  1139.  
  1140.  
  1141.    The address counter is incremented by 1 with each rising edge of the clock
  1142.  
  1143. signal Clk, for as long as the control line R remains low. The data held in
  1144.  
  1145. each addresse
  1146. h time Clk falls. It is not
  1147.  
  1148. impossible to decrement the address counter, therefore to address an earlier
  1149.  
  1150. bit, the address counter must be reset then incremented to require value.
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156. Write:
  1157.  
  1158. ------
  1159.  
  1160.    All unwritten or erased bits in the address 64-104 may be unwritten to.
  1161.  
  1162. When a memory cell is unwritten, it is set to 0. The addressed cell is
  1163.  
  1164. unwritten to by the following sequence.
  1165.  
  1166.  
  1167.  
  1168. 1- R is raised while Clk is low, to disable address counter increment for one
  1169.  
  1170. clock pulse.
  1171.  
  1172.  
  1173.  
  1174. 2- Clk is then raised for a minimum of 10ms to write to the address bit.
  1175.  
  1176.  
  1177.  
  1178. When to write operation ends, and Clk falls, the address counter is unlocked,
  1179.  
  1180. and the content of the written cell, which is now 0, is output to I/O contact
  1181.  
  1182. if the operation is correct.
  1183.  
  1184. The next Clk pulse will increment the address by one, then the write sequence
  1185.  
  1186. can be repeated to write the next bit.
  1187.  
  1188.  
  1189.  
  1190.               _____                                _____
  1191.  
  1192. _____________|     |___
  1193. ___  Reset
  1194.  
  1195.              :                                    :
  1196.  
  1197.      ___     :           _____           ___      :           _____
  1198.  
  1199. ____|   |____:__________|     |_________|   |_____:__________|     |____  Clk
  1200.  
  1201.     :        :          :     :         :   :     :          :     :
  1202.  
  1203. ____:________:__________:_____:_________:___:_____:__________:_____:_____
  1204.  
  1205.  n  |      n+1          |     n+2       |   :    n+3         |     :  (Address)
  1206.  
  1207. ----'--------:----------'-----:---------'---:-----:----------'-----:-----
  1208.  
  1209.              :          :     :             :     :          :     :
  1210.  
  1211. _________   _:          :     : ____________:  ___:          :     :
  1212.  
  1213. _________XXX_XXXXXXXXXXXXXXXXXXX____________ XX___XXXXXXXXXXXXXXXXXXXXXXX  I/O
  1214.  
  1215.    n      n+1           :     :     n+1        n+2           :     :
  1216.  
  1217.                         :     :                              :     :
  1218.  
  1219.                          write                                write
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225. WriteCarry:
  1226.  
  1227. ------
  1228.  performing the WRITECARRY sequence on the stage of
  1229.  
  1230. the next highest weighing to that to be erased.
  1231.  
  1232.  
  1233.  
  1234. The writecarry sequence is as follows:
  1235.  
  1236.  
  1237.  
  1238. 1 - Set the address counter to an unwritten bit in the next highest counter
  1239.  
  1240. stage to that to be erased.
  1241.  
  1242.  
  1243.  
  1244. 2 - Increment is disabled on the following rising edge of R where Clk remains
  1245.  
  1246. low.
  1247.  
  1248.  
  1249.  
  1250. 3 - Clk is then raised for a minimum of 10ms, while R is low, to write to the
  1251.  
  1252. next address bit.
  1253.  
  1254.  
  1255.  
  1256. 4 - R is the raised again while Clk remains low to disable increment a second
  1257.  
  1258. time.
  1259.  
  1260.  
  1261.  
  1262. 5 - Clk is the raised for a minimum of 1ms, while R is low, to write to the
  1263.  
  1264. addressed bit a second time, erasing the counter level immediately below that
  1265.  
  1266. the addressed bit.
  1267.  
  1268.  
  1269.  
  1270.        _____                      _____
  1271.  
  1272. ______|     |____________________|     |_________________________________  Rst
  1273.  
  1274.       :                          :
  1275.  
  1276.       :            _______       :              _______        ___
  1277.  
  1278. ______:___________
  1279. _____  Clk
  1280.  
  1281.       :           :       :      :             :       :      :   :
  1282.  
  1283.       :           :       :      :             :       :      :   :
  1284.  
  1285. <------------------------- address n ------------------------>:<--- n+1 ------
  1286.  
  1287.       :           :       :      :             :       :          :
  1288.  
  1289.       :           :       :      :             :       :          :
  1290.  
  1291. ______:           :       :______:             :       :__________: _____
  1292.  
  1293. ______XXXXXXXXXXXXXXXXXXXXX______XXXXXXXXXXXXXXXXXXXXXXX__________XX_____  I/O
  1294.  
  1295.                   :       :  n                 :       :     n        n+1
  1296.  
  1297.                   :       :                    :       :
  1298.  
  1299.                     Write                        Erase
  1300.  
  1301.  
  1302.  
  1303.    2.5 - Memory Map:
  1304.  
  1305.          ~~~~~~~~~~
  1306.  
  1307.  
  1308.  
  1309.       2.5.1 - Memory Map for 5 stage octal unit counter:
  1310.  
  1311.               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1312.  
  1313.  
  1314.  
  1315. Byte (Bit)     Hexa
  1316.  
  1317.  
  1318.  
  1319.               +-----+-----+
  1320.  
  1321. 1-2 (1..16)   | $F2 | $2F | -
  1322.              | $80 | $6F |
  1323.  
  1324.               + - - + - - +
  1325.  
  1326.               | $80 | $37 | --> Neitherlands
  1327.  
  1328.               | $80 | $77 |
  1329.  
  1330.               + - - + - - +
  1331.  
  1332.               | $10 | $2B | --> Romania [TBC]
  1333.  
  1334.               +-----+-----+
  1335.  
  1336. 3 (17..24)    | $FF | --> Germany, Netherlands
  1337.  
  1338.               | $2F | --> Romania [TBC]
  1339.  
  1340.               +-----+
  1341.  
  1342. 4 (25..32)    | $2A | --> Solaic
  1343.  
  1344.               | $4A | --> ODS
  1345.  
  1346.               | $8A | --> G+D
  1347.  
  1348.               | $CA | --> Gemplus
  1349.  
  1350.               +-----+
  1351.  
  1352. 5 (33..40)    |     |
  1353.  
  1354. 6 (41..48)    |     | --> Issuer area (written protected)
  1355.  
  1356. 7 (49..56)    |     |      (See below)
  1357.  
  1358. 8 (57..64)    |     |
  1359.  
  1360.               +-----+
  1361.  
  1362. 9 (65..72)    |     | --> c4096  )
  1363.  
  1364. 10 (73..80)   |     | -->  c512  )
  1365.  
  1366. 11 (81..88)   |     | -->   c64  ) 5 stage octal counter
  1367.  
  1368. 12 (89..96)   |     | -->    c8  )
  1369.  
  1370. 13 (97..104   |     | -->    c0  )
  1371.  
  1372.               +-----+
  1373.  
  1374. 14 (105..112) | $FF |
  1375.  
  1376. 15 (113..120) | $FF | --> a
  1377.        +-----+
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.       2.5.2 - Memory Map for 4 satge octal unit counter:
  1390.  
  1391.               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1392.  
  1393.  
  1394.  
  1395. Byte (Bit)        Binary    Hexa
  1396.  
  1397.  
  1398.  
  1399.               +-----------+-----+-----------+-----+
  1400.  
  1401. 1-2 (1..16)   | 1001 0010 | $92 | 0011 1011 | $3B | ---> Greece
  1402.  
  1403.               | 1001 0100 | $94 | 0011 1011 | $3B |
  1404.  
  1405.               +-----------+-----+-----------+-----+
  1406.  
  1407. 3 (17..24)    | 1111 1111 | $FF |
  1408.  
  1409.               +-----------+-----+
  1410.  
  1411. 4 (25..32)    | 0111 1011 | $7B | ---> [TBC] (100 Units identifier?)
  1412.  
  1413.               +-----------+-----+
  1414.  
  1415.               |           |     | ---> Serial Number = B(8)*2^24 + B(7)*2^16 +
  1416.  
  1417.               |           |     |                      B(6)*2^8 + B(5)
  1418.  
  1419. 5 (33..40)    |           |     |
  1420.  
  1421. 6 (41..48)    |           |     |                  i=8
  1422.  
  1423. 7 (49..56)    |           |     |      with B(I) = Sum {b((I-1)*8+j)}^(8-i)
  1424.  
  1425. 8 (57..64)    |           |     |                  i=
  1426.     |           |     |      (Bytes reversed: MSB left, LSB right)
  1427.  
  1428.               +-----------+-----+
  1429.  
  1430. 9 (65..72)    |           |     | ---> c512 )
  1431.  
  1432. 10 (73..80)   |           |     | --->  c64 )
  1433.  
  1434. 11 (81..88)   |           |     | --->   c8 ) 4 stage octal counter
  1435.  
  1436. 12 (89..96)   |           |     | --->   c0 )
  1437.  
  1438.               +-----------+-----+
  1439.  
  1440. 13 (97..104)  | 1111 1111 | $FF |
  1441.  
  1442. 14 (105..112) | 1111 1111 | $FF |
  1443.  
  1444. 15 (113..120) | 1111 1111 | $FF | ---> area of bits set to "1"
  1445.  
  1446. 16 (120..128) | 1111 1111 | $FF |
  1447.  
  1448.               +-----------+-----+
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.       2.5.3 - Memory Map for new 512 bit Greek telecards
  1455.  
  1456.               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1457.  
  1458.        For a little time have appeared new Greek telecards built by Gemplus,
  1459.  
  1460. these cards are 512 bit memory. And it is not clearly explained how the unit
  1461.  
  1462. area works (Informations are welcome).
  1463.  
  1464.  
  1465.  
  1466. Byte (Bit)      Hexa
  1467.  
  1468.  
  1469.  
  1470.               +-----+-----+
  1471.  
  1472. 1-2 (1..16)   | $93 | $AB | --
  1473. 24)    | $FF |
  1474.  
  1475.               +-----+
  1476.  
  1477. 4 (25..32)    | $7B | --> [TBC] (100 Units Identifier?)
  1478.  
  1479.               +-----+
  1480.  
  1481. 5 (33..40)    |     | --> Serial Number (See before)
  1482.  
  1483. 6 (41..48)    |     |
  1484.  
  1485. 7 (49..56)    |     |
  1486.  
  1487. 8 (57..64)    |     |
  1488.  
  1489.               +-----+
  1490.  
  1491. 9 (65..72)    | $00 | --> [TBC]
  1492.  
  1493. 10 (73..80)   | $00 |
  1494.  
  1495. 11 (81..88)   | $00 |
  1496.  
  1497. 12 (89..96)   | $00 |
  1498.  
  1499.               +-----+
  1500.  
  1501. 13 (97..104)  | $FF |
  1502.  
  1503. 14 (105..112) | $FF | --> area of bits set to "1"
  1504.  
  1505. 15 (113..120) | $FF |
  1506.  
  1507. 16 (120..128) | $FF |
  1508.  
  1509.               +-----+
  1510.  
  1511. 17 (129..136) | $xx | --> Unit area [TBD]
  1512.  
  1513.     .         |     |
  1514.  
  1515.     .         |     |
  1516.  
  1517.     .         |     |
  1518.  
  1519. 64 (137..512) | $xx |
  1520.  
  1521.               +-----+
  1522.  
  1523.  
  1524.  
  1525. The Issuer area:
  1526.  
  1527. ----------------
  1528.  
  1529.  
  1530.  
  1531.     This issuer consists of 40 bits. The contents of the issuer area are
  1532.  
  1533. specified by the card issuer, and are fixed during the manufacturing process.
  1534.  
  1535. The contents of the issuer area will include data such
  1536. area may only be read.
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542. Serial Number for german telefonkarte:
  1543.  
  1544. -------------------------------------
  1545.  
  1546.  
  1547.  
  1548.      Byte 4         Byte 5          Byte 6          Byte 7          Byte 8
  1549.  
  1550. ,------,------, ,------,------, ,------,------, ,------,------, ,------,------,
  1551.  
  1552. | <--- | 1010 | | <--- | <--- | | <--- | <--- | | <--- | <--- | | <--- | <--- |
  1553.  
  1554. '------'------' '------'------' '------'------' '------'------' '------'------'
  1555.  
  1556.    |                       |        |     |         |      |        |      |
  1557.  
  1558.    |                       |        |     |         |      |        |      |
  1559.  
  1560. 1st S.N.                2nd S.N.    |  9th S.N.     |   7th S.N.    |   5th S.N.
  1561.  
  1562.  digit                   digit      |   digit       |    digit      |    digit
  1563.  
  1564.                                     |               |               |
  1565.  
  1566.                                  4th S.N.        8th S.N.         6th S.N.
  1567.  
  1568.                                   digit           digit            digit
  1569.  
  1570.  
  1571.  the digit is written in reverse binary
  1572.  
  1573.                (MSB right, LSB left)
  1574.  
  1575. NOTE 2: The Serial Number is the one printed on the back of the card.
  1576.  
  1577.         The last two digit are not coded in the memory [TBC].
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583. The Counter area:
  1584.  
  1585. -----------------
  1586.  
  1587.  
  1588.  
  1589.    The counter area stores the card's units. Its initial value is specified by
  1590.  
  1591. the card issuer and set during manufacturing.
  1592.  
  1593.  
  1594.  
  1595. The counter area  is divided into a 5 stage abacus counter,  or 4 stage abacus
  1596.  
  1597. counter. The octal value of each stage is defined by the number of bits set to '1' and this stage value must
  1598.  
  1599. be weighted by the coeficient 8^n ( where n is among [4..0] or [3..0]).
  1600.  
  1601.  
  1602.  
  1603.     Exemple: For a 5 stage octal unit counter with 15818 units left.
  1604.  
  1605.     --------
  1606.  
  1607.  
  1608.  
  1609.            Byte9      Byte10     Byte11     Byte12     Byte13
  1610.  
  1611.   --------------------------------------------------------------
  1612.  
  1613.           00000111 - 00111111 - 01111111 - 00000001 - 00000011
  1614.  
  1615.   ------------------------
  1616.       (3)octal   (6)octal   (7)octal   (1)octal   (2)octal
  1617.  
  1618.   --------------------------------------------------------------
  1619.  
  1620.    Value = 3*8^4   +  6*8^3   +  7*8^2   +  1*8^1   +  2*8^0
  1621.  
  1622.   --------------------------------------------------------------
  1623.  
  1624.    TOTAL = 15818 Units
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632. Exemple of the WRITE and WRITECARRY sequences:
  1633.  
  1634. ---------------------------------------------
  1635.  
  1636.  
  1637.  
  1638.         b65 ........................................... b104
  1639.  
  1640.         ----------------------------------------------------
  1641.  
  1642.         00000111 - 00111111 - 01111111 - 00000000 - 00000011
  1643.  
  1644. -1                                                        ^    WRITE(b103)
  1645.  
  1646.         00000111 - 00111111 - 01111111 - 00000000 - 00000001
  1647.  
  1648. -1                                                         ^   WRITE(b104)
  1649.  
  1650.         00000111 - 00111111 - 01111111 - 00000000 - 00000000
  1651.  
  1652. -1                             ^         ^          ^
  1653.  
  1654.         00000111 - 00111111 - 00111111 - 11111111 - 00000000 + W
  1655. 11111 - 00111111 - 01111111 - 11111111 + WRITECARRY(b89)
  1656.  
  1657.         00000111 - 00111111 - 00111111 - 01111111 - 01111111 + WRITE(b97)
  1658.  
  1659. -1
  1660.  
  1661.         00000111 - 00111111 - 00111111 - 01111111 - 00111111 + WRITE(b98)
  1662.  
  1663. -1
  1664.  
  1665.         00000111 - 00111111 - 00111111 - 01111111 - 00011111 + WRITE(b99)
  1666.  
  1667.  
  1668.  
  1669.         Etc ....
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677. Note that you can only decrease the counter and it is not authorised  to write
  1678.  
  1679. in the counter a value greater than the old value.
  1680.  
  1681.  
  1682.  
  1683. NB: In fact most of the card units don not represent telecom units,  but money
  1684.  
  1685. units, for exmeple in german cards each telecom unit represent 30 pfennigs.
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.    2.6 - Electrical features:
  1692.  
  1693.          ~~~~~~~~~~~~~~~~~~~~
  1694.  
  1695.  
  1696.  
  1697. Maximum ratings:
  1698.  
  1699. ----------------
  1700.  
  1701.  
  1702.  
  1703.                      | Symbol   Min    Max  Unit
  1704.  
  1705. ---------------------+---------------------------
  1706.  
  1707.  Supply voltage      | Vcc     -0.3     6     V
  1708.  
  1709. ---------------------+---------------------------
  1710.  
  1711.  Input voltage       | Vss
  1712. -------------
  1713.  
  1714.  Storage temperature | Tstg     -20   +55    °C
  1715.  
  1716. ---------------------+---------------------------
  1717.  
  1718.  Power dissipassion  | Pd        -     50    mW
  1719.  
  1720. -------------------------------------------------
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726. DC caracteristics:
  1727.  
  1728. ------------------
  1729.  
  1730.                            | Symbol  Min. Typ. Max. Unit
  1731.  
  1732. ---------------------------+-----------------------------
  1733.  
  1734.  Suplly current            | Icc      -    -     5    mA
  1735.  
  1736. ---------------------------+-----------------------------
  1737.  
  1738.  Input Voltage (low)       |  Vl      0    -   0.8    V
  1739.  
  1740. ---------------------------+-----------------------------
  1741.  
  1742.  Input voltage (high)      |  Vh     3.5   -   Vcc    V
  1743.  
  1744. ---------------------------+-----------------------------
  1745.  
  1746.  Input current R           |  Ih      -    -   100    uA
  1747.  
  1748. ---------------------------+-----------------------------
  1749.  
  1750.  Input current Clk         |  Il      -    -   100    uA
  1751.  
  1752. ---------------------------+-----------------------------
  1753.  
  1754.  
  1755.   -    10    uA
  1756.  
  1757. ---------------------------+-----------------------------
  1758.  
  1759.  Output current (Voh=5V)   |  Ioh     -    -   0.5    mA
  1760.  
  1761. ---------------------------------------------------------
  1762.  
  1763.  
  1764.  
  1765. AC caracteristics:
  1766.  
  1767. ------------------
  1768.  
  1769.                        | Symbol | Min. | Max. | Unit |
  1770.  
  1771. +----------------------+--------+------+------+------+
  1772.  
  1773. | Pulse duration       |    tr  |   50 |   -  |  us  |
  1774.  
  1775. | R address reset      |        |      |      |      |
  1776.  
  1777. +----------------------+--------+------+------+------+
  1778.  
  1779. | Pulse duration       |    ts  |   10 |   -  |  us  |
  1780.  
  1781. | R write              |        |      |      |      |
  1782.  
  1783. +----------------------+--------+------+------+------+
  1784.  
  1785. | High level Clk       |    th  |    8 |   -  |  us  |
  1786.  
  1787. +----------------------+--------+------+------+------+
  1788.  
  1789. | Low level Clk        |    tl  |   12 |   -  |  us  |
  1790.  
  1791. +----------------------+--------+------+------+------+
  1792.  
  1793. | Write window         | Twrite |   10 |   -  |  ms  |
  1794.  
  1795. --+------+------+
  1796.  
  1797. | Erase window         | Terase |   10 |   -  |  ms  |
  1798.  
  1799. +----------------------+--------+------+------+------+
  1800.  
  1801. |                      |   tv1  |    5 |   -  |  us  |
  1802.  
  1803. +----------------------+--------+------+------+------+
  1804.  
  1805. |                      |   tv2  |  3.5 |   -  |  us  |
  1806.  
  1807. +----------------------+--------+------+------+------+
  1808.  
  1809. |                      |   tv3  |  3.5 |   -  |  us  |
  1810.  
  1811. +----------------------+--------+------+------+------+
  1812.  
  1813. |                      |   tv4  |  3.5 |   -  |  us  |
  1814.  
  1815. +----------------------+--------+------+------+------+
  1816.  
  1817. |                      |   tv5  |  3.5 |   -  |  us  |
  1818.  
  1819. +----------------------+--------+------+------+------+
  1820.  
  1821. |                      |   tv6  |    5 |   -  |  us  |
  1822.  
  1823. +----------------------+--------+------+------+------+
  1824.  
  1825. |                      |   tv7  |    5 |   -  |  us  |
  1826.  
  1827. +----------------------+--------+------+------+------+
  1828.  
  1829. |                      |   tv8  |   10 |   -  |  us
  1830. -------------------------
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838. III) Schematics of Readers:
  1839.  
  1840.     =======================
  1841.  
  1842.  
  1843.  
  1844.      3.1 - Reader 1:
  1845.  
  1846.            ~~~~~~~~~
  1847.  
  1848.      The following schematics is a very simple one, which will enable you to
  1849.  
  1850. read all kind of telecards with a chip, and also other memory cards.
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.                          | +5V
  1857.  
  1858.                          |
  1859.  
  1860.  Centronic                 /
  1861.  
  1862.    Port                  ,/           C 100nF
  1863.  
  1864.              Presence of *---------------||--------------------,
  1865.  
  1866.               the card   |     ,-------------+-------------,   |
  1867.  
  1868.  Pin10 (Ack)  --<--------*-----|   1         |         5   |---*--,
  1869.  
  1870.                R/W | RST       +-------\     |     /-------+      |
  1871.  
  1872.  Pin4 (d2)    -->--------------|   2    +----+    +    6   |      |
  1873.  
  1874.                Clock           +--------|         |--------+      |
  1875.  
  1876.  Pin3 (d1)    -->--------------|   3    +----+----+    7   |---,  |
  1877.  
  1878.                RAZ | RFU       +-------/     |
  1879. ---|   4         |         8   |   |  |
  1880.  
  1881.                                '-------------+-------------'   |  |
  1882.  
  1883.                I/O                                             |  |
  1884.  
  1885. Pin 11 (Busy) --<----------------------------------------------'  |
  1886.  
  1887.                Gnd                                                |
  1888.  
  1889. Pin 25        ----------------------------------------------------'
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.      3.2 - Reader 2:
  1898.  
  1899.            ~~~~~~~~~
  1900.  
  1901.  
  1902.  
  1903.      This Reader which is indeed a reader/writter will enable you to read/write
  1904.  
  1905. most of the more current memory cards (and notably telecards), and also smart
  1906.  
  1907. cards working under ISO7816 protocol (Credit cards, SIM cards, Health cards,
  1908.  
  1909. Videocrypt TV cards, etc ...).
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.                      +5V o
  1916.  
  1917.                          |
  1918.  
  1919.                          *-----------------,
  1920.  
  1921.                          |                 |
  1922.  
  1923.                   ,-------------,          |
  1924.  
  1925.                +  |     Vcc     |  +       |
  1926.  
  1927.  
  1928.    K
  1929.  
  1930. RS 232    1µF === |             | === 1µF  |        /                 Smartcard
  1931.  
  1932.                '--|C1-   M   C2-|--'       |       /                  Connector
  1933.  
  1934.    RX             |      A      |          '-----o'   o----*---------------o 1
  1935.  
  1936. 3 o---------------|TX1   X   In2|----------------*---------|---------------o 7
  1937.  
  1938.    TX             |             |                | ,-------|---------------o 4
  1939.  
  1940. 2 o----------,   -|TX2   2   In1|-   1/3 7406    | | ,-----|---------------o 2
  1941.  
  1942.    Gnd       |    |      3      |  ,---,  ,---,  | | | ,---|---------------o 8
  1943.  
  1944. 7 o-,        '----|RX1   2  Out1|--| 1 |o-| 1 |o-* | | | ,-|---------------o 3
  1945.  
  1946.     |             |             |  '---'  '---'  | | | | | *---|>|-*-------o 6
  1947.  
  1948.    """           -|RX2      Out2|-               | | | | | | ,-|>|-'   ,---o 5
  1949.  
  1950.                   |             |                | | | | | | | 2xD     |
  1951.  
  1952.           +5V   + |             |    +           | | | | | *-|----||---*
  1953.  
  1954.             o-||--
  1955.      | | | | | | |   100nF |
  1956.  
  1957.              1µF  '-------------' 1µF |          | | | | | | |        """
  1958.  
  1959.                          |            |          | | | | | | |
  1960.  
  1961.   SUBD 25               """          """         | | | | | | |c
  1962.  
  1963. PRINTER Port                                     | | | | | |  \ | PNP
  1964.  
  1965.                                                  | | | | | |   >|---,
  1966.  
  1967.    D0 - (4) RFU (RAZ)                            | | | | | |  / |  ,-,
  1968.  
  1969. 2 o----------------------------------------------|-' | | | | |e    | | 10k
  1970.  
  1971.    D1 - (3) CLK       ,---,   ,---, 1/3 7406     |   | | | | |     | |
  1972.  
  1973. 3 o-------------------| 1 |o--| 1 |o-------------|---|-|-* | |     '-'
  1974.  
  1975.    D2 - (2) RST (W)   '---'   '---'              |   | | | | |      |
  1976.  
  1977. 4 o----------------------------------------------|---' | | | |     c \ | NPN
  1978.  
  1979.    D3 - (8) RFU (FUS)                            |     | | | |        >|----,
  1980.  
  1981. 5 o----------------------------------------------|-----' | | |     e / |   ,-,
  1982.        ,---, 1/6 7406    |       | | |      |      | |
  1983.  
  1984. 6 o----------------------------| 1 |o--*---------'       | | |     """     | |
  1985.  
  1986.    D5 (Desativate Oscillator)  '---'   |    2xD   ,---,  | | |         10k '-'
  1987.  
  1988. 7 o------------------------------------|----|<|-*-| 1 |o-' | |              |
  1989.  
  1990.    D6 (Vpp Command)                    |  ,-|<|-' '---'    | |              |
  1991.  
  1992. 8 o------------------------------------|--|----------------|-|--------------'
  1993.  
  1994.    D7                                  |  |                *-|--------,
  1995.  
  1996. 9 o------x                             |  |                | |  ,-----'------,
  1997.  
  1998.    ACK (Presence of the card)          |  '----------------|-|--|Oscillator F|
  1999.  
  2000. 10o------------------------------------|-------------------' |  '------------'
  2001.  
  2002.    BUSY (Synchronous Data Output)      |                     |        |
  2003.  
  2004. 11o------------------------------------'                     |       """
  2005.  
  2006.    GND                                                       |
  2007. ,                                                    |
  2008.  
  2009.         |       100uH            1N4935                      |
  2010.  
  2011.        """    ,-@@@@@--*-----------|>|--------*----*---------* +21V
  2012.  
  2013.               |        |                      |    |         |
  2014.  
  2015.               |        '---||  BUZ11 or       |    |         |
  2016.  
  2017.               |        ,->-||    IRF14        |    |         |
  2018.  
  2019.               |        |---|'--,             ,-,   | 1nF     |
  2020.  
  2021.               |        |       |         330k| |  ===        |
  2022.  
  2023.               |       """      |             | |   |         |
  2024.  
  2025.               |                |6            '-'   |         |
  2026.  
  2027.               |       ,------------------,    |    |        +| 220µF
  2028.  
  2029.               |      5| Vcut   Ext   Vfb |7   |    |        ===
  2030.  
  2031. +12V >--------*-------|      MAX 643     |----*----'         |
  2032.  
  2033.               |       | LB1   GND   COMP |    |              |
  2034.  
  2035.               |       '------------------'   ,-,             |
  2036.  
  2037.  
  2038.  |8      | |22k          |
  2039.  
  2040.               *----||----*-----*-----'       '-'             |
  2041.  
  2042.               |   10µF         |              |              |
  2043.  
  2044.               |               """            """            """
  2045.  
  2046.               |
  2047.  
  2048.               |       ,---------,
  2049.  
  2050.               '----*--|   7805  |--*----> +5V
  2051.  
  2052.                    |  '---------'  |
  2053.  
  2054.             100nF ===      |      === 100nF
  2055.  
  2056.                    '-------*-------'
  2057.  
  2058.                            |
  2059.  
  2060.                           """
  2061.  
  2062.  
  2063.  
  2064.                           Component List
  2065.  
  2066.                           ~~~~~~~~~~~~~~
  2067.  
  2068.  
  2069.  
  2070.    Integratyed Circuits
  2071.  
  2072.    --------------------
  2073.  
  2074. 1xMAX232 (RS232<-->TTL Adapter)
  2075.  
  2076. 1xMAX643 (12-->21V Converter Controler)
  2077.  
  2078. 1x74LS06 (6 inverters)
  2079.  
  2080. 1x7805   (5V regulator)
  2081.  
  2082.  
  2083.  
  2084.      Transistors                      Diodes
  2085.  
  2086.      -----------                      ------
  2087.  
  2088. 1xBUZ11 or IRF14                 4x1N4148 or other
  2089.  
  2090. 1xBC107 or antoher NPN           1x1N49
  2091. ther PNP
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.     Condensators        Resistors          Misc
  2098.  
  2099.     ------------        ---------          ----
  2100.  
  2101.      3x100nF              2x10k          100uH self
  2102.  
  2103.      1x1nF                1x330k         1xSmartcard connector
  2104.  
  2105.      1x10µF               1x22k          1xSUBD25 Female
  2106.  
  2107.      1x220µF                             1xSUBD25 Male
  2108.  
  2109.      4x1µF
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.    
  2118.  
  2119.  
  2120.  
  2121. 
  2122.  
  2123.