Extern Enum and Struct

Discuss with MikroElektronika software developers about current library development.
Post Reply
Author
Message
dejota2k11
Posts: 28
Joined: 19 Feb 2015 14:31

Extern Enum and Struct

#1 Post by dejota2k11 » 18 May 2016 12:20

Hello everyone! I am building a library and need to declare the file " .c " an " enum " and a " struct " external . I have used a few examples , but without success, the compiler says it is impossible to find the variables within the " enum " and " struct " . Follow the code below:
Thanks for listening!

Code: Select all


enum { E_Variavel
  TT_addr_mb = 0x01 , // 40002 Temp Environment
  UR_addr_mb = 0x02 , // 40003 Umid Relative
  URC_addr_mb = 0x03 , // 40003 Umid Relative offset by Temp
  DP_addr_mb = 0x04 // 40004 Dew Point
} Addr_mb_variavel ;

enum E_Function  {
  FUNC_READ_COILS                     = 0x01,
  FUNC_READ_DISCRETE_INPUT            = 0x02,
  FUNC_READ_INPUT_REGISTERS           = 0x04,
  FUNC_READ_HOLDING_REGISTERS         = 0x03,
  FUNC_WRITE_SINGLE_COIL              = 0x05,
  FUNC_WRITE_SINGLE_REGISTER          = 0x06,
  FUNC_READ_EXCEPTION_STATUS          = 0x07,
  FUNC_DIAGNOSTICS                    = 0x08,
  FUNC_GET_COMM_EVENT_COUNTER         = 0x0B,
  FUNC_GET_COMM_EVENT_LOG             = 0x0C,
  FUNC_WRITE_MULTIPLE_COILS           = 0x0F,
  FUNC_WRITE_MULTIPLE_REGISTERS       = 0x10,
  FUNC_REPORT_SLAVE_ID                = 0x11,
  FUNC_READ_FILE_RECORD               = 0x14,
  FUNC_WRITE_FILE_RECORD              = 0x15,
  FUNC_MASK_WRITE_REGISTER            = 0x16,
  FUNC_READ_WRITE_MULTIPLE_REGISTERS  = 0x17,
  FUNC_READ_FIFO_QUEUE                = 0x18
};


User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Extern Enum and Struct

#2 Post by filip » 19 May 2016 14:55

Hi,

There is an error in the code, just put the curly bracket like this :

Code: Select all

enum E_Variavel {

Is this the problem you are facing with ?

Regards,
Filip.

dejota2k11
Posts: 28
Joined: 19 Feb 2015 14:31

Re: Extern Enum and Struct

#3 Post by dejota2k11 » 20 May 2016 19:15

I'm sorry. In the google translator reversed position. but it follows as the code is in the project

Code: Select all

enum E_Variavel {
  TT_addr_mb = 0x01 , // 40002 Temp Environment
  UR_addr_mb = 0x02 , // 40003 Umid Relative
  URC_addr_mb = 0x03 , // 40003 Umid Relative offset by Temp
  DP_addr_mb = 0x04 // 40004 Dew Point
} Addr_mb_variavel ;

enum E_Function  {
  FUNC_READ_COILS                     = 0x01,
  FUNC_READ_DISCRETE_INPUT            = 0x02,
  FUNC_READ_INPUT_REGISTERS           = 0x04,
  FUNC_READ_HOLDING_REGISTERS         = 0x03,
  FUNC_WRITE_SINGLE_COIL              = 0x05,
  FUNC_WRITE_SINGLE_REGISTER          = 0x06,
  FUNC_READ_EXCEPTION_STATUS          = 0x07,
  FUNC_DIAGNOSTICS                    = 0x08,
  FUNC_GET_COMM_EVENT_COUNTER         = 0x0B,
  FUNC_GET_COMM_EVENT_LOG             = 0x0C,
  FUNC_WRITE_MULTIPLE_COILS           = 0x0F,
  FUNC_WRITE_MULTIPLE_REGISTERS       = 0x10,
  FUNC_REPORT_SLAVE_ID                = 0x11,
  FUNC_READ_FILE_RECORD               = 0x14,
  FUNC_WRITE_FILE_RECORD              = 0x15,
  FUNC_MASK_WRITE_REGISTER            = 0x16,
  FUNC_READ_WRITE_MULTIPLE_REGISTERS  = 0x17,
  FUNC_READ_FIFO_QUEUE                = 0x18
};

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Extern Enum and Struct

#4 Post by filip » 23 May 2016 14:19

Hi,

This piece of code compiles OK for me.

Which compiler and version are you using ?
Could you attach the project that you have issues with ?

Regards,
Filip.

dejota2k11
Posts: 28
Joined: 19 Feb 2015 14:31

Re: Extern Enum and Struct

#5 Post by dejota2k11 » 23 May 2016 18:45

Thank you for attention the version I use is 6.6. Follow the project to analyze
Attachments
MODBUS_16F883.zip
(3.95 MiB) Downloaded 315 times

Post Reply

Return to “Library Development Discussion”