Menu

Display the information from SL4442 card on LCD1602

2016-02-25
2016-02-26
  • Timur Shamuradov

    Hello,
    I'm making my college project which related to security entrance system. One of the way to authenticate is using smart card sl4442. I'm using arduino Uno and Smart Card Lib. Using a SL4442_Support file i was able to write the required information to unprotected memory of the card (First, Last Name, and student ID number). When i insert a card into the slot i can see the data that i uploaded into the card using Arduino serial monitor. Now i want that for example line 3 which holds student id number in my case was displayed on LCD1602 which is connected to arduino as well. My attempt was to create a global char string in SCLib.cpp and then inside the dumpHex function copy the value of char ascii into my global char variable. It compiled succesfully, but my LCD only shows a " . " when i insert a card into slot. If anyone has any suggestions i will greatly appreciate it. Thank you

     
  • angus71

    angus71 - 2016-02-26

    Hi Timur,

    Normally there should be no need to modify the SCLib.ccp code to achive the stuff you want to do.

    It should be enough th use the readMainMemory functions to read the data from the SmartCard and transfere them into the variable of your choice.

     /**
         * read content from SL44X2 card.
         *
         * Available: SL4432 / SL4442
         *
         * start - Start position, to retrieve data from.
         * buf   - pointer to buffer containing the data provided by the card.
         * count - number of bytes requested from card (buf should have at least a size of count bytes).
         *
         * @return - number of bytes received from card.
         */
        uint16_t readMainMemory(uint16_t start, uint8_t* buf, uint16_t count);
    

    Like in the example, the following code should be what your are looking for or modify it to fit your needs.

    char studentId[MAX_ID_LENGTH+1];
    
    if (sl44x2.cardReady()) {
            // You dont need to be authenticated to 
            // read the complete data of the smartcard
            uint16_t i = sl44x2.readMainMemory(OFFSET_ID, (uint8_t*)studentId, MAX_ID_LENGTH);
    
            if(i>0) {
                // Just be sure to terminate the received string
               studentId[(i>=MAX_ID_LENGTH)?MAX_ID_LENGTH:i] = '\0';
    
                // How studentId should contain the string
                // data you want to send to the LCD display
            }
    }        
    

    Just let me know, if this helped ..

    regards

    Angus

     

    Last edit: angus71 2016-02-26

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.