Jump to content

Recommended Posts

  • MVP 2023

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • MVP 2023

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

Link to comment
Share on other sites

  • MVP 2023

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...