Jump to content

Recommended Posts

Posted

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
Posted

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.

Posted

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
Posted

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.

  • MVP 2023
Posted

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

  • MVP 2023
Posted

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-

image.png

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)-

image.png

"!" 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:

image.png

I realize this seems redundant and illogical.

Spock.jpg

But that's how it is.  Enter this logic and look at the resultant STL views to see for yourself.

Joe T.

 

 

  • Like 1
  • Upvote 1
  • MVP 2023
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.