yander
06-08-2007, 03:11 PM
I see a similar question has been asked in the past but I didn't see any answers that would help me with this. I have a plug in I wrote for comet in VB for some hardware I made that works correctly. I would like to make my hardware work with vixen. Can someone help me write this plug in, I am not a great programmer and it took me a while to learn the necessary VB to make my comet plug in work. I need to get this working soon as it is for the 4th of July, and I need time to test this and set up the sequence as well. I am providing the dll code that works with comet to control my boxes along with a brief description of my box protocol. Perhaps someone who is familiar with vixen can cut paste and modify my code to make a working vixen plug in.
Thanks in advance
The boxes have 16 outputs, to control the boxes you send the box number and the hex code for the status of lights 1-8 and then 8-16. If you want to turn on light one on box one you send "ONEE(01)(00)" all lights on
box three would be "THRE(FF)(FF)" and so on.
Below is the source code for the plug in for comet that works with my hardware. It was hacked together from a parallel plug in from comet so it looks a little messy but it works.
Private mvarName As String
Private mvarAbout As String
Private mvarMaxChannels As Integer
Private mvarPluginData As String
Private mvarPluginDataHelp As String
Private mvarGridData() ' used by the preCache and
FastRender methods
Private mvarVersion As String
Dim outONEE As String
Dim outTWOO As String
Dim outTHRE As String
Dim outFOUR As String
Dim outFIVE As String
Dim outSIXX As String
Dim outSEVE As String
Dim outEIGH As String
Dim oldONEE As String
Dim oldTWOO As String
Dim oldTHRE As String
Dim oldFOUR As String
Dim oldFIVE As String
Dim oldSIXX As String
Dim oldSEVE As String
Dim oldEIGH As String
'oldONEE = ""
'oldTWOO = ""
'oldTHRE = ""
' plugin specific variables
Private mvarDataPort As Integer
Private mvarControlPort As Integer
' New 0.8.7 plugin property
Public Property Get Version() As String
Version = mvarVersion
End Property
Public Property Get Name() As String
Name = mvarName
End Property
Public Property Get About() As String
About = mvarAbout
End Property
Public Property Get MaxChannels() As Integer
MaxChannels = mvarMaxChannels
End Property
Public Property Get PluginDataHelp() As String
PluginDataHelp = mvarPluginDataHelp
End Property
Public Property Get PluginData() As String
PluginData = mvarPluginData
End Property
Public Property Let PluginData(ByVal vData As String)
' plugin specific implementation
' vData= <data>,<other>
mvarDataPort = mBases.ConvertBase(vData,
ebHexadecimal, ebDecimal)
mvarControlPort = mvarDataPort + 2
mvarPluginData = vData
End Property
Public Sub Class_Initialize()
' init
mvarVersion = "2.0"
mvarName = "PIC Serial Port"
mvarAbout = "DF Basic serial Port controller -
Version " & mvarVersion
mvarMaxChannels = 128
' plugin specific data defaults
Me.PluginData = "378"
mvarPluginDataHelp = "jjhSpecify the LPT Port
address in hexadecimal (ie. 3BC or 378)"
End Sub
Public Sub Class_Terminate()
' terminate
End Sub
' New plugin architecture!
Public Sub preCache(vData As Variant)
mvarGridData = vData
End Sub
' New plugin architecture!
Public Sub fastRender(Interval As Integer)
Dim msComm As Object
Set msComm = CreateObject("MSCOMMLIB.MSCOMM")
' msComm.PortOpen = False
' MsgBox (mvarGridData(1, Interval))
' Use COM1
msComm.CommPort = 1
' 2400 baud, no parity, 8 data bits, 1 stop bit
msComm.Settings = "2400,N,8,1"
' Disable DTR
msComm.DTREnable = False
' Open the port
msComm.PortOpen = True
outONEE = ("ONEE") & Chr$(mvarGridData(1,Interval)) & Chr$(mvarGridData(2, Interval))
outTWOO = ("TWOO") & Chr$(mvarGridData(3,Interval)) & Chr$(mvarGridData(4, Interval))
outTHRE = ("THRE") & Chr$(mvarGridData(5,Interval)) & Chr$(mvarGridData(6, Interval))
outFOUR = ("FOUR") & Chr$(mvarGridData(7,Interval)) & Chr$(mvarGridData(8, Interval))
outFIVE = ("FIVE") & Chr$(mvarGridData(9,Interval)) & Chr$(mvarGridData(10, Interval))
outSIXX = ("SIXX") & Chr$(mvarGridData(11,Interval)) & Chr$(mvarGridData(12, Interval))
outSEVE = ("SEVE") & Chr$(mvarGridData(13,Interval)) & Chr$(mvarGridData(14, Interval))
outEIGH = ("EIGH") & Chr$(mvarGridData(15,Interval)) & Chr$(mvarGridData(16, Interval))
If Not (oldONEE = outONEE) Then msComm.Output =outONEE
If Not (oldTWOO = outTWOO) Then msComm.Output =outTWOO
If Not (oldTHRE = outTHRE) Then msComm.Output =outTHRE
If Not (oldFOUR = outFOUR) Then msComm.Output =outFOUR
If Not (oldFIVE = outFIVE) Then msComm.Output =outFIVE
If Not (oldSIXX = outSIXX) Then msComm.Output =outSIXX
If Not (oldSEVE = outSEVE) Then msComm.Output =outSEVE
If Not (oldEIGH = outEIGH) Then msComm.Output =outEIGH
oldONEE = outONEE
oldTWOO = outTWOO
oldTHRE = outTHRE
oldFOUR = outFOUR
oldFIVE = outFIVE
oldSIXX = outSIXX
oldSEVE = outSEVE
oldEIGH = outEIGH
msComm.PortOpen = False
End Sub
Public Sub clear()
End Sub
Thanks in advance
The boxes have 16 outputs, to control the boxes you send the box number and the hex code for the status of lights 1-8 and then 8-16. If you want to turn on light one on box one you send "ONEE(01)(00)" all lights on
box three would be "THRE(FF)(FF)" and so on.
Below is the source code for the plug in for comet that works with my hardware. It was hacked together from a parallel plug in from comet so it looks a little messy but it works.
Private mvarName As String
Private mvarAbout As String
Private mvarMaxChannels As Integer
Private mvarPluginData As String
Private mvarPluginDataHelp As String
Private mvarGridData() ' used by the preCache and
FastRender methods
Private mvarVersion As String
Dim outONEE As String
Dim outTWOO As String
Dim outTHRE As String
Dim outFOUR As String
Dim outFIVE As String
Dim outSIXX As String
Dim outSEVE As String
Dim outEIGH As String
Dim oldONEE As String
Dim oldTWOO As String
Dim oldTHRE As String
Dim oldFOUR As String
Dim oldFIVE As String
Dim oldSIXX As String
Dim oldSEVE As String
Dim oldEIGH As String
'oldONEE = ""
'oldTWOO = ""
'oldTHRE = ""
' plugin specific variables
Private mvarDataPort As Integer
Private mvarControlPort As Integer
' New 0.8.7 plugin property
Public Property Get Version() As String
Version = mvarVersion
End Property
Public Property Get Name() As String
Name = mvarName
End Property
Public Property Get About() As String
About = mvarAbout
End Property
Public Property Get MaxChannels() As Integer
MaxChannels = mvarMaxChannels
End Property
Public Property Get PluginDataHelp() As String
PluginDataHelp = mvarPluginDataHelp
End Property
Public Property Get PluginData() As String
PluginData = mvarPluginData
End Property
Public Property Let PluginData(ByVal vData As String)
' plugin specific implementation
' vData= <data>,<other>
mvarDataPort = mBases.ConvertBase(vData,
ebHexadecimal, ebDecimal)
mvarControlPort = mvarDataPort + 2
mvarPluginData = vData
End Property
Public Sub Class_Initialize()
' init
mvarVersion = "2.0"
mvarName = "PIC Serial Port"
mvarAbout = "DF Basic serial Port controller -
Version " & mvarVersion
mvarMaxChannels = 128
' plugin specific data defaults
Me.PluginData = "378"
mvarPluginDataHelp = "jjhSpecify the LPT Port
address in hexadecimal (ie. 3BC or 378)"
End Sub
Public Sub Class_Terminate()
' terminate
End Sub
' New plugin architecture!
Public Sub preCache(vData As Variant)
mvarGridData = vData
End Sub
' New plugin architecture!
Public Sub fastRender(Interval As Integer)
Dim msComm As Object
Set msComm = CreateObject("MSCOMMLIB.MSCOMM")
' msComm.PortOpen = False
' MsgBox (mvarGridData(1, Interval))
' Use COM1
msComm.CommPort = 1
' 2400 baud, no parity, 8 data bits, 1 stop bit
msComm.Settings = "2400,N,8,1"
' Disable DTR
msComm.DTREnable = False
' Open the port
msComm.PortOpen = True
outONEE = ("ONEE") & Chr$(mvarGridData(1,Interval)) & Chr$(mvarGridData(2, Interval))
outTWOO = ("TWOO") & Chr$(mvarGridData(3,Interval)) & Chr$(mvarGridData(4, Interval))
outTHRE = ("THRE") & Chr$(mvarGridData(5,Interval)) & Chr$(mvarGridData(6, Interval))
outFOUR = ("FOUR") & Chr$(mvarGridData(7,Interval)) & Chr$(mvarGridData(8, Interval))
outFIVE = ("FIVE") & Chr$(mvarGridData(9,Interval)) & Chr$(mvarGridData(10, Interval))
outSIXX = ("SIXX") & Chr$(mvarGridData(11,Interval)) & Chr$(mvarGridData(12, Interval))
outSEVE = ("SEVE") & Chr$(mvarGridData(13,Interval)) & Chr$(mvarGridData(14, Interval))
outEIGH = ("EIGH") & Chr$(mvarGridData(15,Interval)) & Chr$(mvarGridData(16, Interval))
If Not (oldONEE = outONEE) Then msComm.Output =outONEE
If Not (oldTWOO = outTWOO) Then msComm.Output =outTWOO
If Not (oldTHRE = outTHRE) Then msComm.Output =outTHRE
If Not (oldFOUR = outFOUR) Then msComm.Output =outFOUR
If Not (oldFIVE = outFIVE) Then msComm.Output =outFIVE
If Not (oldSIXX = outSIXX) Then msComm.Output =outSIXX
If Not (oldSEVE = outSEVE) Then msComm.Output =outSEVE
If Not (oldEIGH = outEIGH) Then msComm.Output =outEIGH
oldONEE = outONEE
oldTWOO = outTWOO
oldTHRE = outTHRE
oldFOUR = outFOUR
oldFIVE = outFIVE
oldSIXX = outSIXX
oldSEVE = outSEVE
oldEIGH = outEIGH
msComm.PortOpen = False
End Sub
Public Sub clear()
End Sub