Jump to content

Recommended Posts

Hello,

I want to establish a single serial connection  with a computer serial port ,  sending and receiving numerical data.

how can I do it? is it a Modbus connection? 

it sounds easy for many of you but this is something new for me... :)

thank you.

 

Share this post


Link to post
Share on other sites

Serial Protocol function block. Unless computer is running SCADA software that is already MODBUS oriented. What model of Vision are you using? There is an example program for hyperterminal to PLC communication. I have a modified example for V430 that is bidirectional (scan and send FB's) serial comms PC runs realterm (or hyperterminal if your OS is old enough). 

Share this post


Link to post
Share on other sites

examples are on my screen now..

It will take me sometime to understand and modify the logic at the way I want it to function but it's a lot of help!

Thank you hotwire!

Share this post


Link to post
Share on other sites

If you have specific questions (or unexpected results) please post. My strong suit is with modbus. If you are developing a custom communications model then serial PROTOCOL method is probably the correct approach.

Share this post


Link to post
Share on other sites

Don't be afraid to post your code with specific questions, such as examples of the data you are trying to send and receive.  All the enhanced Vision series PLCs deal with serial data the same way.

Joe T.

Share this post


Link to post
Share on other sites

ok!

what about wire connection.

is it a full duplex wire connection?  I use usb serial adapter and I connect MJ10-22-CS25  as an adapter to go with a 4 pin cable to port 1. i tried also a crossover wire in the middle bud doesn't work.

 I did that also with a gsm modem on port 2 with a cross over db9 modem cable and it work. so i thought that might be the correct setup but it's not

 

Share this post


Link to post
Share on other sites

There used to be a specific communications pdf within the Unitronics documentation download, which I think would be good for you to have.  But I can't find it online now.  The nearest I get is the online version here   https://unitronicsplc.com/Download/SoftwareHelp/VisiLogic_Knowledgebase/VisiLogic.htm      

And then click on Communication and drill down.

The disappearance was discussed in part here:   

  

However, I have temporarily attached the old pdf for you to download direct.  Will delete it within a few months due to the size limits.

cheers,

Aus

VisiLogic - Communications.pdf

Share this post


Link to post
Share on other sites

All testing (successful) I have conducted with bidirectional asynchronous serial communications have used Unitronics MJ10-22-CS25 and terminal programs with flow control "OFF". 

Share this post


Link to post
Share on other sites

Using "Legal Entry" as the send trigger wasn't working.  If you look at it online you'll find that it gets set ON and stays on.  

I sized this down to fit on my V570, which is my testing unit.  I added a separate button for SEND and it seems to be working.  I also added a CR (ODh) as an ETX character to make it easier to work with my terminal program.

See if it works for you.

Joe T.

RS232communication on V570.vlp

Share this post


Link to post
Share on other sites

I made some modifications on the last version.

I add auto reply the received message and i  modify the protocol by adding some index.  ( i used ..\Project examples\Strings\V280_Receive_number_and_string.vlp )

following that index i tried to raise a mb at line 4 , but did'n work. 

(more or less i had in mind the configuration of a SMS CONFIG but as far as I know there is no such function in that case)

what do you think?

RS232 COMMAND.vlp

Share this post


Link to post
Share on other sites

As I mentioned in another post, Unitronics is not as fast as you think when it comes to communication functions.  It takes a few scans for the Protocol blocks to settle down and re-cock themselves.

I added a short delay in the "Echo" command.  I didn't test this, so you'll have to tell me if it works.  If it does work, try playing with the timer preset to see how fast it can go.

Joe T.

RS232COMMAND JT.vlp

Share this post


Link to post
Share on other sites

it looks that no matter what you chose the MI 1302 stays on 0.

that means that it doesn't scan at all.

can I make a subroutine that will read the  MI1310 - received string,  and match it with string that will raise a mb? 

 

 

Share this post


Link to post
Share on other sites

hi again,

i didn't have any luck with the scan yet. any other idea?

i thought that would be easier if there was a way to read the string and compare it with other but how can this be done? something like a manual  scan subroutine 

Share this post


Link to post
Share on other sites

Unlike actual Unitronics support employees, I don't have a selection of all PLC models to test on.  So I had to size the graphics down to the PLC I have handy.  Don't move the graphics around until it's working so I can easily help.

I tested the program again seems to be working on my end.  Notice the value in MI 1302 - Index of Message.  MI 1302 = 0 is valid - it means it received the first message.  The block starts counting at 0.  Look at the numbers in the purple column of the Protocol Scan block config window.  When it goes to -1 it means the block didn't understand what was sent and it didn't match any of the defined message formats.  But it did scan.  MB 1302 will not come on if it doesn't find a legitimate message.  And when it does it only stays on for one scan.

I added MB 0 to net 5 - Session complete memory.  It comes on when the PLC receives a legal message.  You have to press Clear Screen to reset it.

I changed net 4 to look for message index = 0, not 1.  I think it works the way you expect now.

You can reset MI 1302 to 0 and see for yourself if you send an improperly formatted message such as "ABC", as opposed to the properly formatted "#ABC*".   That's what the STX and the ETX check boxes are for.

Play with it some more to get a better feel for the block.  It's not the simplest thing in the world.

Joe T.

RS232COMMAND JT 1.vlp

Share this post


Link to post
Share on other sites

Hello Joe.

thank you for your effort!  it was really helpfull.

actually it worked like before, no matter if the input was in the list it returns 0 at MI1302. 

if the msg was not recognised it returns like you said -1.

however  the scan like you said it's working but it was always stopping at first index where it was getting the received message to fill the variable in MI 1310 . 

That's why as far I undrstand it was returning always the 0. 

I change the protocol scan and I keep the row where transfer the received msg to variable  MI1310 at the end. so the received msg pass from all the rows before go to that row. It works!

now MI1302 get values like 0 for #0000* , 1 for #1234* and 2 for any other valid format msg 

thank you very much once again for the support.

 

 

 

Untitled.jpg

Share this post


Link to post
Share on other sites
On ‎11‎/‎21‎/‎2017 at 11:11 AM, Joe Tauser said:

Unlike actual Unitronics support employees, I don't have a selection of all PLC models to test on.  So I had to size the graphics down to the PLC I have handy.  Don't move the graphics around until it's working so I can easily help.

I tested the program again seems to be working on my end.  Notice the value in MI 1302 - Index of Message.  MI 1302 = 0 is valid - it means it received the first message.  The block starts counting at 0.  Look at the numbers in the purple column of the Protocol Scan block config window.  When it goes to -1 it means the block didn't understand what was sent and it didn't match any of the defined message formats.  But it did scan.  MB 1302 will not come on if it doesn't find a legitimate message.  And when it does it only stays on for one scan.

I added MB 0 to net 5 - Session complete memory.  It comes on when the PLC receives a legal message.  You have to press Clear Screen to reset it.

I changed net 4 to look for message index = 0, not 1.  I think it works the way you expect now.

You can reset MI 1302 to 0 and see for yourself if you send an improperly formatted message such as "ABC", as opposed to the properly formatted "#ABC*".   That's what the STX and the ETX check boxes are for.

Play with it some more to get a better feel for the block.  It's not the simplest thing in the world.

Joe T.

RS232COMMAND JT 1.vlp

Dear Joe Can You Please Re Post The File "RS232COMMANDJT1.vlp" or on anravindranatha@yahoo.com

Share this post


Link to post
Share on other sites

I didn't have any problem downloading from the above link.  

1 hour ago, Ravi said:

Also Please send me  sample program for PCOM Protocol Both in Binary/ASCII Format On RS 485 Link

 What exactly are you looking for?

Joe T.

Share this post


Link to post
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...