On the Controller, there are numerous Outputs that control things like Vacuum relays. Rather than use the standard OUTPUT# options in Port and Pins, these Outputs are switched on and off by using a button on the screen which executes standard basic code. eg, to switch on output 1 on the controller I code:
SetCsmioOut (90, 1)
However, because this output is not represented in Ports/Pins I can't just select that OUTPUT# in the list of options for the LED. Hence the need for a different approach.
I think it should be easy. I already do a similar thing for Input LED indicators using the following code:
====================================================================
Private ind As Integer
Sub Main
For ind = 0 To 31
If GetCsmioIn(ind) Then
SetUserLed((1100 + ind), 1)
Else
SetUserLed((1100 + ind), 0)
End If
Next ind
If ind > 31 Then
ind = 0
End If
End Sub
'------------------------------------------------------------------------------------------------------------
'CSMIO/IP-S/A in
Public Function GetCsmioIn (n As Integer) As Boolean
Dim reg As Integer
Dim tmp As Integer
tmp = n
If(tmp < 16) Then
reg = 90
Else
reg = 91
tmp = tmp - 16
End If
If(GetInBit(reg, tmp)) Then
GetCsmioIn = true
Else
GetCsmioIn = false
End If
Exit Function
End Function
=========================================================================
However, I don't think there is a comparable statement of GetCsmioIn for Outputs, ie GetCsmioOut?
Many thanks
Mark