Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > General Hardware Discussion > Fusion Brain > FB Software


Reply
 
Share Thread Tools Display Modes
Old 02-26-2009, 12:20 PM   #1
Low Bitrate
 
Join Date: Jun 2004
Posts: 98
Iamthehor is on a distinguished road
.dll / VB questions - hardware instances

This code:
Code:
For i = 0 To 1 FoundFBv4 = FusionBrain_WinUSB.MainUSBClass.FindMyDevice(i, 4) If FoundFBv4 Then FBv4 = i holderv4 = True End If FoundFBv3 = FusionBrain_WinUSB.MainUSBClass.FindMyDevice(i, 3) If FoundFBv3 Then FBv3 = i holderv3 = True End If Next

is causing both FBs to be = the same "fusion index" if either is plugged in separately, they're found at i=0 & the program works. If both are plugged in, both the v3 and v4 are found at i=0 and the v4 brain works, but has intermittent outputs set (inputs don't seem to be affected) as the v3 code is evaluated & sent to the same hardware instance as the v4. the v3 brain registers nothing (in or out). Basically, to the .dll, both FBs are at index 0, but the v4 overrides the v3 and process the bitstream (in and out, both v3 and v4 streams).

is there another/better way to distinguish between the 2? Or a way to set the hardware instance? I'm guessing windows reads them as separate device types since one is v3 & one is v4, causing the hardware instance to be 0 on both. Would this happen with 2 v4s? or v3s?

