Sponsored links

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


Reply
 
Share Thread Tools Display Modes
Old 04-17-2009, 08:58 AM   #1
Newbie
 
Join Date: Oct 2008
Posts: 11
finnj6 is an unknown quantity at this point
Interpreting values

Hi I was wondering if you could explain whats happening in this piece of code please. I'v tried to figure it out as best as I can but still have some problems especially with the scaling_reF variable. I can't find what MainMDX.AllAnalogueInputs[accurate_index].CurrentValue; is in the source code.

Code:
case MainMDX.BrainVersion.Version_04: { digital_value = (int)(input_byte1 * 256) + (int)input_byte2; } break; } double scaling_reF = 5.0; if (accurate_index >= 0 && accurate_index < MainMDX.AllAnalogueInputs.Count) { scaling_reF = MainMDX.AllAnalogueInputs[accurate_index].CurrentValue; if (scaling_reF == 0) { scaling_reF = 5.0; } } double reF = ((double)digital_value / 1023.0f) * scaling_reF; return reF; }

Thanks
Jeff
finnj6 is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 04-18-2009, 12:06 AM   #2
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
It is an old piece of code that can be fully deleted.

Basically it was for taking a value off of an analogue input, and using that for the reference voltage to do the digital to analogue conversion with instead of just blindly assuming it was 5v.

Since the voltage regulator on the brain will put out slightly less voltage when hot, it was thought of in a hurry to mabe compensate for that. However we shortly (within hours) realized we were being stupid as the reference voltage would be compared off of the same bad regulator voltage! duh... So it is still in there because... I just havent taken it out.
2k1Toaster is offline   Reply With Quote
Old 04-18-2009, 08:41 AM   #3
Newbie
 
Join Date: Oct 2008
Posts: 11
finnj6 is an unknown quantity at this point
New Question then

Ok so that explains that, my next question is what are the bytes being put into the byte array by SendAndReceiveViaInterruptTransfers, and why is the low byte alyaws 0 for me.

Are they bytes from the ADC or someting else?

I am using the temperature sensor to try and figure out the meaning of the values returned to me but no joy so far.

I know that 10mv = 1 degree celsius, that 0 = -40 degrees celsius and 400 = 0 degrees celsius but in a room that is quite comfortable around 23 degrees celcius to sit in im getting 232 returned as the value which if divided by 10 is the right temperature.

Jeff
finnj6 is offline   Reply With Quote
Old 04-18-2009, 03:45 PM   #4
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
it returns voltage. That's it. All analogue inputs are voltage only. If you attach a temperature sensor or photosensor, it doesnt care, it just returns the voltage.

Whatever is returned is the digital value read in. It is 10bit, and 5v reference. Hence the 5 * (value/1023) to get the raw voltage.

Then you send that through an equation to get whatever the sensor is. That is the point of the whole logic section.
2k1Toaster is offline   Reply With Quote
Old 04-19-2009, 11:12 AM   #5
Newbie
 
Join Date: Oct 2008
Posts: 11
finnj6 is an unknown quantity at this point
Thanks that was what I was hoping for I just wanted to make sure before I made any wrong assumptions.
finnj6 is offline   Reply With Quote
Old 04-19-2009, 11:36 AM   #6
North of the land of Hey Huns
 
malcom2073's Avatar
 
Join Date: Jun 2004
Location: Westminster, MD
Posts: 1,038
malcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to all
Edit: nevermind
__________________
RevFE - Try it, you just might like it.
Carbon - Next Generation Touchscreen Browser
Come join us on IRC: irc.efnet.net #mp3car
Audiophiles make me chuckle as they pad my wallet.
malcom2073 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
Question about creating registry values in an installer. Maheriano Off Topic 1 12-10-2008 03:36 PM
Fluctuating Input Values thwack Fusion Brain 4 09-22-2008 09:32 PM
Thermometer values WAY too low. Maybe displaying voltages? Sonicxtacy02 Fusion Brain 8 03-27-2008 08:13 PM
WinAMP Preset Values in .PST File Tissy Road Runner 2 01-09-2007 07:00 PM
Anyone knows how can I convert the mileage to digital values? e1fnd Software & Software Development 22 06-18-2003 12:35 PM



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