Go to Post I remember eating dinner once. Long before Build season. Now, we only eat aluminum swarf and disappointment. - BeardyMentor [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 30-01-2008, 16:03
Team2002 Team2002 is offline
Registered User
FRC #2002
 
Join Date: Feb 2007
Location: Tualatin OR
Posts: 6
Team2002 is an unknown quantity at this point
Re: ir sensor Board ??????????????????????

I was trying the following for our IR board and nothing seems to happen
if (rc_dig_in15 == 1)
{
pwm_13 = 256;
}

This was just to test if pressing a button on the remote did anything (the remote was already programmed etc,.)

is there anything wrong that we are doing?

This snippet was placed in the user_routines.c
is that the correct place or should it be under user_routines_fast.c?

Thanks for any help
  #2   Spotlight this post!  
Unread 30-01-2008, 16:19
billbo911's Avatar
billbo911 billbo911 is online now
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,356
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: ir sensor Board ??????????????????????

Quote:
Originally Posted by Team2002 View Post
I was trying the following for our IR board and nothing seems to happen
if (rc_dig_in15 == 1)
{
pwm_13 = 256;
}

This was just to test if pressing a button on the remote did anything (the remote was already programmed etc,.)

is there anything wrong that we are doing?

This snippet was placed in the user_routines.c
is that the correct place or should it be under user_routines_fast.c?

Thanks for any help

I am not 100% positive on this, but here is my thoughts and what to try.

The rc_dig_in7 - 18 are tied high when they are set as inputs. If they are considered active when a switch is closed across them to ground, and the output of the IR board goes high when it is active, then you need to test for a !rc_dig_inxx. So try:

Code:
if (rc_dig_in15 == 0)
{
    pwm_13 = 256;
}
OR

Code:
if (!rc_dig_in15)
{
    pwm_13 = 256;
}

Again, I am not a pro at this, just a learner at this point.
BTW, the signal will pulse, so hold the button down.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #3   Spotlight this post!  
Unread 30-01-2008, 17:23
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: ir sensor Board ??????????????????????

Try this code on a post I made a few days ago. Use MPLAB and add it to the autonomous program. Put whatever you want the robot to do under mode 1 ,mode 2, or mode 3.

http://www.chiefdelphi.com/forums/sh...1&postcount=19
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
  #4   Spotlight this post!  
Unread 30-01-2008, 21:51
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: ir sensor Board ??????????????????????

Quote:
Originally Posted by Team2002 View Post
I was trying the following for our IR board and nothing seems to happen
Code:
if (rc_dig_in15 == 1)
{
    pwm_13 = 256;
}
This was just to test if pressing a button on the remote did anything (the remote was already programmed etc,.)

is there anything wrong that we are doing?
Yes. The valid range of values for a pwm output is 0-254. Since the pwm "variables" in the code are of type unsigned char, trying to set one to 256 will actually end up with it set to zero.

Quote:
This snippet was placed in the user_routines.c
is that the correct place or should it be under user_routines_fast.c?
You'll need to be a lot more specific about where you put the code. The filename is not really important. What matters is the name of the function in which it appears: Process_Data_From_Master_uP(), Default_Routine(), Process_Data_From_Local_IO(), etc.
  #5   Spotlight this post!  
Unread 30-01-2008, 22:37
AdmiralAllen's Avatar
AdmiralAllen AdmiralAllen is offline
Master of Computers and Robots
AKA: Allen Worcester
FRC #1662 (Raptor Force Engineering)
Team Role: Alumni
 
Join Date: May 2006
Rookie Year: 2005
Location: California
Posts: 37
AdmiralAllen will become famous soon enough
Re: ir sensor Board ??????????????????????

Quote:
Originally Posted by Alan Anderson View Post
Yes. The valid range of values for a pwm output is 0-254. Since the pwm "variables" in the code are of type unsigned char, trying to set one to 256 will actually end up with it set to zero.



You'll need to be a lot more specific about where you put the code. The filename is not really important. What matters is the name of the function in which it appears: Process_Data_From_Master_uP(), Default_Routine(), Process_Data_From_Local_IO(), etc.

no......the maximum pwm value is 256......its an extrema
  #6   Spotlight this post!  
Unread 31-01-2008, 18:22
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,753
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: ir sensor Board ??????????????????????

Quote:
Originally Posted by AdmiralAllen View Post
no......the maximum pwm value is 256......its an extrema
Actually, the maximum PWM value is 255, or 2^8 - 1, which is the maximum value that can be held in 8 bits of memory - the size of an unsigned char. Going above this will cause an overflow problem, where you'll loop around and start at 0 again.
  #7   Spotlight this post!  
Unread 31-01-2008, 22:46
darkdwarven's Avatar
darkdwarven darkdwarven is offline
Registered User
AKA: Phantom
FRC #2348
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2005
Location: Hawaii
Posts: 8
darkdwarven is an unknown quantity at this point
Re: ir sensor Board ??????????????????????

We were trying to find a way to program the Robot Cotroller so that when any of 2 inputs receive a signal, it will leave the autonomous code and enter a 'maual' autonomous code. The manual autonomous code would work based on 2 if statements that loop back to the other. The if statements would either say left or right and cotinue until our timer value ran out. Our code in the attached file, only makes the motors pulse for some other direction or go to one and continue straight without any further response. Any problems with our coding? Also does anyone know an easier way of accomplishing the same tasks?


Thanks always for the help,
Team 2348
Attached Files
File Type: txt manual_autonomous.txt (1.2 KB, 60 views)
__________________
I have nothing important to say here, thus I've wasted a few seconds of your life. Isn't that depressing?
  #8   Spotlight this post!  
Unread 31-01-2008, 17:29
Team2002 Team2002 is offline
Registered User
FRC #2002
 
Join Date: Feb 2007
Location: Tualatin OR
Posts: 6
Team2002 is an unknown quantity at this point
Re: ir sensor Board ??????????????????????

Quote:
Originally Posted by Alan Anderson View Post
Yes. The valid range of values for a pwm output is 0-254. Since the pwm "variables" in the code are of type unsigned char, trying to set one to 256 will actually end up with it set to zero.



You'll need to be a lot more specific about where you put the code. The filename is not really important. What matters is the name of the function in which it appears: Process_Data_From_Master_uP(), Default_Routine(), Process_Data_From_Local_IO(), etc.

I placed it under Default_Routine() is that the wrong place? I couldnt find a function called Process_Data_From_Local_IO(), in user_routines.c
  #9   Spotlight this post!  
Unread 31-01-2008, 23:16
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: ir sensor Board ??????????????????????

Quote:
Originally Posted by Team2002 View Post
I placed it under Default_Routine() is that the wrong place?
If your goal is to test the ability to use IR commands to control motors, that's probably the right place to put it.

But you need to make sure that the pwm outputs you set don't get set to something else later on. You can do that most easily by putting the IR sensing code near the end of the function, so it gets the last opportunity to force the motors to move as you want.
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
Wiring the IR sensor board govvijay Programming 9 05-02-2008 19:41
Technical Details for the IR sensor board tuzzer Electrical 1 19-01-2008 08:38
How to program ir sensor board?? RRA4LIFE2 Programming 1 11-01-2008 21:47
Perf Board = BS2-IC Carrier Board? indieFan Electrical 2 16-09-2004 08:28
Making a Sensor Board SpaceOsc Technical Discussion 11 15-05-2004 12:46


All times are GMT -5. The time now is 23:46.

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