It would be nice to have 20+ outputs for my project, i could get by with 16, but I bought 2 FBs for a reason. (I'm sure i could eventually find a use for another but this project is nearing max budget).
Iamthehor is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 04-04-2009, 09:08 PM   #2
Newbie
 
Join Date: Apr 2009
Posts: 3
BurgersForAll is an unknown quantity at this point
I have a similar question. I'm scoping out a project that would need 4 to six FB's. The MDX software doesn't give me some of the capabilities that I need. Is it possible to recognize multiple FB's with the .vb app?
BurgersForAll is offline   Reply With Quote
Old 04-05-2009, 02:19 PM   #3
Fusion Brain Creator
 
2k1Toaster's Avatar
 
Join Date: Mar 2006
Location: Colorado, but Canadian!
Posts: 8,862
2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future
Quote: Originally Posted by BurgersForAll View Post
I have a similar question. I'm scoping out a project that would need 4 to six FB's. The MDX software doesn't give me some of the capabilities that I need. Is it possible to recognize multiple FB's with the .vb app?

What capabilities?
2k1Toaster is offline   Reply With Quote
Old 04-05-2009, 04:55 PM   #4
Newbie
 
Join Date: Apr 2009
Posts: 3
BurgersForAll is an unknown quantity at this point
Capabilities and expertise. I lack the expertise. I was able to do some simple things with MDX but I'm having trouble getting the logging not to produce huge files. Also I can't time things off the system clock. Couldn't figure out either how to take keyboard input. I am more comfortable programming with VB in that I'm not a programmer.

It may be possible for me to get my app going with MDX but the learning curve maybe too steep.
BurgersForAll is offline   Reply With Quote
Old 04-06-2009, 01:29 PM   #5
Low Bitrate
 
Join Date: Jun 2004
Posts: 98
Iamthehor is on a distinguished road
Quote: Originally Posted by BurgersForAll View Post
Capabilities and expertise. I lack the expertise. I was able to do some simple things with MDX but I'm having trouble getting the logging not to produce huge files. Also I can't time things off the system clock. Couldn't figure out either how to take keyboard input. I am more comfortable programming with VB in that I'm not a programmer.

It may be possible for me to get my app going with MDX but the learning curve maybe too steep.

96 outputs & 78 inputs? have fun wiring.

I'm not sure, but I don't think i would have the same problems with 2+ v4 Brains (I'll probably try it eventually, just haven't ordered another v4 yet). I bought a v3 during the turkey sale last year & a v4 when they were released. The drivers are different & when both are connected, they are listed in separate sections in device manager. I'm pretty sure that's WHY both returned instance 0 from the dll, but i have no clue how to work around it. (need to install C# & check out the dll, but i don't know C# at all). If the .dll could be easily straightened out for v3 & v4 great, otherwise, I'd rather see it further developed for the v4 (if needed for PWM). My guess is the latter makes more sense & I'm more than OK with that. The v4 is a step forward & worth the change IMO.

Quote:
Capabilities and expertise.

I'd add flexibility to that, although MDX is coming along. It's not inflexible but as said, the learning curve is steep. VB can pull info from more places and system time & events were listed (that's on the way in MDX).

2k1 - I don't think MDX is the right software for what I've been using the Brain for. For a carputer where a pretty interface is needed, Yes, but MDX forces me to mess with the graphical side of things & I suck at making things pretty. I hate photoshop, so forcing me to use it turns me off.
The VB .dll can really shine for us "function over form" guys. I have enough trouble poking through the logic programming that screwing up a GUI takes WAY too much trouble shooting. The VB controls are nice'n'easy.
I DO hope you continue developing MDX, however, as i can see some uses down the road. (Home automation)

I like how MDX has come about & the way things have been implemented. My issue is that it's almost another "language" that I (1) don't have time to learn & (2) get frustrated by lack of documentation when I hit a wall. As the function & documentation of MDX increase, so will my use (& your collection of my $).
Iamthehor is offline   Reply With Quote
Old 04-06-2009, 03:09 PM   #6
Fusion Brain Creator
 
2k1Toaster's Avatar
 
Join Date: Mar 2006
Location: Colorado, but Canadian!
Posts: 8,862
2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future
I am actually working on a non-skinnable override command to MDX that will make it look like a standard windows application.

If you have suggestions on features you want implemented in this, let me know.
2k1Toaster is offline   Reply With Quote
Old 04-09-2009, 10:42 AM   #7
Low Bitrate
 
Join Date: Jun 2004
Posts: 98
Iamthehor is on a distinguished road
Any way you could confirm that the .dll works with 2+ v4 brains in the manner it's supposed to? That might save me some frustration later on down the road.

I'm trying to figure out what you mean by "looks like a standard windows program" Would that just be a different skin? Maybe I'm missing somthing in how you're "supposed" to use MDX & the configurator? I'd rather write the logic/code in VB than in XML (that whole language thing I mentioned above). I'm not asking you to reinvent the wheel - VB is easy enough that even I can do it & it works quickly and quietly in the background. Maybe if there was a better guide for the xml portion - theres a ton of VB help on the web. Much easier than bugging you every time i can't figure something out.
I think VB is better for my current applications because I don't really need a user interface, If I did, MDX would be a much better solution. 90% of what I'm using the Brain for is done without the user knowing what is goin on (me, and I wrote the damn thing ), and most of the other visual/interactive 10% isn't completely necessary (but makes it more flexible, I could probably hard code it & do the same things). If i ever get to using the brain for a CarPC or HTPC (both ideas exist, just havent decided to go all out yet - $), I WANT the graphical functionality of MDX (to match backgrounds to the front end(s) used). At that point, I'll force myself to learn the idiosyncrasies that MDX has.
Iamthehor is offline   Reply With Quote
Old 04-27-2009, 07:07 PM   #8
Newbie
 
Join Date: Mar 2009
Posts: 3
jctman is an unknown quantity at this point
VB Followup

Iamthehor,

Did you get your VB code to work with more than one FB. I have the same issue. I am about 20% into my project and have run out of analog inputs. Please let me know if you have had any more sucess. Thanks

Last edited by jctman; 04-28-2009 at 08:00 AM.
jctman is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 04-27-2009, 10:07 PM   #9
Newbie
 
Join Date: Apr 2009
Posts: 3
BurgersForAll is an unknown quantity at this point
I got it to work fine. Below is the code for accessing two brains. It hooks up in the order the fb's are installed. I'm using two v4's. I'll soon order more as my app will need three.



Public Sub FB_SendReceive() 'This sub is called from a Timer_Tick event, which runs at 10Hz.

TemperatureSetPoints()

'----First Fusion Brain (This is a v4 FB)---------------------------------------------------------------------
ByteArray(61) = 2 + KeepAliveBit

For i = 0 To 15 'set the outputs
If DigOut(i) = 0 Then
ByteArray(i * 2) = 0
Else
If DigPWM(i) = 127 Then
ByteArray(i * 2) = DigPWM(i) * 2 + 1
Else
ByteArray(i * 2) = DigPWM(i) * 2
End If
End If

ByteArray(i * 2 + 1) = 1 'Pulse Width Modulation Operation Mode
Next

If FusionBrain_WinUSB.MainUSBClass.SendAndReceiveViaI nterruptTransfers(ByteArray, 0, HardwareVersion) Then
For i = 0 To 12
'The data coming in from the analog inputs is 10 bits long, so it has to come in two bytes.
'The first byte contains 2 bits, which are the most significant bits.
'The second byte contains 8 bits, and they are the least significant bits.

AnalogIn(i) = (CInt(ByteArray(i * 2 + 32)) * 256) + CInt(ByteArray(i * 2 + 33)) 'Uses both bytes 0-1023 (10 bits)
If AnalogIn(i) > 1023 Then AnalogIn(i) = 1023
'Range of 0-1023, so divide by 1023 to get a percent, then multiply by 5 if you want to get volts.
'AnalogIn(i) = (totalin / 1023) * 5
Next
End If

'-------------Second Fusion Brain-------------------------------------------------------------------------------
ByteArray(61) = 2 + KeepAliveBit

For i = 0 To 15 'set the outputs
If DigOut(i + 16) = 0 Then
ByteArray(i * 2) = 0
Else
If DigPWM(i + 16) = 127 Then
ByteArray(i * 2) = DigPWM(i + 16) * 2 + 1
Else
ByteArray(i * 2) = DigPWM(i + 16) * 2
End If
End If

ByteArray(i * 2 + 1) = 1 'Pulse Width Modulation Operation Mode

Next

If FusionBrain_WinUSB.MainUSBClass.SendAndReceiveViaI nterruptTransfers(ByteArray, 1, HardwareVersion) Then

For i = 0 To 12
AnalogIn(i + 13) = (CInt(ByteArray(i * 2 + 32)) * 256) + CInt(ByteArray(i * 2 + 33)) 'Uses both bytes 0-1023 (10 bits)
If AnalogIn(i + 13) > 1023 Then AnalogIn(i + 13) = 1023
Next
End If
BurgersForAll is offline   Reply With Quote
Old 04-30-2009, 11:12 AM   #10
Low Bitrate
 
Join Date: Jun 2004
Posts: 98
Iamthehor is on a distinguished road
I've only tried v3 + v4 with no luck, sounds like burgersforall got it working with 2 v4s & I have no reason to believe that it wouldn't work with my multi-brain code (which was lost in a HD crash ). If someone wants to loan me an extra v4, I'll test & report back, probably won't buy another v4 for a while (unless they go on sale, I'm a sucker).

I think the problem I have is with the way windows & the .dll connect to & "locate" the v3 vs v4 - both list as hardware instance 0 (which is true, just not handled properly by the .dll, which was written before v4 was conceived IIRC)

BFA - since you said before that you will be using 4-6 brains, you might loop your send/receive function with i=hardware instance to make it scale to however many brains you have connected. I think you can use FindAllDevices & get the last instance connected, then you could also redim your DigOut array to match ( (i+1) *16 - 1 ) (all this should be done in the connect function)
Could save you a lot of copying code (I always screw something up when i do that)
Iamthehor is offline   Reply With Quote
Old 04-30-2009, 12:55 PM   #11
Fusion Brain Creator
 
2k1Toaster's Avatar
 
Join Date: Mar 2006
Location: Colorado, but Canadian!
Posts: 8,862
2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future
Quote: Originally Posted by Iamthehor View Post
I've only tried v3 + v4 with no luck, sounds like burgersforall got it working with 2 v4s & I have no reason to believe that it wouldn't work with my multi-brain code (which was lost in a HD crash ). If someone wants to loan me an extra v4, I'll test & report back, probably won't buy another v4 for a while (unless they go on sale, I'm a sucker).

I think the problem I have is with the way windows & the .dll connect to & "locate" the v3 vs v4 - both list as hardware instance 0 (which is true, just not handled properly by the .dll, which was written before v4 was conceived IIRC)

BFA - since you said before that you will be using 4-6 brains, you might loop your send/receive function with i=hardware instance to make it scale to however many brains you have connected. I think you can use FindAllDevices & get the last instance connected, then you could also redim your DigOut array to match ( (i+1) *16 - 1 ) (all this should be done in the connect function)
Could save you a lot of copying code (I always screw something up when i do that)

Just FYI, I will be testing the DLL more with mixed versions, it is on the list. But it probably wont happen until after May 15th or 18th or so. These next few weeks are going to be hell with university, so it has to wait.
2k1Toaster is offline   Reply With Quote
Old 05-07-2009, 10:28 AM   #12
Low Bitrate
 
Join Date: Jun 2004
Posts: 98
Iamthehor is on a distinguished road
Quote: Originally Posted by 2k1Toaster View Post
Just FYI, I will be testing the DLL more with mixed versions, it is on the list. But it probably wont happen until after May 15th or 18th or so. These next few weeks are going to be hell with university, so it has to wait.

Who the hell decided finals week should be on/about Cinco de Mayo?

x64 driver support cause i just nuked my laptop & ordered a new one with vistaX64 (forgot about FB compatibility until after i placed the order) If I can help, I will. Never worked with drivers though & you've probably noticed I'm not a programmer.

I still have a cheapie x86 laptop (with no $!&#%^ screen) that i can use to test (and I use remote desktop to control anyway), but it would be nice if the drivers wire x64 before too long. I'm not sure this POS`(using it now) has enough juice to run MDX or VB2k8, it barely handle firefox & Outlook.
Iamthehor is offline   Reply With Quote
Old 06-15-2009, 02:37 AM   #13
Fusion Brain Creator
 
2k1Toaster's Avatar
 
Join Date: Mar 2006
Location: Colorado, but Canadian!
Posts: 8,862
2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future2k1Toaster has a brilliant future
Found the bug in the software/driver.

I can hook up V3's and V4's no problem, in any order and amount and it will work now. I had an index variable referencing the wrong version in a few places thanks to copy/paste, so it would try to configure the nth FB instance as the same version as the 0th. So before N of the same version would work, but mixed required luck. Now it is all fixed. It will be in the next release.
2k1Toaster is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A few hardware questions for the experienced CARpcErs nadroj81 General Hardware Discussion 0 04-15-2004 08:53 PM
First post, some hardware questions (check these out) Leitnin General Hardware Discussion 0 04-06-2004 02:34 PM
A few VB questions veedubya Software & Software Development 3 12-31-2002 12:48 PM
Hardware Questions snafu83 General Hardware Discussion 2 05-21-2002 03:59 AM
Hardware Questions MP3runner General Hardware Discussion 6 07-24-2001 11:33 AM



All times are GMT -5. The time now is 04:26 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics