samJones Posted February 5, 2020 Report Share Posted February 5, 2020 Hi, I am trying to read and log the output of the third party device (in this case a LGR trace gas analyser connected to a value manifold also controlled by the PLC) using a US5-B10-T24 PLC. The device returns 31 columns of data as a 521 character hexademical message. Of this I need to record at least columns 1, 2, 4, 6 and 8. The first column is a timestamp formatted as "dd/mm/yy hh:mm:ss.sss" and the subsequent columns are data values in scientific notation in the format "x.xxxxxe+/-xx" e.g. 1.56789e-01. I am able to use message composer and parse message to store this information as integers. For example for each of the data columns I populate data tags for the integer value (i.e. 6 digit integer, int32), decimal position (one digit, unit8) and the value of the exponent (sign and one digit, int8). I can then reconvert this information into real numbers. During testing this works fine for a message containing up to 5 columns of data, however, when I add a 6th column I encounter a strange problem where by the decimal position data tag for the 1st column appears to inherit the value of the integer data tag for the 6th column. Addition of a 7th column then extends this problem to the 2nd column and so forth. I'm either unable to see a silly (and repeated) mistake in my program or I guess I'm reaching some limit in the PLC's memory. I don't have a good grasp on the processing structure for this device (a hazard of GUIs maybe), so I'm hoping someone here might be able to help me identify the cause of my problem. I have attached here two programs (split between this and the subsequent post due to size limit), one (lgrC2-C6red) for 5 columns of data and one (lgrC2-C7red) for 6 columns of data. Examples of my problem are as follows: Examples lgrC2-lgrC6red program 5 columns (C2 - C6) with each linked in message composer to an integer (lgrC2-6_int), decimal position (lgrC2-6_dec) and exponent (lgrC2-6_exp) data tag works fine. When receiving the message; C2 = 2.2e2, C3 = 3.3e3, C4 = 4.4e4, C5 = 5.5e5, C6 = 6.6e6, the PLC displays lgrC2-6_dec = 1, lgrC2-6_int = 22 to 66 and lgrC2-6_exp = 2 to 6. 5 column hexadecimal message with control characters 20 20 20 20 32 2E 32 65 32 2C 20 20 20 20 33 2E 33 65 33 2C 20 20 20 20 34 2E 34 65 34 2C 20 20 20 20 35 2E 35 65 35 2C 20 20 20 20 36 2E 36 65 36 0A lgrC2-C6red program 6 columns (C2 - C7) each linked to an integer (lgrC2-7_int), decimal position (lgrC2-7_dec) and exponent (lgrC2-7_exp) data tag does not work. When receiving the message; C2 = 2.2e2, C3 = 3.3e3, C4 = 4.4e4, C5 = 5.5e5, C6 = 6.6e6, C7 = 7.7e7, the PLC displays lgrC2_dec = 77, lgrC3-C7_dec = 1, lgrC2-7_int = 22 to 77 and lgrC2-6_exp = 2 to 7. 6 column hexadecimal message with control characters 20 20 20 20 32 2E 32 65 32 2C 20 20 20 20 33 2E 33 65 33 2C 20 20 20 20 34 2E 34 65 34 2C 20 20 20 20 35 2E 35 65 35 2C 20 20 20 20 36 2E 36 65 36 2C 20 20 20 20 37 2E 37 65 37 0A Thanks in advance for any input or suggestions, Sam lgrC2-lgrC7red.ulpr Quote Link to comment Share on other sites More sharing options...
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.