Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

How to save variables to EEPROM of Java Card JC30M48CR

Applets Development Guide

Moderator: product

mbsysde99
Posts: 36
Joined: Tue Oct 24, 2017 1:10 pm
Points :422
Contact:

How to save variables to EEPROM of Java Card JC30M48CR

Post by mbsysde99 » Fri Jan 28, 2022 6:08 am

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

mbsysde99
Posts: 36
Joined: Tue Oct 24, 2017 1:10 pm
Points :422
Contact:

Re: How to save variables to EEPROM of Java Card JC30M48CR

Post by mbsysde99 » Fri Jan 28, 2022 11:42 am

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();

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 2 guests

JavaCard OS : Disclaimer