Trigger Method

Description

Invokes the control to read or write the PLC

VB 6.0

[ TRUE | FALSE ] = [ form.] ABCTL. Trigger

VC ++

BOOL ABCTL.Trigger ( void )

VB .NET

Boolean AxABCTL1.Trigger( )

Remarks

Trigger executes the command set by the Function Property .  Trigger will return TRUE if SUCCESS else FALSE. 

Trigger will return FALSE under the following conditions.
a). Ethernet Connections will AWLAYS return FALSE. This is because in Studio 6/0 Ethernet
a). The control Busy Property is TRUE (control is currently servicing another request)
b). The control Enabled Property is FALSE (control has been disabled)

Parameters:
none

VB 6.0 Example

Sub Command1_Click()
  ABCTL1.Adapter = 0        ' * use adapter 1
  ABCTL1.Node = 2            ' * to PLC Node 2
  ABCTL1.Function = 0       ' * read PLC
  ABCTL1.FileAddr = "N7:0"  ' * starting at N7:0
  ABCTL1.Size = 10          ' * for 10 data points
 
ABCTL1.Trigger             ' * tell control to get the data
End Sub

VC ++ Example

void MyCWndClass:: OnBtnClick( void )
{
  m_ABCTL1.SetAdapter(0)        // * use adapter 1
  m_ABCTL1.SetNode("2");        // * to PLC Node 2
  m_ABCTL1.SetFunction(0);      // * read PLC
  m_ABCTL1.SeFileAddr("N7:0");  // * starting at N7:0
  m_ABCTL1.SetSize(10);         // * for 10 data points
 
m_ABCTL1.Trigger();           // * tell control to get the data
End Sub

VB .NET Example

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

AxABCTL1.Adapter = 0 ' * use adapter 0

AxABCTL1.Host = "192.168.1.31" ‘ * PLC IP Address

AxABCTL1.TimeOut = 1000 ‘ * 1000ms timeout

AxABCTL1.Function = 0 ' * read PLC

AxABCTL1.FileAddr = "N7:0" ' * starting at N7:0

AxABCTL1.CtlSize = 10 ' * for 10 data points

AxABCTL1.Trigger() ' * get the data

End Sub

Also See

AutoPoll Method