Passing IP Address to a Netlinx Module

Does anyone have any example of how to pass an IP address to a Netlinx Module?

Comments

  • the8thstthe8thst Junior Member Posts: 470
    DEFINE_VARIABLE
    char cMY_IP[] = '192.168.1.125'
    
    define_module 'MyModule' instance1 (cMY_IP)
    

    Is that what you are asking for?
  • tpeerytpeery Junior Member Posts: 5
    the8thst wrote: »
    DEFINE_VARIABLE
    char cMY_IP[] = '192.168.1.125'
    
    define_module 'MyModule' instance1 (cMY_IP)
    

    Is that what you are asking for?

    I have defined my ip address in my define module like this.

    (dev vdvprojector, dev dvprojector,dev dvtp, char lamp_hour_text_field, CHAR projector_ip)

    Then in my main program I have defined like this

    comm(vDVMON1,DVPROJECTOR1,dvtp,14,projector_1_ip)

    What I get in the complier is that the char of projector_1_ip is that it is an expression.

    Any ideas?
  • the8thstthe8thst Junior Member Posts: 470
    Both amp_hour_text_field and projector_ip are being declared as single byte character variables. You want to make them into an array of appropriate length.

    Change
    (dev vdvprojector, dev dvprojector,dev dvtp, char lamp_hour_text_field, CHAR projector_ip)
    
    to
    (dev vdvprojector, dev dvprojector,dev dvtp, char lamp_hour_text_field[4], CHAR projector_ip[15])
    

    I just guessed on the lamp hour length.
  • tpeerytpeery Junior Member Posts: 5
    the8thst wrote: »
    Both amp_hour_text_field and projector_ip are being declared as single byte character variables. You want to make them into an array of appropriate length.

    Change
    (dev vdvprojector, dev dvprojector,dev dvtp, char lamp_hour_text_field, CHAR projector_ip)
    
    to
    (dev vdvprojector, dev dvprojector,dev dvtp, char lamp_hour_text_field[4], CHAR projector_ip[15])
    

    I just guessed on the lamp hour length.

    Thanks I got it!! I actually was define the them as constants and not variables.
Sign In or Register to comment.