Configuring the User Space

This example details how to configure the User Spaces so that it only contains a Byte Space of 200 bytes and a Long Space of 400 bytes. This entails that the User Space uses the first 600 memory cells. Moreover, the I/O Config Space is removed since we don’t need it here (this space uses the last 44 memory cells).


1) Sketch: 4_EEPROM \ 2_UserSpaceConfig

In this program, we use the variable “HC_eeprom” supplied by the library to configure the specialized spaces during the setup().

We first configure the User Space using HC_eeprom.setUserSpace() so that it only holds 2 sub-spaces: The Byte Space and the Long Space. Their sizes are specified in bytes.

Finally, we retrieve the number of elements contained in these sub-spaces using HC_eeprom.getUserSpace_DataQty() and we display them on Analog Data 0 and 1. The number of elements contained in a sub-space depends on its data type and size.

#include <HITIComm.h>

// run once at power on
void setup()
  // initialize library

  // configure User Space (sub-spaces sizes)
    0,     // Boolean space : default 50 bytes
    200,   // Byte space    : default 100 bytes
    0,     // Integer space : default 200 bytes 
    400,   // Long space    : default 250 bytes
    0,     // Float space   : default 250 bytes
    0);    // String space  : default 4096 bytes

  // retrieve the number of elements contained in the sub-spaces
  HC_analogDataWrite(0, HC_eeprom.getUserSpace_DataQty(HC_USERSPACE_BYTE));
  HC_analogDataWrite(1, HC_eeprom.getUserSpace_DataQty(HC_USERSPACE_LONG));

// run repeatedly after setup()
void loop()
  // communicate with HITIPanel


2) Control Panels

  1. Display the ANALOG Data Control Panel.
  2. We can see that the Byte Space contains 200 Bytes and the Long Space contains 100 Longs.


3) EEPROM Panel (User Space)

  1. Open the EEPROM Panel. As you can see, the User Space only contains the Byte Space and the Long Space.

  2. Display the Memory Space.
  3. Use the navigation arrows to go through the cells. After address 600, you will notice that all cells are grey which means they are not assigned to any User Space.

  4. Display the Byte Space.
  5. Go to the last index by using the navigation arrow. As expected, the last index is 199, which is normal since there are 200 Bytes.

  6. Do the same check with the Long Space. You should find that the last index is 99.


Was this article helpful?
0 out of 0 found this helpful