I am having a problem today...

 I can define this structure as global, above main() (or at the top of main() , 
and use it just fine in the code...   But only once can I define it, it 
appears, or else I get this "expected an expression" error.


 modbus_cmd_rd_hreg_t   holding_cmd =
    {
        4000,     //starting register
        11       //Number of registers to read (Was 10)
    };


where, modbus_cmd_rd_hreg_t itself is defined like this...



typedef  struct  _modbus_cmd_rd_hreg_t
{
    uint16_t start_addr;
    uint16_t num_reg;
}  modbus_cmd_rd_hreg_t;



OK so far and the structure gets used in the program just fine.

But when I want to re-define the values somewhere in main() so I can call the 
function that uses this structure, like this:


   holding_cmd = 
    {                  //Error here  "expected an expression"
        4100,
        10
    };


I get the error on that line with the opening brace.

Any ideas ??

Thanks,
boB




Reply via email to