Home AMX User Forum AMX General Discussion

IP CONTROL

Hello,

I am having difficulty programming a SHARP LED LC640U, using IP Protocol. This is my first experience trying IP. Take a look at my code and let me know where I have went wrong. Currently, none of the IP controls work. The switching for the Enova and Audio works.

'PROGRAM_NAME='9-259 Source Code'

DEFINE_DEVICE

dvTP = 10001:1:0 //AMX MXT-700i Touch Panel
dvMaster = 0:1:0 //Enova DVX2100HD Master
dvSHARP_LED1 = 0:3:0 //Sharp LED_1
dvSHARP_LED2 = 0:4:0 //Sharp LED_2
dvEnovaSwitch = 5002:1:0 //Enova DVX2100HD Switcher
dvVol1 = 5002:1:0 //Enova Volume

DEFINE_VARIABLE
INTEGER nTVStatus
INTEGER nClear


CHAR MON1IPAddress[15]= '192.168.0.108'
LONG MON1_IP_Port = 10002

CHAR MON2IPAddress[15]= '192.168.0.109'
LONG MON2_IP_Port = 10002


DEFINE_CONSTANT
tvON = 11
tvOFF = 12
Clear = 5

DEFINE_START
fnClearAll()

DEFINE_FUNCTION fnSystemOn()
{
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
WAIT 5
IP_CLIENT_OPEN(3,MON1IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'RSPW2 ',$0D" //Requests Power ON
IP_CLIENT_CLOSE(3)
WAIT 5
IP_CLIENT_OPEN(3,MON1IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'POWR1 ',$0D" //Powers On LED
IP_CLIENT_CLOSE(3)
WAIT 5
IP_CLIENT_OPEN(4,MON2IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'RSPW2 ',$0D" //Requests Power ON
IP_CLIENT_CLOSE(4)
WAIT 5
IP_CLIENT_OPEN(4,MON2IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'POWR1 ',$0D" //Powers On LED
IP_CLIENT_CLOSE(4)
WAIT 5
SEND_COMMAND dvEnovaSwitch, "'?AUDIO-MUTE'" //Requests Mute Status
WAIT 5
SEND_COMMAND dvEnovaSwitch, "'AUDIO_MUTE ENABLED'" //Enables Mute
nTVStatus = tvON
}

DEFINE_FUNCTION fnSystemOff()
{
IP_CLIENT_OPEN(3,MON1IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'POWR0 ',$0D" //Powers Off LED
IP_CLIENT_CLOSE(3)
WAIT 5
IP_CLIENT_OPEN(4,MON2IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'POWR0 ',$0D" //Powers Off LED
IP_CLIENT_CLOSE(3)
WAIT 5
SEND_COMMAND dvEnovaSwitch, "'AUDIO_MUTE ENABLED'" //Enables Mute
nTVStatus = tvOFF
}

DEFINE_FUNCTION fnClearAll()
{
SEND_COMMAND dvEnovaSwitch, "'AUDIO_MUTE ENABLED'"
WAIT 5
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE ENABLED'"
}

DEFINE_MUTUALLY_EXCLUSIVE
([dvTP,5],[dvTP,8],[dvTP,11],[dvTP,14],[dvTP,65],[dvTP,17],[dvTP,18]) //LED 1
([dvTP,6],[dvTP,9],[dvTP,12],[dvTP,15],[dvTP,65],[dvTP,17],[dvTP,18]) //LED 2
([dvTP,7],[dvTP,10],[dvTP,13],[dvTP,16],[dvTP,65],[dvTP,17],[dvTP,18]) //Both
([dvTP,7],[dvTP,10],[dvTP,13],[dvTP,16],[dvTP,5],[dvTP,8],[dvTP,11],[dvTP,14],[dvTP,65],[dvTP,17],[dvTP,18]) //Both and 1
([dvTP,7],[dvTP,10],[dvTP,13],[dvTP,16],[dvTP,6],[dvTP,9],[dvTP,12],[dvTP,15],[dvTP,65],[dvTP,17],[dvTP,18]) //Both and 2
([dvTP,61]..[dvTP,65],[dvTP,17],[dvTP,18]) //Audio
//Volume ([dvTP,4],[dvTP,50],[dvTP,51]) //Volume


DEFINE_EVENT
LEVEL_EVENT [dvVol1,1]
{
SEND_LEVEL dvTP,1,level.value
}


BUTTON_EVENT [dvTP,17]
{
PUSH:
{
fnSystemOn()
}
}

BUTTON_EVENT [dvTP,18]
{
PUSH:
{
fnClearAll()
WAIT 30
fnSystemOff()
// Switch to page Logo
SEND_COMMAND dvTP,"'@PPN-[prompt]Shutdown'"
WAIT 50
//Wait 5 seconds Switch to Logo
SEND_COMMAND dvTP,'PAGE-Logo'
TO[BUTTON.INPUT]
}

}

BUTTON_EVENT [dvTP,22]
BUTTON_EVENT [dvTP,23]
BUTTON_EVENT [dvTP,24]
BUTTON_EVENT [dvTP,25]
BUTTON_EVENT [dvTP,26]
BUTTON_EVENT [dvTP,27]
BUTTON_EVENT [dvTP,28]
BUTTON_EVENT [dvTP,29]
BUTTON_EVENT [dvTP,30]
BUTTON_EVENT [dvTP,31]
BUTTON_EVENT [dvTP,32]
BUTTON_EVENT [dvTP,33]
{
PUSH:
{
SWITCH(BUTTON.INPUT.CHANNEL)
{
CASE 22: IP_CLIENT_OPEN(3,MON1IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'POWR0 ',$0D" //Power Off
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
nTVStatus = tvOFF
CASE 23: IP_CLIENT_OPEN(3,MON1IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'POWR1 ',$0D" //Power On
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
nTVStatus = tvON
CASE 24: IP_CLIENT_OPEN(3,MON1IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'WIDE0 ',$0D" //Aspect Tog
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 25: IP_CLIENT_OPEN(3,MON1IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'WIDE8 ',$0D" //Dot by Dot
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 26: IP_CLIENT_OPEN(3,MON1IPAddress,MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'ITGDx ',$0D" //Input Tog
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 27: IP_CLIENT_OPEN(3,MON1IPAddress, MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'RCKY38 ',$0D" // Menu
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 28: IP_CLIENT_OPEN(3,MON1IPAddress, MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'RCKY46 ',$0D" //Exit
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 29: IP_CLIENT_OPEN(3,MON1IPAddress, MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'RCKY41 ',$0D" //Up Arrow
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 30: IP_CLIENT_OPEN(3,MON1IPAddress, MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'RCKY43 ',$0D" //L Arrow
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 31: IP_CLIENT_OPEN(3,MON1IPAddress, MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'RCKY42 ',$0D" //Down Arrow
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 32: IP_CLIENT_OPEN(3,MON1IPAddress, MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'RCKY44 ',$0D" //Rt Arrow
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
CASE 33: IP_CLIENT_OPEN(3,MON1IPAddress, MON1_IP_Port,1)
SEND_STRING dvSHARP_LED1, "$02,'RCKY40 ',$0D" //Enter
IP_CLIENT_CLOSE(3)
TO[BUTTON.INPUT]
}
}
}

BUTTON_EVENT [dvTP,34]
BUTTON_EVENT [dvTP,35]
BUTTON_EVENT [dvTP,36]
BUTTON_EVENT [dvTP,37]
BUTTON_EVENT [dvTP,38]
BUTTON_EVENT [dvTP,39]
BUTTON_EVENT [dvTP,40]
BUTTON_EVENT [dvTP,41]
BUTTON_EVENT [dvTP,42]
BUTTON_EVENT [dvTP,43]
BUTTON_EVENT [dvTP,44]
BUTTON_EVENT [dvTP,45]
{
PUSH:
{
SWITCH(BUTTON.INPUT.CHANNEL)
{
CASE 34: IP_CLIENT_OPEN(4,MON2IPAddress,MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'POWR0 ',$0D" //Power Off
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
nTVStatus = tvOFF
CASE 35: IP_CLIENT_OPEN(4,MON2IPAddress,MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'POWR1 ',$0D" //Power On
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
nTVStatus = tvON
CASE 36: IP_CLIENT_OPEN(4,MON2IPAddress,MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'WIDE0 ',$0D" //Aspect Tog
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 37: IP_CLIENT_OPEN(4,MON2IPAddress,MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'WIDE8 ',$0D" //Dot by Dot
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 38: IP_CLIENT_OPEN(4,MON2IPAddress,MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'ITGDx ',$0D" //Input Tog
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 39: IP_CLIENT_OPEN(4,MON2IPAddress, MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'RCKY38 ',$0D" // Menu
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 40: IP_CLIENT_OPEN(4,MON2IPAddress, MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'RCKY46 ',$0D" //Exit
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 41: IP_CLIENT_OPEN(4,MON2IPAddress, MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'RCKY41 ',$0D" //Up Arrow
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 42: IP_CLIENT_OPEN(4,MON2IPAddress, MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'RCKY43 ',$0D" //L Arrow
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 43: IP_CLIENT_OPEN(4,MON2IPAddress, MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'RCKY42 ',$0D" //Down Arrow
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 44: IP_CLIENT_OPEN(4,MON2IPAddress, MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'RCKY44 ',$0D" //Rt Arrow
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
CASE 45: IP_CLIENT_OPEN(4,MON2IPAddress, MON2_IP_Port,1)
SEND_STRING dvSHARP_LED2, "$02,'RCKY40 ',$0D" //Enter
IP_CLIENT_CLOSE(4)
TO[BUTTON.INPUT]
}
}
}

BUTTON_EVENT [dvTP,5]
BUTTON_EVENT [dvTP,6]
BUTTON_EVENT [dvTP,7]
BUTTON_EVENT [dvTP,61]
BUTTON_EVENT [dvTP,8]
BUTTON_EVENT [dvTP,9]
BUTTON_EVENT [dvTP,10]
BUTTON_EVENT [dvTP,62]
BUTTON_EVENT [dvTP,11]
BUTTON_EVENT [dvTP,12]
BUTTON_EVENT [dvTP,13]
BUTTON_EVENT [dvTP,63]
BUTTON_EVENT [dvTP,14]
BUTTON_EVENT [dvTP,15]
BUTTON_EVENT [dvTP,16]
BUTTON_EVENT [dvTP,64]
BUTTON_EVENT [dvTP,65]
{
PUSH:
{
SWITCH(BUTTON.INPUT.CHANNEL)
{
CASE 5: SEND_COMMAND dvEnovaSwitch, "'CLVIDEOI1O1'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
CASE 6: SEND_COMMAND dvEnovaSwitch, "'CLVIDEOI1O2'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
CASE 61: SEND_COMMAND dvEnovaSwitch, "'CLAUDIOI1O1'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'AUDIO_MUTE DISABLED'"
CASE 8: SEND_COMMAND dvEnovaSwitch, "'CLVIDEOI2O1'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
CASE 9: SEND_COMMAND dvEnovaSwitch, "'CLVIDEOI2O2'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'AUDIO_MUTE DISABLED'"
CASE 62: SEND_COMMAND dvEnovaSwitch, "'CLAUDIOI2O1'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
CASE 11: SEND_COMMAND dvEnovaSwitch, "'CLVIDEOI3O1'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
CASE 12: SEND_COMMAND dvEnovaSwitch, "'CLVIDEOI3O2'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
CASE 63: SEND_COMMAND dvEnovaSwitch, "'CLAUDIOI3O1'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'AUDIO_MUTE DISABLED'"
CASE 14: SEND_COMMAND dvEnovaSwitch, "'CLVIDEOI4O1'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
CASE 15: SEND_COMMAND dvEnovaSwitch, "'CLVIDEOI4O2'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'VIDEO_MUTE DISABLED'"
CASE 64: SEND_COMMAND dvEnovaSwitch, "'CLAUDIOI4O1'"
ON[BUTTON.INPUT]
SEND_COMMAND dvEnovaSwitch, "'AUDIO_MUTE DISABLED'"
CASE 65: fnClearAll()
TO[BUTTON.INPUT]
nClear = Clear
}
}
}

DEFINE_PROGRAM
IF (TIME = '23:59:00')
{
fnClearAll()
fnSystemOff()
SEND_COMMAND dvTP, '@PPN-[prompt]Shutdown'
WAIT 50
SEND_COMMAND dvTP,"'PAGE-Logo'"
}


//button1,button2,button3 = button numbers on TP
SYSTEM_CALL [1]'VOL1'(dvTP,51,50,4,dvVOL1,24,25,199)'

Comments

  • DHawthorneDHawthorne Posts: 4,584
    IP clients do not open instantly, and commands to them aren't cached or otherwise managed by the master. You can't run the IP_CLIENT_OPEN function then fire the command off right away. You need to structure your program better than jamming everything in a SWITCH. You need to open your client separately, track whether it's open or not, and send your commands based on that. You especially can't open the client, send a command, and close it right away. That entire process takes a good 5 seconds or more (that WAIT 5 in there is not going to cut it) - you really want that much lag between commands that need to go one after another?

    I would open the client on your power on function, then put the actual command in a queue that doesn't process until a online event occurs. You might need an additional delay between when the power on command goes to the TV and when it's ready for other commands as well. Again, it you queue your commands, you can hold up processing on it based on that. Depending on the device, I might never close the connection, but make a delay on an offline event that reconnects it after about 20 seconds. You probably want something like anyway in case it disconnects on you. Closing it on power off isn't a horrible thing, but may not be necessary.
  • JasonSJasonS Posts: 229
    Also I would advise turn all the "energy star" or "green" features off at first to determine if they interfere with control. Also firmware is a big concern, TVs do not generally work as advertised as far as control via IP goes. Make sure you have the latest firmware! What they say it does and what it actually does are 2 very different things, in my experience. Consumer models tend to be more difficult than Professional ones. Not to say that you can't get it to work, but be prepared to invest some time. One TV I had to control would not respond to a power On command via IP, so for the heck of it I tried Wake On LAN, and it worked! Another option is some manufacturers provide a "Display Power" command that turns just the backlight on and off so the electronics stay on so you can control it.
  • JasonS wrote: »
    Also I would advise turn all the "energy star" or "green" features off at first to determine if they interfere with control. Also firmware is a big concern, TVs do not generally work as advertised as far as control via IP goes. Make sure you have the latest firmware! What they say it does and what it actually does are 2 very different things, in my experience. Consumer models tend to be more difficult than Professional ones. Not to say that you can't get it to work, but be prepared to invest some time. One TV I had to control would not respond to a power On command via IP, so for the heck of it I tried Wake On LAN, and it worked! Another option is some manufacturers provide a "Display Power" command that turns just the backlight on and off so the electronics stay on so you can control it.

    Thanks for the feedback. I had that problem with the RS232 code, so I am attempting to try IP but I've never coded for IP before. Is there something I'm missing, I can't get any function to work.
  • John NagyJohn Nagy Posts: 1,742
    Discussed in several places on the forum...
    IF (TIME = '23:59:00')

    Note that the nature of the NetLinx processes are such that the mail line does not execute on every tick of the clock. If this precise time is specified, and the processor is in some other task at that tick, it will not match in your main line, and will miss your IF. You need a wider target, or a greater-than.
  • John Nagy wrote: »
    Discussed in several places on the forum...
    IF (TIME = '23:59:00')

    Note that the nature of the NetLinx processes are such that the mail line does not execute on every tick of the clock, if this precise time is specified, and the processor is in some other task at that tick, it will not match in you main line, and will miss your IF. You need a wider target, or a greater-than.

    John,

    Although I appreciate your help, that's irrelevant to my question. Are you able to provide help relevant to anything I've asked?

    Matt
  • JasonSJasonS Posts: 229
    Thanks for the feedback. I had that problem with the RS232 code, so I am attempting to try IP but I've never coded for IP before. Is there something I'm missing, I can't get any function to work.

    I would give you the exact same advice as Dave. Manage your IP connection and implement a queue, that should resolve your issues.
  • As has been mentioned by DHawthorne, you're doing it wrong, you can't open the port, send the string and close the port all in on function like that.

    To test new devices for IP I typically do something like this:
    CHAR sTestString[100]
    
    CHANNEL_EVENT[dvYourDevice,252] // open coms
    {
       ON:{ IP_CLIENT_OPEN(dvYourDevice.Port, YOUR_DEVICES_IPADDRESS, YOUR_DEVICES_IPPORT, 1) }
    }
    
    CHANNEL_EVENT[dvYourDevice,253] // close coms
    {
       ON:{ IP_CLIENT_CLOSE(dvYourDevice.Port) }
    }
    
    CHANNEL_EVENT[dvYourDevice,254] // send command
    {
       ON:{ SEND_STRING dvYourDevice, sTestString }
    }
    

    With that and using "Control a Device" from within NS you can pulse channel 252 to open the connection and pulse 254 to send whatever string you put into sTestString in the debug window.

    ---

    Also, when posting code you should use the proper forum tags around your code so it's easier to read for those of us attempting to help.
  • John NagyJohn Nagy Posts: 1,742
    mjones2620 wrote: »
    John,

    Although I appreciate your help, that's irrelevant to my question. Are you able to provide help relevant to anything I've asked?

    Matt

    Nope, others are doing that. Sorry to distract you with other issues in your posted code.
  • Sharp LED gree features
    mjones2620 wrote: »
    Thanks for the feedback. I had that problem with the RS232 code, so I am attempting to try IP but I've never coded for IP before. Is there something I'm missing, I can't get any function to work.

    On a slight tangent, you can send a non documented command to the Sharp TVs BEFORE turning them off that keeps the RS232 alive so you can switch it on again !!:

    // tell the TV NOT to power off the RS232 -- otherwise the energy saver stops us bringing it on again
    send_command vdvDISPLAY2, 'PASSTHRU=RSPW0001'
    WAIT 20 PULSE[vdvDISPLAY2, 28] // now we can KITCHEN TV OFF

    P.S. Using the AMX Duet module for the Sharp LED TVs
  • mpullinmpullin Posts: 949
    On a slight tangent, you can send a non documented command to the Sharp TVs BEFORE turning them off that keeps the RS232 alive so you can switch it on again !!:

    // tell the TV NOT to power off the RS232 -- otherwise the energy saver stops us bringing it on again
    send_command vdvDISPLAY2, 'PASSTHRU=RSPW0001'
    WAIT 20 PULSE[vdvDISPLAY2, 28] // now we can KITCHEN TV OFF

    P.S. Using the AMX Duet module for the Sharp LED TVs

    Sometimes the TV expects spaces and not zeroes, e.g. SEND_STRING dvTV, "'RSPW 1',$0D" I ran into a new model recently that actually accepted a 0,1, or 2 as parameters to the RSPW command, where 0 means "don't respond to power on," 1 is supposed to be for RS232 control and 2 for IP control. Even though we were controlling the TV via RS232, only 'RSPW 2' worked.
  • Thanks for the heads up mpullin, but which model was that?
    Would rather know ahead of time as we deal with a lot of Sharps LCDs...
  • mpullinmpullin Posts: 949
    Thanks for the heads up mpullin, but which model was that?
    Would rather know ahead of time as we deal with a lot of Sharps LCDs...

    'twas the LC-80LE650U.
  • mpullin wrote: »
    'twas the LC-80LE650U.

    Thanks again.
  • a_riot42a_riot42 Posts: 1,624
    DHawthorne wrote: »
    That entire process takes a good 5 seconds or more (that WAIT 5 in there is not going to cut it) - you really want that much lag between commands that need to go one after another?

    Waits are useless when it comes to IP code. You can never predict how long some IP function is going to take since it depends on the network. It has to be event based to work reliably. You have the online and offline events so that's all you really need to know for sending commands. If its online, send the command immediately, if not, open the port, and once its online then send the command immediately. Adding a wait simply adds a red herring to the issue and usually ends up adding unnecessary delays. Some servers will keep the connection open so you can send one packet after another, and others will close the connection after every packet, so with event triggered IP code, it doesn't matter, the right thing will always occur depending on the state of the connection.
    Paul
  • I know this is an old thread so this would be for anyone in the future with this problem, but the two issues i see are the IP port number which for all the Sharps i have done (many) is 10008. Also when controlling a Sharp Display via IP you need to get past the login and password prompts first (hence the CR, LF twice after opening the port). The code snip-it below works very well and you can build form there.

    CASE 2: // SELECT LCD Left Front Power Btn
    {
    IF (nDisp_2_Pwr = 0)
    {
    IP_CLIENT_OPEN(dvLCD_1.PORT,cLCD_1_IP,LCD_IP_PORT,1)
    WAIT 1 {SEND_STRING dvLCD_1,"$0D,$0A"}
    WAIT 2 {SEND_STRING dvLCD_1,"$0D,$0A"}
    WAIT 3 {SEND_STRING dvLCD_1,Disp_FCN[Disp_LCD_Pwr_ON]} // POWER ON LCD
    WAIT 4 {SEND_STRING dvLCD_1,Disp_FCN[Disp_LCD_HDMI]} // Set input to HDMI
    WAIT 5 {IP_CLIENT_CLOSE(dvLCD_1.PORT)}
    nDisp_2_Pwr = 1
    }
    ELSE IF (nDisp_2_Pwr = 1)
    {
    IP_CLIENT_OPEN(dvLCD_1.PORT,cLCD_1_IP,LCD_IP_PORT,1)
    WAIT 1 {SEND_STRING dvLCD_1,"$0D,$0A"}
    WAIT 2 {SEND_STRING dvLCD_1,"$0D,$0A"}
    WAIT 3 {SEND_STRING dvLCD_1,Disp_FCN[Disp_LCD_Pwr_OFF]} // POWER Off LCD
    WAIT 4 {IP_CLIENT_CLOSE(dvLCD_1.PORT)}
    nDisp_2_Pwr = 0
    }
    BREAK
    }
  • As has been said before in this thread, opening the IP port and then using waits to send commands is decidedly not the correct way to do this.

    When the IP port is opened it will create an online event. This online event handler is the place where you want to start sending commands.
Sign In or Register to comment.