Jump to content

Set register from csv file


Recommended Posts

Is there a way to set the value of MI from a file? I have a set of constants in my program and instead of having manual set all value I want to set the MI when the program is run.

In my case, there are type a,b,c,d ,e,f and I want to set temp1= 1.45 for a and so on.

temp2, temp3,temp4 ,temp5 as shown in the table

image.png.c09c4a2ae6af93d926e07d9689e23580.png

 

image.png

Link to comment
Share on other sites

  • MVP 2023

I definitely did not understand why you need to read this data from the CVS file.

It is probably easiest to use the built-in Data Tables. You can read about them in the help. The embedded mechanism of writing and reading from Data Tables is quite flexible, and by choosing the appropriate line number, you can easily change (load) up to 32 variables of different types in one ladder rung.

One of the columns of the table can even be a text description of the program or recipe that is being used at the moment.

  • Like 1
Link to comment
Share on other sites

@kratmel thank you for your response

Let temp1=1,temp2=2temp3=3...

If temp=1 I want type a model to store 1.45 ml1

If temp=2 I want type a model to store 2.48 ml1

If temp=1 I want type b model to store 1.86 in ML 1

If temp=2 I want type b model to store 3.06 in ML 1

and so on . I don not want to manual load that to register. Can I use csv or txt to do so?????

 

Link to comment
Share on other sites

  • MVP 2023

For a PLC, it doesn't matter how many times you read from the data table and write information to the memory cells.

As far as I understood, these are constants that should alternate depending on the index. If this is so, and your code solves your task, then everything is fine.

However, you must put the comparison elements before the increment and decrement commands so that your index does not exceed the number of available rows in the table and does not become negative.

P.S. I also recommend placing each command in a separate line (see rung 2 - two function in one rung).

  • Like 1
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...