beautypg.com

Sensoray 518 User Manual

Page 36

background image

35

EXAMPLE:

‘ Channel 2 is connected to a linear slide potentiometer. It is
‘ necessary to measure the potentiometer’s position as a function
‘ of resistance. A good approximation to the potentiometer’s
‘ transfer function is determined to be:

‘ f(R) = 0 * (R ^ 2) + 0.01 * (R) + 0. |

‘ The following code segment will set up channel 2 (assumed to have
‘ previously been declared as a “User-defined Resistive Sensor”) for
‘ linearizing the potentiometer’s measured resistance value:

CALL Send518Byte (192 + 2) ‘ send command & opcode to 518
CALL Send518Real (0) ‘ send A coefficient to 518
CALL Send518Real (.01) ‘ send B coefficient to 518
CALL Send518Real (.1) ‘ send C coefficient to 518