Go to Post I guess that some people don't understand that no means no. - Steve W [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 08-11-2002, 13:12
f22flyboy's Avatar
f22flyboy f22flyboy is offline
Distributor of Mayhem
#0540 (Rhythmic Disturbance)
 
Join Date: Oct 2002
Location: Richmond, VA
Posts: 199
f22flyboy will become famous soon enoughf22flyboy will become famous soon enough
Analog vs Digital inputs?

The way I understand it, you can wire a switch into the digital input on the RC as a rc_sw# and then it disables a PWM or relay.

Also, I see that you can wire a sensor into a analog input as sensor#

The problem is, I can't figure out what the analog inputs output

If anyone can clarify this, i would appreciate it.
__________________
Godwin Robotics Association- Rhythmic Disturbance

Team 540 Forums

FIRST Look... FIRST Shot... FIRST Kill.
  #2   Spotlight this post!  
Unread 08-11-2002, 14:06
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
Quote:
analog inputs output
Analog inputs if I understande correctly output a varying voltage. For example a potemimenter(spelling really badly) is a analog input. As you turn the pot it's voltage varies. This is a analog device. Digital devices usually are either on or off like a switch. I hope this answers your question.
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill
  #3   Spotlight this post!  
Unread 08-11-2002, 14:14
f22flyboy's Avatar
f22flyboy f22flyboy is offline
Distributor of Mayhem
#0540 (Rhythmic Disturbance)
 
Join Date: Oct 2002
Location: Richmond, VA
Posts: 199
f22flyboy will become famous soon enoughf22flyboy will become famous soon enough
But where does the output of variable voltage go? what is it used for and how is it programmed?
__________________
Godwin Robotics Association- Rhythmic Disturbance

Team 540 Forums

FIRST Look... FIRST Shot... FIRST Kill.
  #4   Spotlight this post!  
Unread 08-11-2002, 14:27
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
Thats were I get lost. An analog to digital converter will convert the analog voltage into a digital signal or a comparator can read the voltage off the circuit and will go a high state if the voltage is a certain level. Basically I think you need to convert the analog into digital signal before you can do anything.
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill

Last edited by Adam Y. : 08-11-2002 at 14:29.
  #5   Spotlight this post!  
Unread 08-11-2002, 14:38
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
By themselves, neither switches or sensors do anything. It is only in the programming that you can make something happen (or not happen) as a result of the values of a switch or sensor.

The way the switches "disable" a relay or speed controller is because the default code has them set up that way. Once you change the default code, you can have these things do anything you want.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #6   Spotlight this post!  
Unread 08-11-2002, 15:18
Marc P. Marc P. is offline
I fix stuff.
AKA: βetamarc
no team
 
Join Date: Jan 2002
Rookie Year: 1999
Location: Watertown, CT
Posts: 997
Marc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond repute
Send a message via AIM to Marc P.
I believe the output voltage from an analog sensor doesn't go anywhere in particular, it's just used in "if, then" logic sequences within the PBASIC processor, such that "If <condition exists> then <result>, much like the digital sensors, if sw_1 = on, then motor1= off, etc. but rather, if var=127 then pwm1=127, if var=254 then pwm1=254, etc. The changes in voltage are registered as variables in the programming, defined based on the SERIN command upon every program iteration/repetition (which is why it sits at the top of the main program loop). The serin captures whatever the voltage happens to be upon it's execution, whether a sensor (gyrochip) or a potentiometer, and saves it in the program as a variable, until the program loops and it is replaced by the same serin command. This loop cycles anywhere from 50-80 times per second, depending on the length and complexity of the program, resulting in what feels like a real time translation of analog data into action, when really it's cycle based.

Hope that helps.
  #7   Spotlight this post!  
Unread 08-11-2002, 17:23
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
The output of an analog would go to something like a speed controller to change the speed of one of your motors. A digital output would likely go to a spike which is ON FWD, OFF, or ON REV.

The output from the IFI controller is not an analog voltage signal as one might think but rather a PWM (Pulse width Modulated) signal that has a varied pulse width to distinguish the analog signal. The victor(or RC Servo) will then take this signal and convert it to a voltage for the motor or a position for the servo.

PULSE WIDTH ANGLE COMMENT
0.6 mSec -45 degrees minimum pulse length
1.5 mSec 0 degrees center position
2.4 mSec -45 degrees maximum pulse length

Hope this helps
  #8   Spotlight this post!  
Unread 08-11-2002, 18:40
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Quote:
Originally posted by Marc P.
if var=127 then pwm1=127, if var=254 then pwm1=254
Unfortunately, this type of syntax does not work. The only thing after the "then" can be a label to go to if the condition is true. For example:

if (sensor1<127) then dontZeroPWM1
PWM1=127
dontZeroPWM1:

With this code, anytime sensor1 is greater than or equal to 127, PWM1 will be set to 127. When sensor1 is less than 127, the condition is true and the code skips the line that would normally set PWM1.

This is by far one of the most confusing parts of PBASIC and is the reason why many times you will find yourself writing "if not" instead of just plain "if." Once you are able to think of "if" statements as being used to skip portions of code, everything becomes much easier.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #9   Spotlight this post!  
Unread 08-11-2002, 22:18
Marc P. Marc P. is offline
I fix stuff.
AKA: βetamarc
no team
 
Join Date: Jan 2002
Rookie Year: 1999
Location: Watertown, CT
Posts: 997
Marc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond repute
Send a message via AIM to Marc P.
I realize this, but for the purposes of explanation, it's easier to understand. Virtually none of the sensors are perfectly calibrated to the same scale as the PWM, and often a complex mathematical equation is necessary to make it function even remotely proper. My purpose was not to state proper syntax, but answer the original question via theoretical explanation.
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 to access other Digital inputs on OI? DougHogg Electrical 2 12-03-2003 13:57
Pre-Autonomous OI Communication Ryan Meador Programming 19 23-01-2003 20:38
Competition Sequence for PBasic ttedrow Programming 12 23-01-2003 08:49
Digital inputs, bandwith, errors? Micah Brodsky Programming 7 20-01-2003 16:08
Serious Controller Ideas archiver 1999 28 23-06-2002 23:01


All times are GMT -5. The time now is 19:02.

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