Arduino EEPROM Protocol
This protocol helps you to manage the EEPROM. The ID of the EEPROM manager is always "EEPROM".
How to test the EEPROM Manager on Arduino Mega?
Arduino codes are included.
I. "Welcome" event from microcontroller
Example
c=welcome&id=EEPROM&type=OzEEPROMManager&pos=0&t=1
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"welcome" |
Identifies the welcome message. |
id |
String |
"EEPROM" |
The ID of the EEPROM manager is always "EEPROM". |
type |
String |
"OzEEPROMManager" |
Determines the type of the device. |
pos |
Byte |
0-255 |
Determines the position of the device on the list of the ID manager of the microcontroller.
Please make sure there are no other devices in the same position. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
II. Commands to microcontroller
"Info" command
With this command you can get some information of the EEPROM.
Example
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"info" |
Identifies the command. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
Response
c=info_resp&num_blocks=2&eeprom_size=4096&free_space=4073&id=EEPROM&t=2
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"info_resp" |
Identifies the response. |
num_blocks |
Ushort |
0-2047 |
Number of contiguous memory blocks. |
eeprom_size |
Ushort |
0-4095 |
Maximum capacity of EEPROM in bytes. |
free_space |
Ushort |
0-4095 |
Free space on EEPROM in bytes. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"List" command
With this command you can list the properties of the allocated blocks.
Example
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"list" |
Identifies the command. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
Response
c=list_resp&count=1&id=EEPROM&t=3
[c=list&block_start=4089&block_size=7&block_is_dev=1&block_devnum=1&block_index=0
&id=EEPROM&t=4]
[...]
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"list_resp" |
Identifies the response. |
count |
Ushort |
0-2047 |
Number of taken memory blocks. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
list |
String |
Annyi list response érkezik amennyi a count paraméter értéke. |
Identifies the response. |
block_start |
Ushort |
0-4095 |
Gives the starting byte of the block. |
block_size |
Ushort |
0-2047 |
A block's size in bytes. |
block_is_dev |
Bool |
0, 1 |
If TRUE, then the current block is allocated for a device ID. |
block_devnum |
Byte |
0-255 |
The position of the device in the IDManager. |
block_index |
Ushort |
0-2047 |
Index of the released block. |
"Format" command
This command deletes all data form the EEPROM.
Example
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"format" |
Identifies the command. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
Response
c=format_resp&num_blocks=0&eeprom_size=4096&free_space=4095&id=EEPROM&t=10
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"format_resp" |
Identifies the response. |
num_blocks |
Ushort |
0-2047 |
Number of contiguous memory blocks. |
eeprom_size |
Ushort |
0-4095 |
Maximum capacity of EEPROM in bytes. |
free_space |
Ushort |
0-4095 |
Free space on EEPROM in bytes. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Read" command
With this command you can read data from EEPROM. Blockindex is the index of the block to read from. The blocks are indexed by the Oz EEPROM Manager.
TYPE determines the type of the readable data. The offset is measured from the start of the block until the readable data.
Example
c=read&blockindex=0&type=int&offset=0&t=3&id=EEPROM
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"read" |
Identifies the command. |
blockindex |
Ushort |
0-2047 |
Index of the block to be read from. |
type |
String |
int, long, float, string |
Determines the type of the readable data. |
offset |
Byte |
0-255 |
Shift within a block. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
Response
c=read_resp&block_index=0&offset=0&data=27445&id=EEPROM&t=11
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"read_resp" |
Identifies the response. |
blockindex |
Ushort |
0-2047 |
Index of the scanned block. |
offset |
Byte |
0-255 |
Shift within a block. |
data |
String |
|
Scanned data. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Write" command
With this command you can write data to the EEPROM.
Example
c=write&blockindex=0&type=string&data=235&offset=1&t=4&id=EEPROM
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"write" |
Identifies the command. |
blockindex |
Ushort |
0-2047 |
Index of the block to be written. |
type |
String |
int, long, float, string |
Determines the type of the data to be written. |
data |
String |
|
Data to be written. |
offset |
Byte |
0-255 |
Shift within a block. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
Response
c=write_resp&block_index=0&offset=1&data=235&id=EEPROM&t=12
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"write_resp" |
Identifies the response. |
block_index |
Ushort |
0-2047 |
Index of the written block. |
offset |
Byte |
0-255 |
Shift within a block. |
data |
String |
|
Written data. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Allocate" command
This command allocates space. The space can be allocated for a device or for any other purpose.
Example
c=allocate&devnum=1&amount=200&is_device=1&t=5&id=EEPROM
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"allocate" |
Identifies the command. |
devnum |
Byte |
0-255 |
Number of the device in the IDManager. |
amount |
Ushort |
0-4096 |
Allocated space in bytes. |
is_device |
Bool |
0,1 |
If TRUE, then the current block will be allocated for a device ID. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
Response
c=allocate_resp&devnum=1&blockindex=1&amount=200&id=EEPROM&t=13
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"allocate_resp" |
Identifies the response. |
devnum |
Byte |
0-255 |
Number of the device in the IDManager. |
blockindex |
Ushort |
0-2047 |
Index of the allocated block. |
amount |
Ushort |
0-4095 |
Allocated space in bytes. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Deallocate" command
With this command you can free allocated space from the EEPROM.
Example
c=deallocate&index=2&t=6&id=EEPROM
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"deallocate" |
Identifies the command. |
index |
Byte |
0-255 |
Index of the block to be deallocated. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
Response
c=deallocate_resp&blockindex=0&id=EEPROM&t=14
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"deallocate_resp" |
Identifies the response. |
blockindex |
Byte |
0-255 |
Index of the deallocated block. |
id |
String |
"EEPROM" |
The ID of the device. Fix value. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
III. Event from microcontroller
More information