vken Posted October 14, 2017 Report Posted October 14, 2017 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.
hotwires Posted October 14, 2017 Report Posted October 14, 2017 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).
vken Posted October 15, 2017 Author Report Posted October 15, 2017 hi there, thank you for you answer it's a v1040. I look for an example by I didn't find it. where is located?
vken Posted October 17, 2017 Author Report Posted October 17, 2017 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!
hotwires Posted October 17, 2017 Report Posted October 17, 2017 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.
MVP 2023 Joe Tauser Posted October 19, 2017 MVP 2023 Report Posted October 19, 2017 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.
vken Posted October 19, 2017 Author Report Posted October 19, 2017 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
MVP 2023 Joe Tauser Posted October 19, 2017 MVP 2023 Report Posted October 19, 2017 The MJ10-22-CS25 is a crossover cable, which will work. Post your code so we can see if you've initialized the port properly. Joe T.
MVP 2023 Ausman Posted October 19, 2017 MVP 2023 Report Posted October 19, 2017 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
vken Posted October 23, 2017 Author Report Posted October 23, 2017 here is the code. It works for receiving but it doesn't for sending to pc. also I use RsRec for testing. it works fine for many other applications. thank you vken RS232 communication.vlp RsRec.rar
hotwires Posted October 24, 2017 Report Posted October 24, 2017 All testing (successful) I have conducted with bidirectional asynchronous serial communications have used Unitronics MJ10-22-CS25 and terminal programs with flow control "OFF".
MVP 2023 Joe Tauser Posted October 25, 2017 MVP 2023 Report Posted October 25, 2017 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
vken Posted October 28, 2017 Author Report Posted October 28, 2017 It works. Thank you both of you. It seams that I have a lot to learn
vken Posted October 29, 2017 Author Report Posted October 29, 2017 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
MVP 2023 Joe Tauser Posted October 31, 2017 MVP 2023 Report Posted October 31, 2017 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
vken Posted October 31, 2017 Author Report Posted October 31, 2017 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?
vken Posted November 20, 2017 Author Report Posted November 20, 2017 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
MVP 2023 Joe Tauser Posted November 21, 2017 MVP 2023 Report Posted November 21, 2017 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
vken Posted November 21, 2017 Author Report Posted November 21, 2017 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.
MVP 2023 Joe Tauser Posted November 21, 2017 MVP 2023 Report Posted November 21, 2017 Excellent! Your solution of putting the Stream variable at location 2 is good - there's no question of which message was received. Joe T.
Ravi Posted October 22, 2018 Report Posted October 22, 2018 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
Ravi Posted October 22, 2018 Report Posted October 22, 2018 Also Please send me sample program for PCOM Protocol Both in Binary/ASCII Format On RS 485 Link
MVP 2023 Joe Tauser Posted October 22, 2018 MVP 2023 Report Posted October 22, 2018 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.
MVP 2023 Ausman Posted October 22, 2018 MVP 2023 Report Posted October 22, 2018 Ravi, don't forget you need to be logged in to get any file attached to a post. cheers, Aus
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