create a list and display it based on data from plc

create a list and display it based on data from plc

Need some help, I need to create a list of interlocks and display it on each drive screen. Right now this is done statically where all interlocks are static text boxes on each drive screen and I toggle their visibility by attaching it to a bit in the drives interlock mask/ Problem with this is that when the interlock is not visible, it creates a gap between visible interlocks (not very pleasant looking). So what I’m trying to accomplish so that it loops through drives, loops through interlocks, creates a list of interlocks that apply to that drive and displays them on a screen for that drive… I’ll have to add interlock status and an alarm if the drive is being started with interlock "on", but that’s for later. I need help to point me in the right direction and in terms of accessing values and creating a text boxes and accessing property of the text box in VBA
VBA Code:
Sub Drive_Latch_Interlock() Dim i As Integer 'drive# Dim j As Integer 'interlockBit# Dim k As Integer 'temp_interlock# 'loop for number of drives that is dictated by config in PLC, max 16 drives 'NumDrvLatch is a PVI driver variable For i = 0 To thisProject.Variables.Item("NumDrvLatch").Value - 1 'loop for number of interlocks, max possible number of interlocks is 16 For j = 0 To 15 'if interlock applies (0=applies, 1=not available) for drive i, Drive_Latch_Interlock_Mask[drive#] is a string array from PLC of 16 elements, 'Each array element contains a mask of 16 bits, Drive_Latch_Interlock_Mask[drive#] = jjjj_jjjj_jjjj_jjjj If Not (thisProject.Variables.Item("Drive_Latch_Interlock_Mask.j").Value) Then 'then '1 copy interlock name to a temp list for drive i 'Drive_Latch_Interlock_Text[0] = "Interlock 1" 'Drive_Latch_Interlock_Text[1] = "Interlock 2" '. '. 'Drive_Latch_Interlock_Text[15]= "Interlock 16" thisProject.Variables.Item("Drive_Latch_Interlock_Text_Load[k]").Value = thisProject.Variables.Item("Drive_Latch_Interlock_Text[j]").Value '2 increment position for temp_interlock# k = k + 1 End If 'check for next interlock Next j 'display the temp list of interlocks for drive i on screen_drive_i 'help here as well 'create k number of text boxes with thisProject.Variables.Item("Drive_Latch_Interlock_Text_Load[k]").Value text 'display each k text boxin vertical arrangement 'this is not dynamic, this is created and displayed once on screen open 'reinitilize temp interlock list for next drive k = 0 'check for next drive Next i End Sub
Thanks

This is a migrated post! Originally posted on 01.05.2015 by user mkudin. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com