can not write data to mifarecard

mc 3,701 Reputation points
2023-02-24T01:21:39.69+00:00

I am using pn532 and ch340 with windows.

I can read mifare card data of 64 blocks.

and when I write to the card it return 0,but the data is not wrote to the card.

card.Common=Write16Bytes;

card.Data=new byte[16]{...data..};

var ret = card.RunMifareCardCommand();

the ret is 0;

when I read agian the data is not the data I want to write.

Then I use card.WriteDataBlock(0). it returns true.

but the data is not changed.

Windows for IoT
Windows for IoT
A family of Microsoft operating systems designed for use in Internet of Things (IoT) devices.
381 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,310 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 43,966 Reputation points
    2023-02-24T13:51:21.64+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query

    Download and install the MFRC522 library.

    Go to File->Examples->MFRC522->ReadAndWrite.

    File->Save Target As... You can save a duplicate that you can change.

    Delete the reading sections you don't wish to read.

    To write what you want, change the elements that do the writing.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more