Nick. Posted February 7, 2018 Report Posted February 7, 2018 I new to the Ethernet card with the unitronics is there a way to send a command to a LAN web page? I'd Like to send commands like HTTP:\\192.168.1.4/30000/00 HTTP:\\192.168.1.4/30000/01 and so in
MVP 2023 Joe Tauser Posted February 7, 2018 MVP 2023 Report Posted February 7, 2018 Look at the Help on the TCP_RAW block. Joe T.
Nick. Posted February 9, 2018 Author Report Posted February 9, 2018 Joe I'm not sure what I'm doing wrong. please look at my ladder and let me know? V230 TCP Raw.vlp
MVP 2023 Joe Tauser Posted February 9, 2018 MVP 2023 Report Posted February 9, 2018 I may have led you astray. It dawned on me when I looked at your code and your initial post that HTTP usually uses port 80. It is also available in the Protocol choices when you configure a Socket Init. Unless you're using one of the old controllers with the Standard Instruction Set like a V230. Then it's not there. The TCP_RAW block just throws out what you feed it. What do you have connected to the other end? Are you using an Ethernet terminal program to look at what it's sending? Joe T.
Nick. Posted February 9, 2018 Author Report Posted February 9, 2018 I'm trying to run a network relay the relay is on IP 196.168.1.4 port 30000 the command to turn on relay number 1 is 192.168.1.4/30000/00 in a web browser I tried using a number of ports including HTTP on port 80 I also tried using a V230, V570 and a V1040 every time I get a -6 on the status bit = send failed
MVP 2023 Joe Tauser Posted February 9, 2018 MVP 2023 Report Posted February 9, 2018 You are out of my area of expertise with this. Sorry. But your code looks correct. What about the terminal idea? Unfortunately the Creators have gone home for the weekend. Hopefully another forum member has some experience here. Joe T.
hotwires Posted February 9, 2018 Report Posted February 9, 2018 Wireshark should work as a packet sniffer in this experiment. Should be doable with Enhanced Vision controllers. sorry I can't exactly tell you how to either.
MVP 2023 Ausman Posted February 9, 2018 MVP 2023 Report Posted February 9, 2018 Joe and Hots have way more knowledge on this than me, so probably showing my networking ignorance..... Have you tried leaving the socket open? Also, perhaps you could try doing the send as the entire address, port and activation number? I only mention this because I frequently use cheap(er) PTZ cameras that often want a "complete" send when accessing them. As in, the full http:// in the address as well. Also, they often interchange : with / or vice versa without mentioning that in manuals. I often have to muck around with addressing protocol to get them to work properly. They sometimes use an "adjacent" port as well. Do a sniff (Angry IP etc) on your network to make sure that the relay is just using the one port. Ohh yeah...you do actually mean http:// don't you ... not http:\\ ?? Maybe this might help. It will help to keep your weekend busy anyway! cheers, Aus
Nick. Posted February 16, 2018 Author Report Posted February 16, 2018 I got it working Thanks for all the help
MVP 2023 Joe Tauser Posted February 16, 2018 MVP 2023 Report Posted February 16, 2018 What did you do? Did embedding the entire string do the trick? Joe T.
Nick. Posted February 16, 2018 Author Report Posted February 16, 2018 I'm not sure why but after i send the command the relay it auto disconnects so i had to add a auto reconnect Let me know if there is a better way to do this. Thanks V570 Relay Test.vlp
MVP 2023 Joe Tauser Posted February 18, 2018 MVP 2023 Report Posted February 18, 2018 Your code is actually fairly straightforward and easy to read. One thing I would change is how your command numbers get set. This is a classic example of how Unitronics doesn't always compile the way we think it will. In this code- The logic I see is "If SB 147 and MB 460 pressed then Toggle MB 450 then based on MB 450 write either 0 or 1 to MI 60 and set MB 470". So I'm guessing you want to toggle MB 450 first and then write a number. But that's not how it compiles. Look at the STL Quick View for this network (right click on the network number)- "!" is the beginning of a logical statement the PLC solves. So let's break it down: 1. ! - Look at the state of MB 450 and copy it to LB 0 (local scratch bit 0) 2. ! - Look at SB 147 and the Rising edge of MB 460. If true, toggle MB 450. So far so good. 3. ! - Look at SB 147 and the Rising edge of MB 460 (again) AND the state of LB 0. If true, write 1 to MI 60. But wait! Didn't we want to toggle MB 450 and then consider it's state for the Store blocks? As you can see, this won't happen. General rule of thumb for Unitronics programming. If you operate on a bit (MB or timer), don't use it as a condition in the same network. To get predictable results, you need to break the network apart: I realize this seems redundant and illogical. But that's how it is. Enter this logic and look at the resultant STL views to see for yourself. Joe T. 1 1
MVP 2023 Ausman Posted February 18, 2018 MVP 2023 Report Posted February 18, 2018 Great explanation, Joe. And humour as well!! cheers, Aus
MVP 2023 Flex727 Posted February 19, 2018 MVP 2023 Report Posted February 19, 2018 Flex's Law of Ladder Logic: Unitronics does NOT charge you by the rung! Break up you code to the most simple logical elements. It makes sure you get the compile you want AND makes the code easier to read and debug.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now