eeEmulRead —reading of one byte from the read-only memory.

Description:

u8 eeEmulRead(u8 addr, u32 &value);

Reads one byte from the cell addr of read-only memory and stores its value to value. Returns the result of reading process.

List of parameters

addr

Cell address in the read-only memory. Value from 1 to 127.

value

Reference to variable u32.

Return values:

· Returns 0 if the error occurred when reading.

· Returns not 0 if reading was successful.

Example:

<item addr="524:248" name="Test for eeEmulRead 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 the following messages will appear in the interface:

“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.