Jump to content

Recommended Posts

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

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

  • 2 years later...

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.

Link to comment
Share on other sites

"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.

 

Link to comment
Share on other sites

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

Keypad.jpg

Hex output 1.jpg

Hex output 2.jpg

ASCII Output 1.jpg

ASCII Output 2.jpg

PLC Code 2.JPG

PLC Code.JPG

PLC Code 1.JPG

Link to comment
Share on other sites

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

  • Thanks 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. 

image.png
 

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.

image.png

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.

image.png

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

image.png

 

 

  • Thanks 1
Link to comment
Share on other sites

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.

  • Upvote 1
Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

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