Library API

Smart Card Library

Smart Card Library
Library API

This section lists the API provided by Microchip Smartcard Library

Topics
Name 
Description 
The following table lists functions in this documentation. 
The following table lists types in this documentation. 
The following table lists macros in this documentation. 
The following table lists files in this documentation. 
The following table lists variables in this documentation. 
Files
Name 
Description 
FileName: SClib.h Dependencies: See INCLUDES section Processor: PIC18, PIC24 & PIC32 Microcontrollers Hardware: This demo is natively intended to be used on Exp 16, LPC & HPC Exp board. This demo can be modified for use on other hardware platforms. Complier: Microchip C18 (for PIC18), C30 (for PIC24) & C30 (for PIC32) Company: Microchip Technology, Inc.
Software License Agreement:
The software supplied herewith by Microchip Technology Incorporated (the “Company”) for its PIC® Microcontroller is intended and supplied to you, the Company’s customer, for use solely and exclusively on Microchip PIC Microcontroller products. The software is owned by the Company and/or... more 
Functions
 
Name 
Description 
 
This macro checks if card is inserted in the socket 
 
This function does the PPS exchange with the smart card & configures the baud rate of the PIC UART module as per the PPS response from the smart card. 
 
This function returns the current state of SmartCard 
 
This function initializes the smart card library 
 
This function performs the power on sequence of the SmartCard and interprets the Answer-to-Reset data received from the card. 
 
This function Performs the Power Down sequence of the SmartCard 
 
This function Sends/recieves the ISO 7816-4 compaliant APDU commands to the card. 
 
This function Sends/recieves the ISO 7816-4 compaliant T = 1 commands to the card. 
Macros
 
Name 
Description 
 
Smart Card Library 
 
PCB byte for Abort Response of T1 Protocol 
 
Authenticate Command code to the Smart Card 
 
DEFAULT Value of BWI Indicator used in calculation of BWT for T=1 protocol 
 
Change Pin Command code to the Smart Card 
 
Clear Card Command code to the Smart Card 
 
Cyclic Redundancy Check(CRC) type is used for EDC in Epilogue Field 
 
Credit Command code to the Smart Card 
 
DEFAULT Value of CWI Indicator used in calculation of CWT for T=1 protocol 
 
Debit Command code to the Smart Card 
 
Get Response Command code to the Smart Card 
 
PCB byte for IFS Response of T1 Protocol 
 
Inquire Account Command code to the Smart Card 
 
Longitudnal Redundancy Check(LRC) type is used for EDC in Epilogue Field 
 
Read Record Command code to the Smart Card 
 
PCB byte for Resync Request of T1 Protocol 
 
Revoke Command code to the Smart Card 
 
Select File Command code to the Smart Card 
 
Start Session Command code to the Smart Card 
 
Card is powered and ATR received 
 
Card present but not powered 
 
No Card Detected 
 
Submit Code Command to the Smart Card 
 
Returns '1' if T=0 protocol is supported & Returns 0 otherwise 
 
Returns '1' if T=1 protocol is supported & Returns 0 otherwise 
 
Returns '1' if TA1 present & Returns 0 otherwise 
 
Returns '1' if TA2 present & Returns 0 otherwise 
 
Returns '1' if TB1 present & Returns 0 otherwise 
 
Returns '1' if TB2 present & Returns 0 otherwise 
 
Returns '1' if TC1 present & Returns 0 otherwise 
 
Returns '1' if TC2 present & Returns 0 otherwise 
 
Returns '1' if TD1 present & Returns 0 otherwise 
 
Returns '1' if TD2 present & Returns 0 otherwise 
 
PCB byte for Wait Time Extension Response of T1 Protocol 
 
DEFAULT Value of WI Indicator used in calculation of WWT for T=0 protocol 
 
Write Record Command code to the Smart Card 
Types
 
Name 
Description 
 
SmartCard APDU Command 7816-4 
 
SmartCard APDU Response structure 7816-4 
 
Smart Card error types 
 
Prologue Field for T=1 Protocol 
 
Block types in T=1 protocol 
Variables
 
Name 
Description 
 
Historical bytes sent by Smart Card 
 
Number of Historical bytes present 
 
length of ATR data sent by smart card 
 
ATR data sent by smartcard. 
 
Smart Card Error type is stored in this variable 
 
PPS Response Bytes 
 
Length of PPS Response 
 
TA1 determines the clock-rate conversion factor F & bit-rate-adjustment factor D 
 
TA2 determines whether the smart card will operate in specific mode or negotiable mode following the ATR 
 
TA3 conveys the Information Field Size Integer (IFSI) for the smart card. 
 
TB1 conveys information on the smart card's programming voltage requirements. 
 
TB2 conveys PI2, which determines the value of programming voltage required by the smart card. The value of PI1 in TB1 is superceded when TB2 is present 
 
TB3 indicates the value of the Character Waiting Time Integer (CWI) and Block Waiting Time Integer (BWI) used to compute the Character Waiting Time (CWT) and Block Waiting Time (BWT). 
 
TC1 determines the extra guard time to be added between consecutive characters sent to the smart card from the terminal. 
 
TC2 is specific to protocol type T=0. TC2 conveys work waiting-time integer (WI) that determines the maximum interval between the leading edge of the start bit of any character sent by the smart card and the leading edge of the start bit of the previous character sent either by the card or the reader 
 
When TC3 is present, it indicates the type of block-error detection to be used. When TC3 is not present, the default longitudinal redundancy check (LRC) is used. 
 
TD1 indicates if any further interface bytes are to be transmitted, and if so, which protocol will be used. 
 
The TD2 character has the same function as the TD1 character. 
 
TD3 indicates interface bytes similar to that of TD1 & TD2 
Microchip Smart Card Library 1.02.8 - [July 18, 2012]
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.