Doron Levi Haramati Posted January 11, 2022 Report Share Posted January 11, 2022 Hi guys, I'm working on a small project in Visilogic, with a small data table (an array of boolean types), at maximum size of 7 columns and 4 rows. I wonder if i could create a "For loop" in the last version of Visilogic (9.8.91)? in C, I would write something like this: This code supposes to find the index of the place which is not '1' ("TRUE"), and give me the indexes 'i', 'j' of that place. I tried to look for a good option at the "Data Tables" tab, and didn't find what I'm looking for. If anyone could give me precise instructions for how to execute a systematic searching, I'll be grateful! Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted January 11, 2022 MVP 2023 Report Share Posted January 11, 2022 Looks like a good application for a State Machine. @Joe Tauserkindly helped us all out here: Link to comment Share on other sites More sharing options...
MVP 2023 kratmel Posted January 12, 2022 MVP 2023 Report Share Posted January 12, 2022 I think for small data table it is possible to use "Vector: Find" function in Visilogic. You can constantly check 4 MI and find position of 7 needed bit value (or place all bit to some MB vector and simulate data table with 28 value). You do not need to use loop - PLC scan loop present. Jump To Lable can be used for simulate "printf" function on PLC display with position of needed bit if function find it. Only one problem in "Vector: Find" - it find first of needed value. If you need to find only one "0" in data table this function maybe useful. Link to comment Share on other sites More sharing options...
AlexUT Posted January 14, 2022 Report Share Posted January 14, 2022 VisiLogic does not support C language, only Ladder diagram. You have to convert your FOR cycle to Ladder logic. *You can realize this Ladder code as subroutine. **Bear in mind that you can process small table search in one scan. If operation is long - you have to split Ladder "FOR" code into number of scans. Ideal is 1 to 10 operations per scan. This will save scan time short. Link to comment Share on other sites More sharing options...
Fernando Castro Posted February 3, 2022 Report Share Posted February 3, 2022 I had pretty much the same need, to do a floor cycle you need a sub routine that will contain all the "loop", first rung should clear the initial value, the use labels and jumps in between conditions, you may need some MIs to index your values but it's doable... tomorrow I can share a screen shoot on how to do it 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