Sign in to follow this  
Followers 0
F4r14

Hostlink Protocol

13 posts in this topic

Hello all, I need to integrate in a VC++ aplication accesses to DM areas of an Omron PLC. I know that its possible to do that using Hostlink but i cant find the algorithm to generate the telegram to send via rs232. I was wondering if anyone can help me with this issue. TY for your time. Best regards

Share this post


Link to post
Share on other sites
Have a look here: Sysway(Hostlink) Demo Program

Share this post


Link to post
Share on other sites
Thank you.. I dont have VB here but i'll take a look when i get home. Another thing about communications with the plc.. I tried to setup Port 2 with RS-232C Mode, baud 9600, 8 data bits, one stop bit, no parity (8,1,N) and 02h as start code and 03 as end code(at PLC settings menu of CX-Programer). Used the RXD with 1st word at d3000, control word #0000 and #FF as number of bytes. My activation condition is A396.06, that i saw in the "W451-E1-03+CP1_-CPU+ProgManual" as being the Receive Ready but for some reason i cant get the data i'm sending from a PC in D3000. Anyone has an idea of what might be? maybe the cable? i used this one http://www.tryplc.com/Picture/Pic%20Artica...k%20RS-232C.jpg thank you in advance! best regards

Share this post


Link to post
Share on other sites
Make sure the PLC is in MONITOR mode!!

Share this post


Link to post
Share on other sites
Assuming the port setup is correct, do the following: Use A392.06, (not A396.06) For the 3rd parameter in the RXD, use A393. That is the number of bytes in the recieve buffer. Check DIP switch # 5 to make sure it is OFF (assuming CS or CJ PLC). Make certain that you have downloaded the PLC settings to the CPU. As Bits N Bytes indicated, check the PLC for Monitor mode. Check that your PC app is really sending chr(02) for a header and chr(03) for a terminator. I did a quick test of the following ladder, and it works properly for me.

Share this post


Link to post
Share on other sites
Thank you, i'll try that and get back to you as soon as i try it. The plc is a CP1L M30, using the port 2 for comunication. the start and end code are STX and ETX (ASCII 02 and 03), not sure if when i use this values in the settings it assumes that i'm referring to the ascii code. But i'll let u know when i have some results. Best regards. Edited by F4r14

Share this post


Link to post
Share on other sites
The 02 for the header is the STX character,the 03 is the ETX character. You may want to use something like Supermon for testing. This can easily send control characters. http://forums.mrplc.com/index.php?autocom=downloads&showfile=575 Your original bit of A396.06 is correct for port 2 on CP1L. A393 is correct for the byte counter for port 2. I would use #0200 for the control word (easier to understand later) Sorry, no CX Programmer on this PC. -------| |--------------| RXD | A396.06 | D3000 | | #0200 | | A393 | If you still have problems, I can test on CP1L Port 2.

Share this post


Link to post
Share on other sites
Better, but not good... I really cant understand whats happening. The telegram i respresented above is converted to ascii so it would be something like 02 54 30 31 30 30 31 30 31 31 30 30 30 31 30 35 03. when i turn DIP SW5 on i cant get any data, same occurs with STX and ETX enabled (start code 0x0002 and end code 0x0003). Turning it off, and setting i.e. to receive 24bytes in the PLC settings i can see the number of bytes of the telegram increase at A393 but for some reason they dont get stored at D3000. Usually only 1 or 2 bytes. If anyone has an idea, please...... Probably i'll be away next week but i'll try to keep in touch. thanks for all your help so far. take care. Edited by F4r14

Share this post


Link to post
Share on other sites
OK. Now I am back at my desk with hardware. A392.06 (not A396.06) is the correct address for notification of recieved data on port 2. Sorry about that. Here is a picture of the ladder, port setup, and the data I am sending from SuperMon. Works every time. DIP Switch 4 needs to be off for this to work. ThisWorks.bmp Edited by PMCR

Share this post


Link to post
Share on other sites
I just finished an application where I needed to communitcate a Zebra printer and computer running labview code. Computer connected to port 1 (mode hostlink), printer connected to port 2 (mode RS232). First to all, you need to make sure all settings matches on both devices connected, then, and even more important, cables should be the correct ones. (remember some Omron PLC requires power off-power on to use the new downloaded settings). Host link cable should be as per Omron specifications. Check it firts. Second, I advice you do download a serial port monitor and emulator for your PC. I used RealTerm (I really like it), then, check you are receiving exactly what you are sending from the PLC. A good tip is to go DM area and select view as ASC, then write something there and send it to you PC checking with Realterm. Make sure you have all there before you start checking your hostlink coding. Hope this helps. David Chavarria Automation and Industries - Costa Rica -

Share this post


Link to post
Share on other sites
josedavidch, While i applaud your answer to F4r14, please take note of the last date of the post before yours, it was over a year ago. I do not think that I have even since F4r14 post since then either. Please continue to contribute. Thanks Sleepy

Share this post


Link to post
Share on other sites
Greetings and my first post here, Can someone instruct on a basic "hello world" type test ofbasic hostlink protocol communication, via a terminal application, something like retrieve the current time or a version or something? PC and plc work ok with the current CX based app, so connectivity is ok. I've been asked to re-do the application in a language we can support, e.g tcl/tk, so my first step is to test comms before continuing and not mess anything up on the current settings of the plc. I'm reading the hostlink pages now. PLC is CQM1H/CPU51. Pleas do not rec. opc solutions at this time. I will describe in more detail of what I would like to do in a future post. sincerely, and tia, nikos

Share this post


Link to post
Share on other sites
The time would be a different fins message. I have done it in vb.net over ethernet sending fins messages. Provided the port is setup correctly i cannot see it being difficult to send the fins message's out of a RS232 port. There is a proper fins commands manual. Failing that OMRON finsgateway and compolet have prebuild tools avalible from OMRON.

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