SteveMyres Posted October 4, 2012 Share Posted October 4, 2012 The HTTP.Get() example in the manual shows to put the return in a string, specifically: global string dataindatain = HTTP.Get("www.weather.gov", "/xml/current_obs/KWMC.xml")[/CODE]I make an HTTP.Get call to a web service that returns the following:<boolean xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</boolean>and assigns it to the variable. You can echo the variable to the command line with ?datain, but string functions such as find() fail. What are the proper steps to parse this type of return? Link to comment Share on other sites More sharing options...
AzeoTech Posted October 5, 2012 Share Posted October 5, 2012 String functions should work fine. What do you mean by "fail"? What are you trying? Link to comment Share on other sites More sharing options...
SteveMyres Posted October 5, 2012 Author Share Posted October 5, 2012 Well, I was trying to do a find() to check the true/false return value, but it wouldn't seem to work yesterday. I was doing it from the command line and I probably got the syntax wrong. Seems to work find today. Sorry about the false alarm! Link to comment Share on other sites More sharing options...
ledbelly2142 Posted October 15, 2012 Share Posted October 15, 2012 In my experience, www.weather.gov is not 100% consistent. So you may have had it correct in the command line and the www.weather.gov/... server was not responding correctly. Link to comment Share on other sites More sharing options...
SteveMyres Posted October 16, 2012 Author Share Posted October 16, 2012 I wasn't actually Get()ing from weather.gov. That's just a quote from the manual to demonstrate usage. Link to comment Share on other sites More sharing options...
SteveMyres Posted November 5, 2012 Author Share Posted November 5, 2012 This HTTP.Get() call takes like 6-8 seconds to return, and in the meantime my Modbus comms (on the same ethernet port) report "Illegal data address" which I suspect may be the error shown for no response because the port is tied up. Is there a way to be able to use the port for both things simultaneously? Is a port thing or is it the sequence in which the Get() is called that's tying everything up? Link to comment Share on other sites More sharing options...
AzeoTech Posted November 5, 2012 Share Posted November 5, 2012 They shouldn't be linked together at all. Is it repeatable? Link to comment Share on other sites More sharing options...
SteveMyres Posted November 5, 2012 Author Share Posted November 5, 2012 More often than not. Here's the sequence: global string FileSelected = Registry.strFileSelectedprivate idxwhile(1) try() if((MarkFileSelected > -1) & (MarkFileList[MarkFileSelected] != FileSelected) & !SysBits[0][0] & (N7024[0] < 5)) FileSelected = MarkFileList[MarkFileSelected] switch case (FileSelected == "xPOINT05MG") idx = 1 case (FileSelected == "xPOINT1MGx") idx = 2 case (FileSelected == "xPOINT2MGx") idx = 3 endcase ?"Idx: " + idx Device.PLC.SetRegisterS16(PLC_Stn, 112, idx) private string ParseRet = MakeUpper(ParseXML(HTTP.Get("localhost", "/LoadFile/" + FileSelected + ".dat"))) if(ParseRet == "TRUE") ?"File Accepted" Registry.strFileSelected = FileSelected else ?"File Not Accepted" endif endif catch() ?"Error" endcatch delay(0.2) endwhile[/CODE]And from the Command/Alert Window:Idx: 3File Accepted11/05/12 12:46:32.706P-ModbusTCP 0003: Illegal Data Valuemarkfileselected = 1Idx: 1File Accepted11/05/12 12:46:58.619P-ModbusTCP 0003: Illegal Data ValueOr do you think the 0003 error is coming from the Device call in the sequence? Link to comment Share on other sites More sharing options...
AzeoTech Posted November 5, 2012 Share Posted November 5, 2012 Illegal data value is an error generated by the device. It isn't a communications issue, its simply that you are asking it to set a value that isn't correct. Are you sure that your setRegisterS16() parameters are correct? I'll bet if you look at the comm monitor for when it does that command, that DAQFactory is successfully outputting the correct Modbus command and you are getting a valid (albeit error) response from the device. Link to comment Share on other sites More sharing options...
SteveMyres Posted November 5, 2012 Author Share Posted November 5, 2012 Can't imagine why it would be a problem. It's just the 113th integer register in a block of a couple hundred. No particular limits on what can be written there. Any 16 bits should work, and certainly integer values of 1-3. It's the same call as numerous other places. Even so, I'll experiment and see if I can figure out what it doesn't like. Link to comment Share on other sites More sharing options...
SteveMyres Posted November 5, 2012 Author Share Posted November 5, 2012 From the Command/Alert window: ?device.plc.SetRegisterS16(PLC_Stn, 112, 1) ?device.plc.ReadHoldingS16(PLC_Stn, 112, 1) 1 ?device.plc.SetRegisterS16(PLC_Stn, 112, 2) ?device.plc.ReadHoldingS16(PLC_Stn, 112, 1) 2 ?device.plc.SetRegisterS16(PLC_Stn, 112, 3) ?device.plc.ReadHoldingS16(PLC_Stn, 112, 1) 3 So the slave doesn't seem to object to any of the relevant values being written to that address if it's done manually from the prompt. What would be the difference? Link to comment Share on other sites More sharing options...
AzeoTech Posted November 6, 2012 Share Posted November 6, 2012 Try removing the HTTP.get() function and replacing it with something static and see if it fixes the problem. Link to comment Share on other sites More sharing options...
SteveMyres Posted November 6, 2012 Author Share Posted November 6, 2012 Oh, and please don't laugh about the filenames hardcoded into the sequence. It's just a quick band-aid to temporarily restore compatibility with something that was inflicted on me in another part of the system. As soon as I get five minutes I'll do a GUI for mapping the filenames to the ordinals. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 6, 2012 Share Posted November 6, 2012 I wasn't laughing. I was giving you a valid suggestion. If you think HTTP.Get() is causing the problem, remove it and see if it fixes the problem. Link to comment Share on other sites More sharing options...
SteveMyres Posted November 6, 2012 Author Share Posted November 6, 2012 No, no, that wasn't in response to what you said, it was just my own embarrassment about the hardcoded list of file names in the sequence. I have played with the sequence some without definitive results yet. Will post when I have some. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 6, 2012 Share Posted November 6, 2012 Sorry, please remember that I read these things totally out of order across multiple posts / emails, so often don't follow the full train of thought of the thread, especially with longer threads. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.