Home AMX User Forum NetLinx Studio

C10586: Module instance [MM88] parameter [3] is an expression or a constant error

Hi Guys,

A long while since I last posted here as been working on many projects for the other side. I have been tasked with a new AMX project and produced a couple of modules for this.

When I build the project I get the error list in the subject. Can anyone see what I am obviously missing in the code snippet below?

Many thanks

Here's the main program definition:
DEFINE_DEVICE
pMimo88 = 0:3:0 // IP interface

vtpMimo88 = 32001:1:1 // Virtual mimo88

DEFINE_CONSTANT
char mIpAddress[15] = '192.168.1.80'

DEFINE_MODULE 'mimo88' mM88 (pMimo88, vtpMimo88, mIpAddress) // mimo88 udp connection

Here's the header from the module:
MODULE_NAME = 'mimo88' (DEV dvDevicePort, DEV dUi, CHAR dIpAddress[])

Comments

  • I think it's exactly what it says. Try and declare your IP address under DEFINE_VARIABLE instead of DEFINE_CONSTANT
  • Hi Felix,

    Thanks for that. Yes it does clear the error. Now curious as to why the ip address has to be declared as a variable.
    Inside the Mimo module the value is simply passed into a timeline to execute the following:
    IP_CLIENT_OPEN(dvDevicePort.PORT,dIpAddress,dPort,2)

    Where dPort is defined as a constant within the module.

    Regards
  • They probably have their reasons. If you look in the help file (Netlinx Keywords Help), under "Defining a module" it is clearly stated that you cannot use constants or expressions as a DEFINE_MODULE parameter. Plus other clarifications.

    It probably has to do with the way the memory is allocated and the consistency out of the module/inside the module, where something would collapse if you actually intend to assign a value to something declared as a constant out of the module. Perhaps other fellow forum users can shed some more light on the reason for this.
  • Thanks Felix,

    OK I read the help file you suggested and sure enough it does state 'Constants and expressions cannot be used as arguments in the parameter list'

    Thankyou for clarifying that.
    Have a great week.
    Regards
    slip
  • viningvining Posts: 4,368
    You can pass constant arrays or individual elements of constant arrays which is what I do. So why not constants? Beets the F' out of me.
    DEFINE_CONSTANT //ARRAYs, DEV, vDEV, UI, IP, INSTANCES, CUSTOMIZE PER INSTALLATION--------------------->
    
    DEV dvUI_DVDArry[DVD_NUM_UIs]= 
    	  {
    	  dvTP_DVD_1,//1st floor
    	  dvTP_DVD_2,//master
    	  dvTP_DVD_3,//purple
    	  dvTP_DVD_4,//blue
    	  dvTP_DVD_5,//pasqaule's
    	  dvTP_DVD_6,//1st fl guest
    	  dvTP_DVD_7,//3rd fl tp no DVD
    	  dvR4_DVD_1,//media
    	  dvR4_DVD_2,//master
    	  dvR4_DVD_3,//kitchen
    	  dvR4_DVD_4,//bar
    	  dvR4_DVD_5,//purple
    	  dvR4_DVD_6,//blue
    	  dvR4_DVD_7,//tan
    	  dvR4_DVD_8 //guest
    	  }
    
    //DVD INSTANCES
    CHAR DVD_1	= 1 ;
    CHAR DVD_2	= 2 ;
    
    INTEGER DVD_INSTANCE_Arry[DVD_NUM_DVDs] =
    	  {
    	  DVD_1,
    	  DVD_2
    	  }
    
    INTEGER DVD_COMTYPE_Arry[DVD_NUM_DVDs] =  //if tv is serial set to DVD_IS_SERIAL, otherwise DVD_IR_NO_LINK
    	   //or if IR and you want to link to an IO use DVD_IR_LINK_1 to DVD_IR_LINK_8 for desired IO link
    	  {//doesn't matter what these are if set up as IP:PORT controlled devices
    	  COMM_IS_SERIAL,
    	  COMM_IS_SERIAL 
    	  }
    
    //CHAR COMM_IS_SERIAL	= $FF ;
    //CHAR COMM_IS_IP 	= $FA ;<---- not really used, if IP, IP:Port is passed in so use serial instead
    //CHAR COMM_IR_NO_LINK	= 0 ;
    //CHAR COMM_IR_LINK_1	= 1 ;
    //CHAR COMM_IR_LINK_2	= 2 ;
    //CHAR COMM_IR_LINK_3	= 3 ;
    //CHAR COMM_IR_LINK_4	= 4 ;
    //CHAR COMM_IR_LINK_5	= 5 ;
    //CHAR COMM_IR_LINK_6	= 6 ;
    //CHAR COMM_IR_LINK_7	= 7 ;
    //CHAR COMM_IR_LINK_8	= 8 ;     	  
    
    DEV dvDVD_Arry[DVD_NUM_DVDs] =
    	  {
    	  dvDVD_1,    //1
    	  dvDVD_2     //2
    	  }
    
    DEV vDVDcom_Arry[DVD_NUM_DVDs] =     
    	  {
    	  vDVDcom_1, //1
    	  vDVDcom_2  //2
    	  }
    
    CHAR DVD_IP_n_PORT[DVD_NUM_DVDs][26] =  //if using a serial server   
    	  {//these must be empty if not ip
    	  '192.168.9.117:23',// IP & PORT
    	  ''
    	  }
    
    ....................
    
    DEFINE_MODULE  'VAV_Oppo_DVD_Mod,Rev0' Oppo_1(vDVDcom_Arry[DVD_1],dvDVD_Arry[DVD_1],DVD_INSTANCE_Arry[DVD_1],DVD_IP_n_PORT[DVD_1],DVD_COMTYPE_Arry[DVD_1],nDVD_IP_Type,nDVD_DeBug)	
    
  • cbutchercbutcher Posts: 16
    My understanding of how the modules works is:

    Everything passed into the module is global between the main line and the module. Meaning if you change the value of something in the module the new value available to the mainline as well.

    Passing a constant into a variable via a module call would then be illegal.

    CJ Butcher
    Software Development manager
    CineTouch
Sign In or Register to comment.