Jump to content

"For" logical loop on Visilogic


Recommended Posts

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:

image.thumb.png.1caac60687b47aed6b919e7368a8d24a.png

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

  • MVP 2023

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

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

  • 3 weeks later...

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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.