Go to Post p.s. note that 5-1/2 hours in the car with your daughter on the way to IRI is NOT the same as 10 hours in the van with seven members of Team 116 on the way to IRI. One is a wonderful familial experience, the other is an opportunity to go insane. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-01-2007, 21:39
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Unhappy Set Default Digital inputs to Low? How? bad Analog value?

How do I set the digital inputs to low on default? I'm using an optical sensor that inputs voltage when it senses an object, I'm using this on the EDU Mini RC, so is there a solution to setting it low? the sensor doesn't work like a switch so it doesnt short the Sig to Gnd.

Also how do you printf the Analog inputs? I have 3 analog channels and this is how I printf mine:

printf("rc_ana_in01 %3d, rc_ana_in02 %3d, rc_ana_in03 %3d\n",(int)rc_ana_in01,(int)rc_ana_in02,(int)rc_a na_in03),

Is this correct? because im getting readings that look like this:
rc_ana_in01 135, rc_ana_in02 143, rc_ana_in03 151

so please help me out. Thanks!
  #2   Spotlight this post!  
Unread 03-01-2007, 21:45
DanDon's Avatar
DanDon DanDon is offline
ohhh MY god
AKA: Dan Hoizner
FRC #0375 (The Robotic Plague)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Staten Island, NY
Posts: 1,432
DanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond repute
Send a message via ICQ to DanDon Send a message via AIM to DanDon Send a message via MSN to DanDon
Re: Set Default Digital inputs to Low? How? bad Analog value?

Wait, is this an analog or a digital sensor? Is it perchance one of the banner sensors that we got in the kits in 2004?
__________________
  #3   Spotlight this post!  
Unread 03-01-2007, 21:55
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Re: Set Default Digital inputs to Low? How? bad Analog value?

Nope, not that sensor, its a reflective object sensor. this sensor is analog, its ouput voltage varies with different refletive surfaces. I was thinking of putting a resistor to keep the gate closed, and if the sensor picked something up, it would have opened the gate due to a weak resistor.
  #4   Spotlight this post!  
Unread 03-01-2007, 22:14
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Set Default Digital inputs to Low? How? bad Analog value?

Quote:
Originally Posted by Generalx5 View Post
How do I set the digital inputs to low on default? I'm using an optical sensor that inputs voltage when it senses an object, I'm using this on the EDU Mini RC, so is there a solution to setting it low? the sensor doesn't work like a switch so it doesnt short the Sig to Gnd.

Also how do you printf the Analog inputs? I have 3 analog channels and this is how I printf mine:

printf("rc_ana_in01 %3d, rc_ana_in02 %3d, rc_ana_in03 %3d\n",(int)rc_ana_in01,(int)rc_ana_in02,(int)rc_a na_in03),

Is this correct? because im getting readings that look like this:
rc_ana_in01 135, rc_ana_in02 143, rc_ana_in03 151

so please help me out. Thanks!
First up, you're probably going to need an inverter for the sensors, they sell them in a little chips at Radio Shack (hopefully). The digital I/O lines are hardwired to be pulled high unless grounded I believe, can someone else confirm this?

As far as the analog inputs, those variables are actually addresses used by a function to sample the ADC, this function is Get_Analog_Value(). It should used like this:

Code:
printf("rc_ana_in01 %d, rc_ana_in02 %d, rc_ana_in03 %d\n",Get_Analog_Value(rc_ana_in01), Get_Analog_Value(rc_ana_in02), Get_Analog_Value(rc_ana_in03));
Good luck!

EDIT: Also, Get_Analog_Value() returns the value of the ADC you choose, so you can store the information in a variable for use later like this:
Code:
unsigned int sensor_var;

sensor_var = Get_Analog_Value(rc_ana_in01);
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)

Last edited by Matt Krass : 03-01-2007 at 22:16. Reason: Added something to the usage of Get_Analog_Value()
  #5   Spotlight this post!  
Unread 03-01-2007, 22:21
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Thumbs up Re: Set Default Digital inputs to Low? How? bad Analog value?

YAY! I've just tried that and works like a charm, thanks!

The inverters sounds like a good invesment. I will consider that option.
  #6   Spotlight this post!  
Unread 04-01-2007, 01:02
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Exclamation Re: Set Default Digital inputs to Low? How? bad Analog value?

Is there still a way to make the Digital Inputs default to low? Because the Sensor im using has very little collecter-emitter voltage, as high as 0.4Volts, the NOT gates need a minimum of 1.5 Volts input for it to declared a high input. Any other ways to make this work? I've googled up the Not gates but nothing to my specifications.

It would be best if the Mini RC could do a pull down by default.

The other way to do this is...making them all analog? would that work?
  #7   Spotlight this post!  
