how to assign a union to an array element

Discussion created by ROB LUND on Apr 2, 2008
Latest reply on Apr 26, 2008 by bigmac
Hey everyone.  Does anyone know how I can assign a union to a particular element of array?  For instance, I have the following union defined:

typedef union{  Byte bits;  struct  {    Byte VIDEO0   :1;   // video mode bits    Byte VIDEO1   :1;    Byte ORIENT0  :1;   // orientation bits    Byte ORIENT1  :1;    Byte FREQ0    :1;   // frequency bits    Byte FREQ1    :1;    Byte LED      :1;   // LED enable bit    Byte          :1;   // unused  } bit;  struct  {    Byte mrgVIDEO   :2;    Byte mrgORIENT  :2;    Byte mrgFREQ    :2;    Byte            :1;    Byte            :1;  } mergedbits;} vconfig_union;extern volatile vconfig_union vconfig;#define VCONFIG         vconfig.bits#define VCONFIG_VIDEO0  vconfig.bit.VIDEO0#define VCONFIG_VIDEO1  vconfig.bit.VIDEO1#define VCONFIG_ORIENT0 vconfig.bit.ORIENT0#define VCONFIG_ORIENT1 vconfig.bit.ORIENT1#define VCONFIG_FREQ0   vconfig.bit.FREQ0#define VCONFIG_FREQ1   vconfig.bit.FREQ1#define VCONFIG_LED     vconfig.bit.LED#define VCONFIG_VIDEO   vconfig.mergedbits.mrgVIDEO#define VCONFIG_ORIENT  vconfig.mergedbits.mrgORIENT#define VCONFIG_FREQ    vconfig.mergedbits.mrgFREQ

And I also have an array of bytes defined:

Byte memory[8];

I want to assign the above union to the 8th element in the memory[] array.  I've tried the address operator in various ways but can't seem to make this work.

The reason is so that the last byte of that array can be easier to work with and test other control loops against.