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

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

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