Unread 04-01-2007, 01:25
prograid's Avatar
prograid prograid is offline
Registered User
AKA: Ben Cherian
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Oct 2004
Rookie Year: 2004
Location: San Jose
Posts: 80
prograid will become famous soon enough
Re: Set Default Digital inputs to Low? How? bad Analog value?

Quote:
Originally Posted by Generalx5 View Post
Is there still a way to make the Digital Inputs default to low?
I don't think so.
Quote:
Originally Posted by Generalx5 View Post

The other way to do this is...making them all analog? would that work?
Yes, I believe it would.

Well, from your description of the sensor, it seems that you could plug it in to an analog input, and then simply use it as a sort of digital sensor in the following manner (let's pretend the sensor is plugged into analog input 1):
PHP Code:
#define TRUE !0
#define FALSE 1
#define THRESHOLD_VALUE 500
#define OBJECT_SENSOR_INPUT rc_ana_in01
unsigned char objectNearby;
/*You may need to use "<" if I misunderstood how the sensor works*/
if(Get_Analog_Value(OBJECT_SENSOR_INPUT) > THRESHOLD_VALUE) { 
    
objectNearby TRUE;
} else {
    
objectNearby FALSE;

You can then use the objectNearby variable to check for the presence of the object and you can change the THRESHOLD_VALUE to make the sensor more or less sensitive.

Last edited by prograid : 04-01-2007 at 15:39.
  #8   Spotlight this post!  
Unread 04-01-2007, 08:25
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: Set Default Digital inputs to Low? How? bad Analog value?

What is sensor you are trying to interface? Can you post a link to or copy of the mfg. spec sheet? The 0.4V output does not sound correct.
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010
  #9   Spotlight this post!  
Unread 04-01-2007, 15:29
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Post Re: Set Default Digital inputs to Low? How? bad Analog value?

The sensor belongs to OPTEK technologies, OPB742D and OPB606A are the two sensors Im using.

Here are the Sensor Data,

http://www.optekinc.com/pdf/OPB740.pdf

http://www.optekinc.com/pdf/OPB606a.pdf

The voltage picked up from my Multimeter reads DC 0.4V maximum using a 1.5V double A battery source.

----------------------------------------------------------------------------------------------------------------------------------
Also, in hopes of getting rid of the use of Inverters, I've tried instead of setting INPUT; at the end of the IO's, I set them to 0;

IO4 = IO5 = IO6 = IO7 = IO8 = IO9 = IO10 = INPUT; <---------Before
IO4 = IO5 = IO6 = IO7 = IO8 = IO9 = IO10 = 0; <---------After

And I'm still not sure if it works, although the voltage between SIG and BLK is gone, I havnt found a way to trigger it so it goes high.

Last edited by Generalx5 : 04-01-2007 at 15:41. Reason: added the section under the dotted line
  #10   Spotlight this post!  
Unread 04-01-2007, 15:58
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: Set Default Digital inputs to Low? How? bad Analog value?

Check out this application note.

http://www.optekinc.com/pdf/App_Note_213.pdf

See figure 1 and figure 3.

The collector current of the phototransistor is relatively low.

The OPB606 is 500 uA this can pull down 5V thru a 10k resistor.
The OPB704 is 50 uA this can pull down 5V thru a 100k resistor.

I do not know what the input circuit of your controller looks like, but I would guess that the OPB606 might work with a direct connection as long as pullup is 10k or greater.

The OPB704 will very likely need the circuit shown in figure 3.
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010
  #11   Spotlight this post!  
Unread 04-01-2007, 16:01
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Set Default Digital inputs to Low? How? bad Analog value?

Quote:
Originally Posted by Generalx5 View Post
The sensor belongs to OPTEK technologies, OPB742D and OPB606A are the two sensors Im using.
Those devices are exactly suited to being connected directly to the RC's digital inputs. They don't produce voltage; their output is the equivalent of a contact closure. Tie the "E (2)" pin to ground, and the "C (1)" pin to the digital input.

(And don't mess with the IO direction settings. What they do is determine whether a given pin is an input or an output. There is always a pullup resistor on the pin.)
  #12   Spotlight this post!  
Unread 04-01-2007, 18:57
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Talking Re: Set Default Digital inputs to Low? How? bad Analog value?

Awesome! It works! Thanks so much for all your help.


Problem solved....I'm sure I'll have more problems later on when we start, but yeah! Awesome!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do the Analog Inputs work? JBotAlan Electrical 3 07-01-2005 00:11
OI and analog: Zero value Astronouth7303 Programming 1 02-02-2004 16:00
Resistance to Analog Input Value. Josh Hambright Electrical 12 15-04-2003 16:12
How to access other Digital inputs on OI? DougHogg Electrical 2 12-03-2003 13:57
Analog vs Digital inputs? f22flyboy Programming 8 08-11-2002 22:18


All times are GMT -5. The time now is 20:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi