DeltaV OPC Data Access Server functional overview > Barcode tutorial

Write back to the DeltaV system

The last step in the application is to write the actual data back to the DeltaV system and allow the MIXTANKS SFC to continue.

  1. Add the following code to the sub cmdUpdateDV_Click on the frmMain form:
    UpdateDeltaV
    cmdUpdateDV.Enabled = False
    txtIngNumber = ""
    txtAmount = ""
  2. To Barcode module, add the following procedure:
    Public Sub UpdateDeltaV()
        Dim rtn As Integer
        
        On Error GoTo ErrorHandler
        
        'Send actual ingredient and amount to the DeltaV System
        If gStep <> DRYADD_STEP Then
            MsgBox "Wait for the step DRY_ADD"
            Exit Sub
        End If
        
        If gActualIngredient <> "" Then
            rtn = gOpcServer.SetItemValue("IngredientInfo", 
            gActualIngHandle, gActualIngredient)
        Else
            Exit Sub
        End If
        
        If gActualAmt <> 0 Then
            rtn = gOpcServer.SetItemValue("IngredientInfo", gActualAmtHandle, 
            gActualAmt)
        Else
            Exit Sub
        End If
        
        'Set the Done flag to allow the SFC to continue
        rtn = gOpcServer.SetItemValue("IngredientInfo", gDoneHandle, 1)
        
        Exit Sub
        
    ErrorHandler:
        MsgBox "UpdateDeltaV: Error!" & vbCrLf _
               & "Err.Number = " & Err.Number & vbCrLf _
               & "Err.Description = " & Err.Description & vbCrLf _
               & "Err.Source = " & Err.Source & vbCrLf
    End Sub