14.08.2013 Views

snap ethernet-based i/o units protocols and programming guide

snap ethernet-based i/o units protocols and programming guide

snap ethernet-based i/o units protocols and programming guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 3: USING THE SNAP ETHERNET I/O DRIVER TOOLKIT<br />

Configure Points<br />

Use the SetPtConfiguration() method to configure points. See “I/O Point Types” on page 19 for<br />

SNAP point type values.<br />

Dim nResult As Long<br />

' Digital In<br />

nResult = gBrain.SetPtConfiguration(0, &H100&, 1, 0, 0, 0, 0)<br />

If (nResult SIOMM_OK) Then<br />

H<strong>and</strong>leError (nResult)<br />

Exit Sub<br />

End If<br />

' Digital Out<br />

nResult = gBrain.SetPtConfiguration(4, &H180&, 0, 0, 0, 0, 0)<br />

If (nResult SIOMM_OK) Then<br />

H<strong>and</strong>leError (nResult)<br />

Exit Sub<br />

End If<br />

' Analog Out (SNAP-AOV25)<br />

nResult = gBrain.SetPtConfiguration(8, &HA5&, 0, 0, 0, 0, 10) ' AOV25<br />

If (nResult SIOMM_OK) Then<br />

H<strong>and</strong>leError (nResult)<br />

Exit Sub<br />

End If<br />

' Analog In (SNAP-AIV)<br />

nResult = gBrain.SetPtConfiguration(12, &H6&, 0, 0, 0, 0, 20) ' AIV<br />

If (nResult SIOMM_OK) Then<br />

H<strong>and</strong>leError (nResult)<br />

Exit Sub<br />

End If<br />

' Update the error display<br />

H<strong>and</strong>leError (nResult)<br />

56 SNAP Ethernet-Based I/O Units Protocols <strong>and</strong> Programming Guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!