|
 |
|
07-29-2008, 10:08 AM
|
#1
|
|
Newbie
Join Date: Jul 2008
Posts: 7
|
Are the Digital Inputs Active?
I'm a newbie to the Fusion Brain and have just received it and have got it working. I've not be able to get a reading from the Digital Inputs yet.
I've connected a switch across the two pins on one of the 4 Digital input ports and didn't see a change in byte 32 on the receive message (I'm using vb2008 to read the data via the FusionUSB.dll) Then I watched the entire 64byte message block and didn't see any bytes changing as I switched on and off.
My specific question is: Are these 4 ports active on my build of the board (the latest I assume since I just received it this week). If so, what might I be doing wrong?
|
|
|
|
|
|
Advertisement
|
Sponsored links
|
07-30-2008, 03:44 PM
|
#2
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
I abandoned the digital input ports in the VB code since it sounds like they will be going away in the next hardware release. The analog inputs can read a digital signal, so unless you run out of analog inputs, it shouldn't be a problem.
As I recall, all 4 digital inputs are bits in one byte. What I noticed is that the digital inputs don't fall back to 0 right away when you disconnect them. So if you're using a normally-open push-button switch, it will go high as soon as you push the button, but it takes a while for it to go low when you let go of the button. The card has to drain off the voltage before it resets back to low. If you were driving it with something that can provide either 5volts or ground, it should work quite well.
-Lance
|
|
|
07-30-2008, 04:50 PM
|
#3
|
|
Fusion Brain Creator
Join Date: Mar 2006
Location: Colorado, but Canadian!
Posts: 8,862
|
They will be going away in the next hardware release, that is true.
And also they do hold a voltage unless you put a drain on it.
They are active on your board, and Tim tests all of them, so they should work. Probably just saturated with voltage if using a simple button on it.
|
|
|
07-30-2008, 07:59 PM
|
#4
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
yeah you need to pull it low with a resistor.
its something we overlooked when we designed the board.
|
|
|
07-31-2008, 12:14 AM
|
#5
|
|
Newbie
Join Date: Jul 2008
Posts: 7
|
Thanks for the info, it'll save me from wasting time... I'll try the pull down R. as well.
I agree that valuable hw resources would be better applied to 4 additional analog ports, since they can also serve the same purpose as digital ports but not vice-versa.
My only additional thought is that it's such a pain to debounce a switch at the high-level, it's so much more accurate and responsive at the low level.
An elegant solution might be for the FB to provide a "shadow" debounced digital value for all analog ports on the bits in byte 32? That way if we're hooking up a button or switch to any analog port the high-level software can choose to look in 32 and get a nice clean firmware debounced 1/0, but if we want analog we look in the analog bytes. Might there be cpu cycles available for that bit of extra math?
|
|
|
07-31-2008, 03:16 PM
|
#6
|
|
Newbie
Join Date: Jul 2007
Posts: 39
|
How do I add the Digital Input using the Configurator? Or if you can just post the xml I can add it.
I am using a magnetic alarm contact that I just want to know if it's open or closed. Where and what value resistor should I use?
|
|
|
07-31-2008, 11:10 PM
|
#7
|
|
Fusion Brain Creator
Join Date: Mar 2006
Location: Colorado, but Canadian!
Posts: 8,862
|
Using the configurator, you cant.
xml:
Code:
<iochannel id="ChannelID" port="0" brain="MyBrain" type="digital_input"></iochannel>
You will notice that it is the exact same syntax as the other channels. Only difference is the type.
|
|
|
08-01-2008, 11:01 AM
|
#8
|
|
Newbie
Join Date: Jul 2007
Posts: 39
|
Thanks, that's great.
However, once you add that manually, when you open the xml in the Configurator and save it again, all that work is lost. Can you fix the Configurator to ignore that so it doesn't remove it?
|
|
|
|
Sponsored links
|
|
Advertisement
|
|
08-01-2008, 04:49 PM
|
#9
|
|
Fusion Brain Creator
Join Date: Mar 2006
Location: Colorado, but Canadian!
Posts: 8,862
|
Quote: Originally Posted by ginigma 
Thanks, that's great.
However, once you add that manually, when you open the xml in the Configurator and save it again, all that work is lost. Can you fix the Configurator to ignore that so it doesn't remove it?
Yes the configurator throws out what it doesn't understand. The way that I have designed the configurator, it wont accept it without major changes. The program rebuilds the xml file from scratch every time you do anything. I can try and make some sort of ignore area, but the problem comes that if you place that line of code for the digital input anywhere else than the i/o section, it doesnt mean anything. So it cant just ignore something, it has to know what it is and where to put it.
Last edited by 2k1Toaster; 08-01-2008 at 04:57 PM.
|
|
|
08-01-2008, 04:54 PM
|
#10
|
|
FLAC
Join Date: Oct 2006
Location: Las Vegas
Posts: 1,283
|
I guess that leaves one good answer...
|
|
|
08-20-2008, 10:54 AM
|
#11
|
|
Low Bitrate
Join Date: Dec 2007
Posts: 105
|
I have a question then. Can the firmware be re-written to use the digital inputs as analog. I need two more inputs and was planning on using the digitals.
|
|
|
08-20-2008, 12:38 PM
|
#12
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
Quote: Originally Posted by RonS 
I have a question then. Can the firmware be re-written to use the digital inputs as analog. I need two more inputs and was planning on using the digitals.
No, it's a limitation of the board, if I remember correctly. The board can only handle 13 analog inputs, and only on certain pins. I'll check when I get home.
|
|
|
08-21-2008, 07:30 AM
|
#13
|
|
Low Bitrate
Join Date: Dec 2007
Posts: 105
|
Ok thanks. I am going to get one of the new ones when they come out anyway. For right now I can do without the air fuel.
|
|
|
08-21-2008, 05:57 PM
|
#14
|
|
Maximum Bitrate
Join Date: Oct 2007
Location: Auckland
Posts: 558
|
so to use them..
what size resistor would you suggest if you wanted to use a switch?
also i guess you will need to have the digital inputs code somewhere else and copy / paste it back into the .xml file each time you open the config and change anything?
as a thought could you treat them like a plugin or 3rd party item and refere to a 2nd .xml file just for the digital inputs
Last edited by Woofnstuff; 08-21-2008 at 08:09 PM.
|
|
|
08-21-2008, 08:05 PM
|
#15
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
I think you can get away with a very high resistance, as you're just pulling the line to a voltage, and there shouldn't be any load on that line. I'd guess a 100K ohm resistor would be sufficient. I think you want to pull the sensed line to ground with that resistor, then put a switch between the sensed line and +5v. That way the input is normally grounded unless you press the switch, which pulls the input up to 5v.
|
|
|
|
Sponsored links
|
|
Advertisement
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:36 PM.
| |