Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   ir sensor Board ?????????????????????? (http://www.chiefdelphi.com/forums/showthread.php?t=62831)

RRA4LIFE2 29-01-2008 22:53

ir sensor Board ??????????????????????
 

We are a rookie team. we do not know how to start up the sensor board. to what type of battery do you connect it, or do you need to buy that battery adapter or what we need help fast!!!!!!

wt200999 29-01-2008 23:05

Re: ir sensor Board ??????????????????????
 
Whoa, calm down there now :yikes:

There have been a ton of threads posted about this, there are a couple of images that show some of the wiring too.

http://www.chiefdelphi.com/forums/search.php

It will end up being wired to 4 digital ports on the robot and it will end up going into the main battery through one of the circuits. On another thread you posted someone linked you to the page that shows the pin-out of the actual board. Follow that.

There is also a pdf somewhere that shows how the wiring goes with the different panels and the controller etc.

darkdwarven 30-01-2008 00:22

Re: ir sensor Board ??????????????????????
 
I've been searching the forums for remedies to why we can't make our IR Board work. And i've found some that for me have had no effect on the performance of our motors. Right now to test if we can program anything to correspond with the signals that tie IR board reveives/gives, we inserted the following code:
Code:

if (rc_dig_in07 = 0)
{
        ButtonPressed = TRUE;
        if (ButtonPressed = TRUE)
                {
                        pwm01 = pwm02 = 127;
                }
}

That is a function we are trying to put right before our autonomous program. The purpose was to allow the motors to run and if there is an interrupt from the IR Board, the motors would stop for the remainder. The autonomous program works fine without that 'if' statement but doesn't work at all with it. It compiles just fine with everything defined and all. Also, we are working off of port 7 because our advisor read something in the default guide about 1-6 being reserved for more advanced functions?

Any suggestions for resources or troubleshooting options??

Thanks,
Team 2348

Alan Anderson 30-01-2008 08:02

Re: ir sensor Board ??????????????????????
 
Quote:

Originally Posted by darkdwarven (Post 688531)
Code:

if (rc_dig_in07 = 0)

This tries to assign the value 0 to the rc_dig_in07 variable. It also has the side effect of never being true. You want instead to test for equality.

In short, replace the = with ==.

Some people use the technique of always putting the constant on the left in a test like this. That way the compiler will notice and complain if you accidentally use a single equals sign.

Oh, and your test is backwards. The IR receiver board outputs 0 when nothing is detected, and gives a 100 millisecond 1 pulse when a valid signal is received.

Team2002 30-01-2008 16:03

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

billbo911 30-01-2008 16:19

Re: ir sensor Board ??????????????????????
 
Quote:

Originally Posted by Team2002 (Post 688914)
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.

RyanN 30-01-2008 17:23

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

Alan Anderson 30-01-2008 21:51

Re: ir sensor Board ??????????????????????
 
Quote:

Originally Posted by Team2002 (Post 688914)
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.

AdmiralAllen 30-01-2008 22:37

Re: ir sensor Board ??????????????????????
 
Quote:

Originally Posted by Alan Anderson (Post 689153)
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

Team2002 31-01-2008 17:29

Re: ir sensor Board ??????????????????????
 
Quote:

Originally Posted by Alan Anderson (Post 689153)
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

Jon Stratis 31-01-2008 18:22

Re: ir sensor Board ??????????????????????
 
Quote:

Originally Posted by AdmiralAllen (Post 689188)
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.

darkdwarven 31-01-2008 22:46

Re: ir sensor Board ??????????????????????
 
1 Attachment(s)
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

Alan Anderson 31-01-2008 23:16

Re: ir sensor Board ??????????????????????
 
Quote:

Originally Posted by Team2002 (Post 689691)
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.


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

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