Reading Axis Error bits

I’m still hazy on how to read particular error bits in my VB.NET code. For instance, if I send a motion command from my GUI and there is say, an Output Saturated error on the Axis. How do I address and read this particular error so that I can display a message box to the user “…Output Saturated Error on the Axis”, etc. ? Is there an easy way to do this? I don’t need to read every possible error combination as I know there can be multiple errors on the Axis at one time. I just want to be able to read and address each one. BTW, this is a pressure Axis.

Thank you

The status bits are DWORDs, so you will need to use the ReadLFile method, something like this:

 Dim dataL() As Integer = New Integer(0) {}

 ' Read the Status register (F8:0) into dataL(0).
 rmc.ReadLFile(FileNumber70.fn70StatusAxis0, 0, dataL, 0, 1)

To pick off an individual bit, you can mask it, something like this:

 If ((dataL(0) And 2 ^ bit) <> 0) Then

The VB example named RMCLinkBasicUI included in the RMCLink samples has some code that does this. The RMCLink examples are accessible from the Windows Start Menu -> All Programs -> RMCLink Component.

Thank you for the example. There is another way to do it too that I am using and thought I would post and share for others. My example uses the BitArray class which I found to be very suited for what we are doing here - picking out the bits that are high and low in the 32-bit integer that is read from the controller.

Dim dataL() As Integer = New Integer(0) {} 'Array element that status will be written to from controller
Dim Errors() As Integer = New Integer(0) {}
Dim errorBits As New BitArray(Errors)

    RMC.ReadLFile(FileNumber150.fn150StatusAxis0, 1, dataL, 0, 1)
Catch ex As Exception
    MessageBox.Show("Unable to read values from the RMC to Diagnostics tab page. " & ex.Message)
End Try

errorBits = New BitArray(dataL)

If errorBits(2) = True Then     'Output saturated
   CheckBox1.Checked = True
Else : CheckBox1.Checked = False
End If

If errorBits(6) = True Then      'No Transducer
   CheckBox2.Checked = True
Else : CheckBox2.Checked = False
End If

If errorBits(7) = True Then       'Transducer Overflow
   CheckBox3.Checked = True
Else : CheckBox3.Checked = False
End If

If errorBits(21) = True Then     'Pressure Following Error
   CheckBox9.Checked = True
Else : CheckBox9.Checked = False
End If


Very nice!