JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html
https://ftsafe.en.alibaba.com/index.html
How to save variables to EEPROM of Java Card JC30M48CR
Moderator: product
How to save variables to EEPROM of Java Card JC30M48CR
I want to store a variable in memory that is not lost when the power supply is lost and I can update the contents of that memory while the program is running. In short, How to save variables to EEPROM of Java Card JC30M48CR? Thanks.
Regards,
Yudha
Regards,
Yudha
Re: How to save variables to EEPROM of Java Card JC30M48CR
Code: Select all
A. PERSISTENT MEMORY
1. // Persistent Memory (EEPROM) = Memory still exist while lost power.
// Without set as transient object, it immediately becomes a persistent object and save to EEPROM.
byte[] SRC = new byte[]{1, 2};
OR
2. // Persistent Memory (EEPROM) = Memory still exist while lost power
byte[] PM = JCSystem.makeTransientByteArray((short)2, JCSystem.MEMORY_TYPE_PERSISTENT);
JCSystem.beginTransaction();
Util.arrayCopyNonAtomic(SRC, (short)0, PM, (short)0, (short)2);
JCSystem.commitTransaction();
B. TEMPORARY MEMORY
1. // Clear On Deselect Memory = Clear memory when applet is deselect.
byte[] COD = JCSystem.makeTransientByteArray((short)2, JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT);
JCSystem.beginTransaction();
Util.arrayCopyNonAtomic(SRC, (short)0, COD, (short)0, (short)2);
JCSystem.commitTransaction();
2. // Clear On Reset Memory = Clear memory when card pull up / lost power.
byte[] COR = JCSystem.makeTransientByteArray((short)2, JCSystem.MEMORY_TYPE_TRANSIENT_RESET);
JCSystem.beginTransaction();
Util.arrayCopyNonAtomic(SRC, (short)0, COR, (short)0, (short)2);
JCSystem.commitTransaction();
Who is online
Users browsing this forum: No registered users and 7 guests