ncbc Posted May 16, 2019 Report Share Posted May 16, 2019 Hello, I'm trying to familiarize myself with programming a "vision 280" plc. I have a programming background and it's been pretty straightforward for the most part. One thing I have been having trouble with however is using the direct read and write to the data tables. I didn't for example know that they had their own memory address system until I found a reference to it in this doc: http://www.side-automatizacion.com/es/system/files/suport/visilogic20-20function_blocks.pdf Anyways here is what I would like to do. I would like to read "chuck" at ram 10 from the data table and put it in the vector ML 0-6 Then display it in an ascii text field The problem is I have gotten very inconstant results. Data I cleared from the data table sometimes shows up, it seems like it wants a memory END rather than an offset. I am sure there is an easier way to get strings out of the data table, but I would really prefer to learn the tools. Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted May 17, 2019 MVP 2023 Report Share Posted May 17, 2019 I've never had any luck getting the Data Table RAW function to work. Have you played with the regular data table read row function? Look in the Help under Examples and navigate your way to the Data Table directory. If you have questions post your code. Joe T. Link to comment Share on other sites More sharing options...
ncbc Posted May 17, 2019 Author Report Share Posted May 17, 2019 15 hours ago, Joe Tauser said: I've never had any luck getting the Data Table RAW function to work. Have you played with the regular data table read row function? Look in the Help under Examples and navigate your way to the Data Table directory. If you have questions post your code. Joe T. I'm glad it's not just me having trouble with it. I started out using the row read element, but it was unclear to me how to provide a defined vector for it to put the element into memory. I can point it to ML 0, but it's only reading the first 4 bytes from the datatable The Code is super minimal. When I press F4 load the data from the data tables to the vector ML 0-6 then switch to the name screen with an ASCII text field that reads from that vector. Perhaps I am using the wrong datatype? Longs may be doing something weird? But I really would like to learn how to use the direct read/write. Is it actually bugged and not workable for strings/vectors? Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted May 17, 2019 MVP 2023 Report Share Posted May 17, 2019 28 minutes ago, ncbc said: Perhaps I am using the wrong datatype? Yes you are. Use MI, not ML. For the above ASCII String, you will need a vector of 3 MIs to hold the 6 characters of your string. (I believe you can use MLs and hold 4 characters per register, but why complicate things.) In the Read Row FB, you need to assign an operand to every column in the Data Table Row. You can certainly make the operands contiguous so that you have a vector to operate on later, but you need an assignment for each element. Link to comment Share on other sites More sharing options...
Gabriel Franco Posted May 17, 2019 Report Share Posted May 17, 2019 I suggest to split code in two separated rungs: first, to read row and second to SET MB 0 (You´re using contact instead of coil) and load HMI. Make sure you´re not using ML 1 in other place and variable in HMI is large enough to show all characters. Link to comment Share on other sites More sharing options...
ncbc Posted May 17, 2019 Author Report Share Posted May 17, 2019 41 minutes ago, Flex727 said: In the Read Row FB, you need to assign an operand to every column in the Data Table Row. I am not using the data in the other columns at the moment. That column is a string, I don't really like how it doesn't clearly indicate it's going to write to the following 5 memory locations when it reads a string. I see the INTs are 16 bit and not 8 bit and it is stored little endian that was throwing me for a loop a little bit. I read up on the documentation on the direct read, and I was really underwhelmed with the detail in it. I was hoping to use it to store some graphical data. The one I linked to above is still the best resource I've found on direct read and it still seems lacking. 19 minutes ago, Gabriel Franco said: HMI is large enough to show all characters. The problem turned out to the the ML was storing the 8bit values in each Long. So it was using up the 6 character size with a bunch of nulls. GOOD FOR NUMBERS, BAD FOR STRINGS! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now