Ravi Posted October 23, 2018 Report Share Posted October 23, 2018 12 hours ago, Joe Tauser said: I didn't have any problem downloading from the above link. What exactly are you looking for? Joe T. Dear Joe Good Morning to you. Thanks for reply I Got To Implement RS485 Communication Using FB Protocol or PCOM Protocol Binary Format for the following Receive and send Messages Command to Receive { <address of the machine>: <command> : <MSB of Command> :<LSB of Command>: <checksum>} STX><UnitID><CommandCode><Command parameters><CheckSum><ETX> {byte1:byte2:byte3:byte4:byte5} Command to Send {<Address Of the M/C>:<Echo of Command> :<MSBof Command>:<LSB of Command>:<%POWER>:<Temperature>:<FAULT/Healthy>:<Request To Respond>:<Power Applied>:CheckSum>} {STX><UnitID><Echo of CommandCode><Command parameters><CheckSum><ETX> {byte1+byte2+byte3+byte4+(byte5+byte2:byte6)+(byte7+byte8)+(byte9+byte10)+(byte11)+(byte12+byte13)} I Kindly Request a Sample Visilogic Programs for FB Protocol and PCOM Protocol. Thanks Quote Link to comment Share on other sites More sharing options...
Ravi Posted October 23, 2018 Report Share Posted October 23, 2018 13 hours ago, Joe Tauser said: I didn't have any problem downloading from the above link. What exactly are you looking for? Joe T. Dear Joe Good Morning to you I Got to Implement RS485 Communication Using FB Protocol /PCOM Protocol in Binary Format for the following Messages Command to Receive { address of the machine: command : MSB of Command :LSB of Command: checksum} STX><UnitID><CommandCode><Command parameters><CheckSum><ETX> {byte1:byte2:byte3:byte4:byte5} Command to Send {Address Of the M/C +Echo of Command :MSB:LSB:%POWER:Temperature:FAULT/Healthy:Request To Respond:Power Applied} {byte1+byte2+byte3+byte4+(byte5+byte2:byte6)+(byte7+byte8)+(byte9+byte10)+(byte11)+(byte12+byte13)} Quote Link to comment Share on other sites More sharing options...
Ravi Posted October 23, 2018 Report Share Posted October 23, 2018 Dear Joe Good Morning to you I got to Implement RS485 Communication Using FB Protocol /PCOM Protocol in Binary Format for the following Receive and Send Messages Command to Receive { address of the machine: command : MSB of Command :LSB of Command: checksum} STX><UnitID><CommandCode><Command parameters><CheckSum><ETX> {byte1:byte2:byte3:byte4:byte5} Command to Send {Address Of the M/C +Echo of Command :MSB:LSB:%POWER:Temperature:FAULT/Healthy:Request To Respond:Power Applied} {byte1+byte2+byte3+byte4+(byte5+byte2:byte6)+(byte7+byte8)+(byte9+byte10)+(byte11)+(byte12+byte13)} Quote Link to comment Share on other sites More sharing options...
Ravi Posted November 1, 2018 Report Share Posted November 1, 2018 Dear Joe Good Morning to you I am Waiting for Reply for above as well Sample Serial Communication Program with how to use Checksum in both Send & Receive Situations may be SUM8 /CRC. Thanks Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted November 2, 2018 MVP 2023 Report Share Posted November 2, 2018 You've just repeated the PCOM protocol guidelines from the documentation. https://unitronicsplc.com/Download/SoftwareUtilities/Unitronics PCOM Protocol.pdf So this tells me you're trying to implement a PC program to talk to Unitronics. This protocol is published to be embedded in a higher language program. But there are other easier ways to communicate with the PLC - the OPC Server, Modbus, and the .Net driver. I don't have the sample program you're looking for as I don't code at that level. When I want to talk to Unitronics with a PC program I use Visual Basic and an embedded Modbus control I purchased for $259.00 US. Way easier. What is the rest of your story? Joe T. Quote Link to comment Share on other sites More sharing options...
Ravi Posted November 2, 2018 Report Share Posted November 2, 2018 Dear Joy Good Morning Thanks for the Reply, OK I Got it. and How to Calculate SUM 8 Check SUM For The String Example : I sent "9901029999FF" From Terminal Program Simulator & Received IN V700 PLC in HEX Format as follows MI1310=3939;MI1311=3130;MI1312=3230;MI1313=3939;MI1314=3939; & MI1315=4646; Should I Split Each Byte & SUM it, Like{39+39+31+30+32+30+39+39+39+39+46+46},If Yes How Should I Split into Separate Bytes in Visilogic Ladder OR Should I SUM all My Integer Variables Like {MI1310+MI1311+MI1312+MI1313+MI1314+MI1315=MI1316} Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted November 2, 2018 MVP 2023 Report Share Posted November 2, 2018 This is a question for the Creators. Cut and paste your above post and send it to support@unitronics.com. This forum is not an official representation of the Unitronics staff, although they do weigh in from time to time. Joe T. 1 Quote Link to comment Share on other sites More sharing options...
Ravi Posted November 3, 2018 Report Share Posted November 3, 2018 Dear Joe Thank you For the Guidance Quote Link to comment Share on other sites More sharing options...
EPSAuto Posted July 28, 2021 Report Share Posted July 28, 2021 Hi Joe, I am a newbie to unitronics and PLCs and I'm playing around with a unitronics V570, I have connected a number pad which communicates via RS232 to COM2 in my PLC. I have downloaded your sample code and changed the COM init to COM2. On the PLC info mode I can see the PLC is receiving the messages when I press the buttons (it's a 3x4 numbered key pad and I can see R1 on the RX pane on port 2 in the info mode when I press key 1, R2 when I press R2 and so on). I want to display 1 when I press 1 and so on the text box. Any guidance is greatly appreciated. Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted July 28, 2021 MVP 2023 Report Share Posted July 28, 2021 "R1"? This is rather odd, but OK. I'm glad you've figured out Info Mode and learned how to look at the RX buffer. It sounds like you've got it set to display in ASCII mode. What is the end game here - do you want to use the external keypad to enter numbers? Put the unit in hex mode so you can see if there are any other characters like a carriage return or line feed. If you don't already know about asciitable.com it's a nice little resource. You'll need to strip the extra characters off each keypress and concatenate them together and convert them to a number. Post a screenshot of what you're getting and the PLC program you've working with. Joe T. Quote Link to comment Share on other sites More sharing options...
EPSAuto Posted July 29, 2021 Report Share Posted July 29, 2021 Many thanks for you reply Joe, Correct -the end game is to enter numbers on the external key pad (So when I enter a user code eg 1111 I want a gate/door to open). I discovered the message "P1" is displayed when the button is pressed and "R1" when you take your finger off the button. I have attached screenshots of the code and the info mode in ASCII and HEX. Thanks in advance Quote Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted July 29, 2021 MVP 2023 Report Share Posted July 29, 2021 So going on this result it would seem that you are going to get P(ressed) * for 0-9 * # and R(eleased) * for 0-9 * # Like Joe says, this would still mean you need to strip characters off to end up with what you want. Even if you ignored the "positive transition" signal of P and worked on the "negative transition" signal, or vice versa, you are still going to need to character work if you just want to end up with numbers. I'd actually use both the rising and falling signal to double check the pressed number. ie if P1 stripped of P equals the next signal which is R1 stripped of R, then it is a true indication that button 1 has been pressed and released, and the system can receive the next number. This would also be a way of self-correcting this sequence if something goes astray, by recognising that the numbers don't equal each other. On the pad you may even have a piezo that could be triggered if an error like this arose, effectively saying "start again". cheers, Aus 1 Quote Link to comment Share on other sites More sharing options...
EPSAuto Posted July 30, 2021 Report Share Posted July 30, 2021 Thanks for the reply Aus, I'm still stuck on the Scan protocol. MB2 does not increment so I think I'm not setting something right. Any tips on how to set up my scan protocol to read this message? My MI2 reads a -1 - I read on this thread that that happens when data is coming in but doesn't match the scan protocol? Thanks in advance. Gate Control 0.1.vlp Quote Link to comment Share on other sites More sharing options...
MVP 2014 Simon Posted July 30, 2021 MVP 2014 Report Share Posted July 30, 2021 I'd turn attention to the message format. You have a message length of 20 characters in the protocol scan, but the message is only 3 characters, including the CR (0D hex). Reduce your message template to 3 characters and you should see something better. In terms of decoding, you have at least 3 options: 1. Read the raw message then use logic to pull out the 2nd character as the data. As Aus suggests, you can use the "P" and "R" messages as a redundancy measure. Set the steam variable to put one character per integer. that way the second integer in the vector will hold the ascii value of the key that was pressed. 2. Create a variation of the template where the first and last characters are fixed text, and the centre character is linked to an MI. You would need two templates, one for the "P" messages and one for the "R" messages. 3. Do the "brute force" method and create 24 individual messages and use the "Index of received message" to tell you which key was pressed or released. Example below for the digits 0...3 1 Quote Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted July 31, 2021 MVP 2023 Report Share Posted July 31, 2021 @Simon , nice explanation. Well done. You must be in lockdown with some spare time on your hands! 🙂 cheers, Aus Quote Link to comment Share on other sites More sharing options...
MVP 2014 Simon Posted August 1, 2021 MVP 2014 Report Share Posted August 1, 2021 Thanks Aus 🙂 i think I'm getting more done during lockdown, in some areas at least. Quote Link to comment Share on other sites More sharing options...
EPSAuto Posted August 5, 2021 Report Share Posted August 5, 2021 Thanks for the suggestions Simon, Unfortunately, my session complete won't trigger. On the HEX mode the messages have spaces in between them, do I need to do something do the spaces? Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted August 6, 2021 MVP 2023 Report Share Posted August 6, 2021 1. Those aren't space characters. They're just spaces between the characters on the screen. 2. I finally got a chance to look at your version 0.1 program. In net 5 of Main, you are initializing COM 2 but the Protocol Config block right next to it is pointed at COM 1. This may be a problem. 😜 Upload your latest program if fixing the PROTOCOL CONFIG doesn't help. Joe T. 1 Quote Link to comment Share on other sites More sharing options...
EPSAuto Posted August 6, 2021 Report Share Posted August 6, 2021 Hi Joe, This was what my problem was all along 😐. Thank you so much for that. Thanks Simon and Aus for the tips. Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted August 6, 2021 MVP 2023 Report Share Posted August 6, 2021 10 hours ago, EPSAuto said: This was what my problem was all along 😐. There's a reason I knew to look there first. Welcome to the "Gah! I am such an idiot!" club. Been there. Joe T. 2 Quote Link to comment Share on other sites More sharing options...
EPSAuto Posted August 12, 2021 Report Share Posted August 12, 2021 Carrying on from this, I want to group 4 numbers and compare it to a set value. Eg. set password 1111 and compare it to the input. Any tips on doing this for me guys? Thanks in advance Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted August 12, 2021 MVP 2023 Report Share Posted August 12, 2021 I would convert each number as it came it to a decimal in a buffer, and then when the next number comes in multiply that buffer by 10 to move it over before adding the new converted number. Do you have the code figured out to get the number only from the string from the keypad? That must be done first. Joe T. Quote Link to comment Share on other sites More sharing options...
EPSAuto Posted August 12, 2021 Report Share Posted August 12, 2021 Thanks for the reply Joe, Can I do that within the scan block or is there another function to manipulate the incoming data. At the moment I have it printing P1, R1...etc on the screen. Serial Example.vlp Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted August 12, 2021 MVP 2023 Report Share Posted August 12, 2021 Try #2 in Simon's post above to extract the number directly from the "P" key press. If you haven't already, dig into the Help on the Protocol Scan block. I didn't have a chance to test this code. You'll have to let me know if it works. Joe T. SerialExample JT.vlp Quote Link to comment Share on other sites More sharing options...
EPSAuto Posted August 12, 2021 Report Share Posted August 12, 2021 Thanks for that Joe, The code you sent me works. I'm seeing the individual number now. Now I'm trying to gather 4 numbers together in an array, is there a function to do this? Or do I need to re-think my approach? Appreciate the support Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.