Sign in to follow this  
Followers 0
mitsubishi_user

FIxed Buffer Communication

22 posts in this topic

Hi!! I am confused right now with the packet structure in sending data to an external device (Markem printer). I need to send this data (attached file) to the printer to update variable data to be printed. I am planning to use Fixed Buffer with no procedure. Do I simply use the instruction ZP.BUFSND? given that I have successfully opened the port for the target device (using ZP.OPEN instruction)? I need your expert advise.

Share this post


Link to post
Share on other sites
Which software and which language in the software are you using?

Share this post


Link to post
Share on other sites
OK, Simple Ladder then? You have the correct instructions. EDIT: Just give the instructions a try, and get back if you have any issues. Edited by kaare_t

Share this post


Link to post
Share on other sites
I just testes communication through fixed buffer.. First, I used open port instruction and it went out successfully. And then I tried to send full message to Printer, the first message I got a negative acknowledge (nAK) response, does this mean I am communicating already with printer but wrong message format only?

Share this post


Link to post
Share on other sites
Yes, a NAK is a response from the printer telling you that it cannot interpret what you sent to it.

Share this post


Link to post
Share on other sites
Is there any software that I can use to check what I am sending to the Printer? Like simultaneous monitoring?

Share this post


Link to post
Share on other sites
Check out Wireshark. Freeware. EDIT: I was just thinking a bit more about this and wanted to let you know some small facts. Note that if you want to monitor between the two devices you will need a hub, or a managed switch with mirroring capabilities. A regular switch will not work. This is because of the way a switch is made; it only forwards traffic to a destined MAC address on the specific port the MAC address is on, therefore communication between a PLC and a Camera will only find place on the two actual ports that they are connected and not any third port your PC is connected. Therefore, you can do one of the following: 1. Set up a good old HUB (a hub is not as intelligent as a switch, and simply sends a telegram out on all the ports, hence traffic will flow to your computer both from the camera and from the PLC) 2. Use a managed switch and set up port mirroring (in the way that you define that all ports should be mirrored to the port your computer is on, then traffic on all ports will be mirrored to the computer port and you will see all traffic) 3. Simply set up the PLC against your computer and see what the PLC sends. This way you will not be able to see communication in both directions simultanously, however you will see what the PLC is actually sending since you can receive it on your computer. In any way, no matter what software you use on your computer (Wireshark or other), the above is still valid. Edited by kaare_t

Share this post


Link to post
Share on other sites
Can I use CONTEC-Mitsubishi NZ2EHG-T8 as hub for this matter? NZ2EHG_T8.pdf

Share this post


Link to post
Share on other sites
No, as I can understand from the manual this is actually a switch. I guess that the Asian guy's who wrote the manual wanted to use the expression "HUB" (sometimes also referred to as "Bridging", as the manual states), however it is indeed a switching device so it will act as a regular switch, hence not sending all traffic to all ports. Do you have anything old laying around? I don't think I've ever seen a HUB with 1Gbps capabilities, so a good old 10Mbit or 10/100Mbit would maybe work if it is a HUB.

Share this post


Link to post
Share on other sites
There might be another method to intercept the communication between plc and device by using two networks cards in your pc. I assume you have one network card already. You could add an extra network card by using a cheap ethernet to usb "network" card (which will probably come in handy for other uses too, especially if your pc is already connected to an office network). Plug the plc and pc in a normal switch, plug the device into your usb network card and bridge them together in Windows. As such, you can intercept the traffic from plc to device in both directions using Wireshark on your pc. It sounds complicated but it isn't. I've used it on occasion for analysing profinet data between io-controller and io-device. However, if you need to intercept data regulary, a hub or intelligent switch would probably be easier. Edited by Mitsu

Share this post


Link to post
Share on other sites
I will try to look for another Hub. But I am suspecting part of my message to the printer "Data Checksum", maybe you could help me translate it into ladder. I attached file including Packet structure and Header Checksum. I am confused on the Data Checksum calculation part.

Share this post


Link to post
Share on other sites
In addition to this, 2 samples of message format that is sent but I can not get how he arrived at the "Data Checksum" part. Printer Data Format.pdf

Share this post


Link to post
Share on other sites
What software do you use for programming this, and which language? EDIT: The reason why I'm asking is that this is the same CRC as ModbusRTU uses and I have some finished function blocks for this purpose but it requires either GX IEC Developer, GX Developer WITH LABELS (so that you can use function blocks), GW 2 with Structured Ladder or GW 2 with simple ladder AND LABELS (so that you can use function blocks). If not using any of these and you are familiar with C/C++/C#/VB you can just google CRC Modbus RTU and you'll get lots of hits and just check out the code and convert it to simple ladder if that's what you're using. Edited by kaare_t

Share this post


Link to post
Share on other sites
Yes, but which language (Simple Ladder or Structured Ladder)???

Share this post


Link to post
Share on other sites
Are you familiar with Structured Ladder or other programming languages like C/C++/C#/VB so that you can convert an example to simple ladder yourself? If not, you will need someone to do the job for you (I would say appr. 4 hours of work to do the program).

Share this post


Link to post
Share on other sites
I am liitle bit familiar with structured ladder. If you have example, please share then I can work it out.

Share this post


Link to post
Share on other sites
Import the .sul file into a structured ladder project and open it. Then you can see how it is done. This is from a programatic Modbus routine, and the library contains the CRC blocks. I couldn't upload the .sul file, so I added the extension .txt. Just remove ".txt" and you have a .sul file. ModbusFXMaster_V100.sul.txt

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0