Jump to content

Recommended Posts

Hello all,

I am first time user of Unitronics and I would like to ask You for help for one problem that I have.

I am using data tables in visilogic to program some basic parameters, One of the coulmns is called NAME OF THE PROGRAM(Ime programa) defined as string 20 character using MI memory.

So when i try to read ascii string for every column i cant get it. It shows me the Name of the program on first one and later like it is eating the letters on HMI screen like this:

Program Number 0

Program Number

Program Numb  and so on...

And I would like to show me tha names of each program. Could You please help me understand what I am doing wrong?

Capture.PNG

Capture1.PNG

Link to comment
Share on other sites

You have to take care:

1. "String" variable in Data Table limited to 20 characters and should not be terminated by 0x00 symbol.

2. "String" variable in PLC MIs vector limited to 20 characters and should be terminated by 0x00 symbol.

So you have to allocate (20+1)/2, rounded up. I.e. 11 MIs.

3. It is good practice to clean (fill by 0x00) used for string MIs vectors.

.

Link to comment
Share on other sites

On 3/3/2022 at 2:23 PM, Gabriel Franco said:

You need to reserve 5 MIs for each program name, e.g. name of program 6 use MI33 up to MI37, program name 7 use MI38 up to MI42 and so on. Also make sure set MB55 if you watn to update name to be updated on screen. I use to SET that MB continously in my ladder.

 

I have done all like You said but still have the problem of not showing all the names.

Link to comment
Share on other sites

I think I know your Issue, I just inadvertly did exactly the same while adding a bunch of texts

Since each line is the previous one without 2 characters I'll bet you that you are displaying MI33, MI34,MI35,MI36... when you should be Increasing by 10 MIs per line

 

So each String has a lenght of characters, deppending of the type of addres you are using (MI, ML, DW) you can store a different characters per addres, in my case:

I start with DW40,  and I want 56 characters, each DW is 32 bit so I can store up to 4 string characters as ASCII, so i need 14 registers per line.

so in my example:

Line 1 Start of Vector DW40 Number of characters 56
Line 2 Start of Vector DW54 Number of characters 56
Line 3 Start of Vector DW68 Number of characters 56
Line 4 Start of Vector DW82 Number of characters 56
Line 5 Start of Vector DW96 Number of characters 56
Line 6 Start of Vector DW110 Number of characters 56
Line 7 Start of Vector DW124 Number of characters 56
Line 8 Start of Vector DW138 Number of characters 56
Line 9 Start of Vector DW152 Number of characters 56

 

I dont know how you are reading the data dable string values, but you should use at least 10 MIs to store 20 charactes (according to my math), one MI can store up to 16 bits (2  ASCII characters,   Each ASCII character is 1 byte or 8 bits ),  so if you are storing starting on MI 33, next string should be stored starting on MI43, MI53, MI63 and so on.

 

 

Hope it Helps,

Fernando

Link to comment
Share on other sites

  • MVP 2023
4 hours ago, Fernando Castro said:

you should be Increasing by 10 MIs per line

As a side issue, if this is indeed the case, it could/might be a classic example of why I put labels into all areas of Vectors I use, so that those areas are not used inadvertently for something else......because when you open them for use nothing shows.  I used to do it simply as a Vector No. label, but these days am a little more specific  eg  "4/Mbus53"  means the 4th MI in a vector of things read from Mbus unit 53.

cheers, Aus

Link to comment
Share on other sites

On 3/8/2022 at 4:08 PM, Ausman said:

As a side issue, if this is indeed the case, it could/might be a classic example of why I put labels into all areas of Vectors I use, so that those areas are not used inadvertently for something else......because when you open them for use nothing shows.  I used to do it simply as a Vector No. label, but these days am a little more specific  eg  "4/Mbus53"  means the 4th MI in a vector of things read from Mbus unit 53.

I try to do the same, it was somethink that i feelt tedious to manyally do, until I discover you can select multiple rows on the operands tab the description column and it can auto fill all the selected ones with the same text + the index you want . 

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...