Page 2 of 8 FirstFirst 12345678 LastLast
Results 11 to 20 of 76

Thread: Sdk?

  1. #11
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    9,851

    Low Level Interface Protocol

    Ok, the credit goes to Brain Wendt who was kind enough last July to ask me all sorts of questions and compile this excellent document on the low level protocol. I think he is planning something big with his own software so he has been in the dark recently, but thank him for this
    Attached Files Attached Files
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  2. #12
    Newbie
    Join Date
    Aug 2007
    Posts
    6

    Thumbs up

    Thank you -- that is EXACTLY what I was looking for

  3. #13
    Constant Bitrate mx270a's Avatar
    Join Date
    Aug 2003
    Location
    Iowa
    Posts
    167
    I'd like to access the fusion brain directly from a program I'm developing in Visual Basic 2008 Express. I've found that VB doesn't like the FusionUSB.dll file. If I try to add it as a reference, I get an error that it can't be added saying to make sure that it is "a valid assembly or COM component". Do you have any ideas what I have for options to make this work. Thanks.

  4. #14
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    9,851
    Dont add it as a reference. Just call it.

    Here is the sample code for all calls to the dll incase you dont have it:

    Code:
                [System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
                public static extern bool FUSB_Initialize(ref UInt32 pFusionUSB, String deviceID, UInt32 instanceNumber);
    
                [System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
                public static extern bool FUSB_Receive(UInt32 pFusionUSB, byte[] buffer);
    
                [System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
                public static extern bool FUSB_Send(UInt32 pFusionUSB, byte[] buffer);
    
                [System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
                public static extern UInt32 FUSB_Free(ref UInt32 pFusionUSB);
    
                [System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
                public static extern bool FUSB_printf(UInt32 pFusionUSB);
    
                [System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
                public static extern UInt32 FUSB_GetWinUSBerror(UInt32 pFusionUSB);
    
                [System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
                public static extern UInt32 FUSB_GetFUSBstatus(UInt32 pFusionUSB);
    
                [System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
                public static extern String FUSB_GetDeviceInstanceID(UInt32 pFusionUSB);
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  5. #15
    Constant Bitrate mx270a's Avatar
    Join Date
    Aug 2003
    Location
    Iowa
    Posts
    167
    Thanks for the speedy reply. I converted the code you posted to VB. For future reference for anyone else, here is what that looks like:

    Code:
    Public Class UCSettingsIO
        <System.Runtime.InteropServices.DllImport("FusionUSB.dll")> _
        Public Shared Function FUSB_Initialize(ByRef pFusionUSB As UInt32, ByVal deviceID As String, ByVal instanceNumber As UInt32) As Boolean
        End Function
    
        <System.Runtime.InteropServices.DllImport("FusionUSB.dll")> _
        Public Shared Function FUSB_Receive(ByVal pFusionUSB As UInt32, ByVal buffer As Byte()) As Boolean
        End Function
    
        <System.Runtime.InteropServices.DllImport("FusionUSB.dll")> _
        Public Shared Function FUSB_Send(ByVal pFusionUSB As UInt32, ByVal buffer As Byte()) As Boolean
        End Function
    
        <System.Runtime.InteropServices.DllImport("FusionUSB.dll")> _
        Public Shared Function FUSB_Free(ByRef pFusionUSB As UInt32) As UInt32
        End Function
    
        <System.Runtime.InteropServices.DllImport("FusionUSB.dll")> _
        Public Shared Function FUSB_printf(ByVal pFusionUSB As UInt32) As Boolean
        End Function
    
        <System.Runtime.InteropServices.DllImport("FusionUSB.dll")> _
        Public Shared Function FUSB_GetWinUSBerror(ByVal pFusionUSB As UInt32) As UInt32
        End Function
    
        <System.Runtime.InteropServices.DllImport("FusionUSB.dll")> _
        Public Shared Function FUSB_GetFUSBstatus(ByVal pFusionUSB As UInt32) As UInt32
        End Function
    
        <System.Runtime.InteropServices.DllImport("FusionUSB.dll")> _
        Public Shared Function FUSB_GetDeviceInstanceID(ByVal pFusionUSB As UInt32) As String
        End Function
    
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim thefbinstid As String = FUSB_GetDeviceInstanceID(0)
            MsgBox(thefbinstid)
        End Sub
    End Class
    The functions look self explanatory as to what they do. The word document you put in reply # 11 explains the data stream to and from the FB. I am confused about the FUSB_GetDeviceInstanceID funtion though. When I run the above code, I get a message box saying "NULL", even with the FB is on. I presume this should be giving me the string I'll need to initialize the device with the FUSB_Initialize function.

  6. #16
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    9,851
    if you bass in a pointer, as well as an UInt, it should give you the id of the Brain at instance number UInt#.

    I actually dont use it. It was more for testing.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  7. #17
    Constant Bitrate mx270a's Avatar
    Join Date
    Aug 2003
    Location
    Iowa
    Posts
    167
    I'm confused. That function only has one argument, so how do I pass both a pointer and the UInt to it?

  8. #18
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    9,851
    Oh, I am sorry. I was thinking of the wrong function.

    Yes it returns a string which you pass into Initialize. The UInt you put in would be 0 for Brain #1 and 1 for Brain #2 and so on.

    There is an old dll call that took in a pointer and it called the initialize automatically but was too hard to debug so it changed.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  9. #19
    Constant Bitrate mx270a's Avatar
    Join Date
    Aug 2003
    Location
    Iowa
    Posts
    167
    For now, I skipped the FUSB_GetDeviceInstanceID function since I do know the ID. I'm trying to make the software turn digital output #0 on and off. I have a form with 3 buttons. One initializes the FB, one sets digout0 to "1" and the other sets digout0 to "0". I have a timer running at 10Hz on another form that is calling the SendDataToFusionBrain() subroutine. Here's my code, excluding the code you previously posted that calls the DLL.

    Code:
    Private TimeForShutoff As String = "000000"
        Private KeepAliveBit As String
        Private DigOut0 As String
        Private OutputArray(64) As Byte
    
        Private Sub InitFB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InitFB.Click
            Dim thefbinstid As String = "USB\VID_04D8&PID_000C\4&338F3FFA&0&1"
            If FUSB_Initialize(0, thefbinstid, 0) Then
                MsgBox("Fusion Brain was initialized.")
                MainForm.SteeringControlEnabled = True
            Else
                MsgBox("Failed to initialize that Fusion Brain. Make sure it is connected and that you are specifying the correct USB ID number.")
            End If
    
            For i = 0 To 63
                OutputArray(i) = CByte("00000000")
            Next
    
            KeepAliveBit = "1"
            DigOut0 = "1"
        End Sub
    
        Private Sub Turn0on_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Turn0on.Click
            DigOut0 = "1"
        End Sub
    
        Private Sub Turn0off_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Turn0off.Click
            DigOut0 = "0"
        End Sub
    
        Public Sub SendDataToFusionBrain()
            OutputArray(0) = CByte(TimeForShutoff & KeepAliveBit & DigOut0)
            OutputArray(1) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(2) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(3) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(4) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(5) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(6) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(7) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(8) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(9) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(10) = CByte(TimeForShutoff & KeepAliveBit & "0")
            OutputArray(11) = CByte(TimeForShutoff & KeepAliveBit & "0")
            FUSB_Send(0, OutputArray)
    
            'Reset the keepalive bit for nexttime.
            If KeepAliveBit = "0" Then
                KeepAliveBit = "1"
            Else
                KeepAliveBit = "0"
            End If
        End Sub
    I am unable to get Digital Output #0 to turn on or off.
    If I run FUSB_GetFUSBstatus(0), it returns 1
    If I run FUSB_Free(0) returns 50, it returns 50

    I have downloaded your source code for the fusion control centre, and I'm looking at it in VS C# Express, but I'm unable to find anything that I'm missing to make it simply turn one output on and off. Any ideas?

  10. #20
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    9,851
    The flip flop bit of the output has to go between 1 and 0 every transmission. Also byte number 61 must be all 255.

    And you cannot skip Initialize. It has to create a File Handle, if it doesnt nothing will work. If you get 50 back from Free, that means there was nothing to free, so nothing was initialized, so nothing will work.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

Page 2 of 8 FirstFirst 12345678 LastLast

Similar Threads

  1. iGuidance SDK
    By Quattro in forum GPS
    Replies: 57
    Last Post: 06-23-2006, 08:37 AM
  2. SDK commands over the serial port ????
    By tolisn in forum Road Runner
    Replies: 4
    Last Post: 12-14-2005, 01:03 PM
  3. Developing Touchscreen SDK -- need feedback!
    By kevlar in forum Software & Software Development
    Replies: 3
    Last Post: 07-14-2005, 06:55 PM
  4. Replies: 9
    Last Post: 03-31-2005, 03:40 AM
  5. Destinator 3 SDK features working
    By loscooby in forum GPS
    Replies: 4
    Last Post: 09-21-2004, 01:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •