Unable to read max and min points


#1

I’m putting together an application in vb that uses the Memmap functions. The Opto is an EB1, ENET

On reading a min and max analog value, I’m having trouble.

I’ve got a grid view that is regularly updating and getting the values of the analog inputs, and I have a button that runs this:

[I] Dim intResult, intOffset As Integer
Dim sngValue, msngAnalogMinValue As Single
Dim mBrain As New OptoSnapIoMemMapXLib.OptoSnapIoMemMapX

intOffset = &HF01D4000 + (gclsOpto.ainpSupplyPressure.ModuleNumber * 768) + (gclsOpto.ainpSupplyPressure.ChannelNumber * 12)
intResult = mBrain.ReadFloat(intOffset, sngValue)
msngAnalogMinValue = sngValue

gstrOptoStatus = GetResultAsString(intResult)
AnalogDisplayBox.Text = msngAnalogMinValue.ToString[/I]

The value returns 0 and the intResult gets a -9

Alternatively, I tried avoiding the ReadFloat option in favor of a function made to read min and maxes

[I]Dim intResult, intOffset As Integer
Dim sngValue, GetAnaPtMaxValue As Single
Dim mBrain As New OptoSnapIoMemMapXLib.OptoSnapIoMemMapX
intResult = mBrain.GetAnaPtMaxValue(gclsOpto.ainpSupplyPressure.PointNumber, sngValue)
GetAnaPtMaxValue = sngValue

gstrOptoStatus = GetResultAsString(intResult)
AnalogDisplayBox.Text = GetAnaPtMaxValue.ToString[/I]

Again, 0 value and int result is -9.

The addresses and points are perfect.
anybody got any ideas? I can answer questions, I think. I’m kinda new to both Opto and Vb

Thanks,

Tony


#2

Hi Tony,

Welcome to the OptoForums! I’m hoping you have a copy of form 1465, the OptoMMP Protocol Guide, close by. I’m looking up that error, -9, and see it means: “No successful connection exists to a device via the OptoEnet() or OptoEnet2() methods.”

Looks like you need something like:

[I]intResult = mBrain.OpenEnet(“Your EB1’s IP address here”, 2001, 10000, 1)[/I]

(I’m looking at page 71 in 1465.) But perhaps I’m missing something here? How are you establishing the connection to your EB1?

Don’t forget, product support is FREE! and they’d be happy to help.

Hope that helps.
-OptoMary