Sign in to follow this  
Followers 0
John Chan

Logging of value of an address in CJ2M

4 posts in this topic

I want to create a series of logs on the value of at address 1000 at every 10 seconds in the PLC CJ2M. And later display these logged data on the NS5 PT Anyone can help me out on this? Thank you. Edited by John Chan

Share this post


Link to post
Share on other sites
How long do you want to log for ?You can log in the screen if you want... Or if you want to solely log in the PlcIf you understand what an array is then I would suggest that you look at the DIST and COLL functions and the WSFT (word shrft). Plan on how much data you want to store.... Read about these instructions and learn a little then come back and ask again. Happy to help... But you will learn more if you actively particpate in the process as well.

Share this post


Link to post
Share on other sites
Thank you for your advise. 1. I have tried out DIST. I am able to record the values into an array for integer value, but not with real value. Does DIST works for real value? After I recorded the values in a series of addresses, eg. 5000, 5001, 5002, 5003, 5004, 5005, ... How can I display them in the form of a table where the number of values recorded varies? Attached are the project files that I used with integer value. 2. I have also tried to save the recorded values into a CSV file in a CF card at the PLC. But the value is hexadecimal. How do I save the value as an integer value. Eg. Integer: 239, save as 239 and not EF. Logging_CX_Prog.zip Data Logging_HMI.zip Edited by John Chan

Share this post


Link to post
Share on other sites
Hello I'd use an array within a ST function block. Declare a variable MyINT[2]. The array length doesn't matter. Use AT addressing (D0 would be good) example code MyINT[Pointer] := ValueToLog; Pointer := Pointer + 1; If Pointer > MaxNumber then Do Something; end_if; You can offset from D0 by: MyINT[Pointer + 1000]; (* This will start at D1000 *) Obviously, the 1000 can be an input to the FB giving you flexibility. From within the ST, you can use the WRITE_TEXT instruction to get your numbers on the CF. This will write ASII text, so you'll need to convert each value just before writing using the in line conversion (INT_TO_STRING and its variants) You may want to log 10 values (for example) then add a line feed. This is buried in the help file showing how you code non-printable characters: $$: $ mark (ASCII code: #24) $': single quotation (ASCII code: #27) $L or $l: line feed (ASCII code: #0A) $N or $n: new line (ASCII code: #0D0A) $P or $p: form feed (ASCII code: #0C) $R or $r: Carriage return (ASCII code: #0D) $T or $t: Horizontal Tabulation (ASCII code: #09) Pp Edited by ParaffinPower

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