eeEmulWrite — recording of one byte into permanent memory .
 

Description:

u8 eeEmulWrite(u8 addr, u32 value);

Records the cell with the address addr, one byte value to the permanent memory and returns the result of recording process.

List of parameters

addr

Cell address in the permanent memory. Value from 1 to 127.

value

Information byte which is required to be stored in the permanent memory .

Return values:

· Returns 0 if the error occurred when storing.

· Returns not 0 if storage was successful.

Example:

<item addr="524:248" name="Test for eeEmulWrite function" type="script">
V-ID/V-ADDR {
        	u8 addr = 4;
        	if(opt0()) {
                    	u32 testWriteVar = 41;
                    	u8 resultOfWrite = eeEmulWrite(addr, testWriteVar);  
                    	u8 strForMess[70]; 
                    	sprintf(strForMess, "%cValue %d", 1, testWriteVar);
                    	if(resultOfWrite != 0) {
                               	strcat(&strForMess, " recorded");
        	        	} else {
                               	strcat(&strForMess, " not recorded");
                    	}
                    	sprintf(strForMess, "%s into a cell %d.", strForMess, addr);
                    	setStatus(@exciterId():32, &strForMess);
        	} else {
                    	u32 testReadVar = 0;
                    	u8 resultOfRead = eeEmulRead(addr, &testReadVar);
                    	u8 strForMess[70]; 
                    	sprintf(strForMess, "%cС cells%d", 4, addr);
                    	if(resultOfRead != 0) {
                               	strcat(&strForMess, " is read");
                    	} else {
                               	strcat(&strForMess, "the value is not read!");
                               	return;
                    	}
sprintf(strForMess, "%s value %d.", strForMess, testReadVar);
                    	setStatus(@exciterId():32, &strForMess);
        	}
}
</item>

The result of performing the example in the interface:

When clicking the element script in the interface the following messages will appear:

“Value 41 is stored to the cell 4”

“Value 41 is read from the cell 4”

Note:

This function supports only the variables of u32 type.