title: C Struct problem
body: <p>I've been searching for some answer to this problem but can't figure it out.</p>
  
  <p>I have a structure:</p>
  
  <pre><code>typedef struct  {
      BYTE  hour;      
      BYTE  minute;    
      BYTE  second;   
      BYTE  dom;     
      BYTE month;
      BYTE year;      
  } t_time_date ;
  </code></pre>
  
  <p>And a serial port receive function:</p>
  
  <pre><code>g_curr_td.year = g_rx_buffer[3];
  g_curr_td.month = g_rx_buffer[4];
  g_curr_td.dom = g_rx_buffer[5];
  g_curr_td.hour = g_rx_buffer[6];
  g_curr_td.minute = g_rx_buffer[7];
  g_curr_td.second = g_rx_buffer[8];
  </code></pre>
  
  <p>I have verified the <code>g_rx_buffer</code> is correct and contains data.  If I hard code a number in to the variable it works:</p>
  
  <pre><code>g_curr_td.year = 10;  /* this works */
  </code></pre>
  
  <p>However, running live data it crashes and seems to be writing data somewhere else in memory.  Can anyone see something wrong in my setup?</p>
  
  <p>Thanks.</p>