|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Let me first say that I am working with Vex programing for teh FVC compatition. I have tried several times to get my ultrasonics working together. I have tried putting a print to screen for each and they work individually, however, when I try to put them both together they will not work. Can anyone help me with my problem?
|
|
#2
|
||||
|
||||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
how are you setting them up? ie pointing at each other or straight forward towards a target?
|
|
#3
|
||||
|
||||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
Jackel,
Each sensor must be on its own interrupt line and digital output line. Also, you must stagger the output pulse so that both will not transmit a pulse at the same time. I can give you code fragments on how to so it in C but not EasyC. Mike |
|
#4
|
|||
|
|||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
Quote:
![]() |
|
#5
|
||||
|
||||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
Quote:
Does anyone have an EasyC solution to using multiple sonar sensors? I've tried using waits in between Ultrasonic sensor readings to try and avoid timing loop interference, but that has not worked. Each sensor works individually but not when more than one is used at a time. Is there too much latency in Starting and Stopping each individual Ultrasonics sensor in turn? Thanks! |
|
#6
|
|||
|
|||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
Quote:
I was going to send a pic, But don't know how on this forum. My email is ctx3201@comcast.net Let me know and I'll send it to you or tell me how to send a pic to this forum. Calvin |
|
#7
|
|||
|
|||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
Quote:
http://i71.photobucket.com/albums/i1...01/4Ultras.jpg |
|
#8
|
|||
|
|||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
Your are probable having the 2 sonars interfere with each other both physically and in the timing subroutines. Don't know how you have them set up and what your measuring, but you could mount one sonar on a servo. Point in 1 direction read it , move to another direction and read it.
|
|
#9
|
||||
|
||||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
Quote:
If it is them interfering with each other how would i fix that? |
|
#10
|
||||
|
||||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
Here is a code fragment for managing 3 ultrasonic sensors:
Code:
int Service_Ultrasonic_Sensors (void)
{
ultra_counter++;
switch (ultra_counter) // Process Ultrasonic Transducer
{
case 1:
for (pulsecount = 0 ; pulsecount < PULSE_WIDTH ; pulsecount++)
{
rc_dig_out10 = 1; // Make another pulse
};
rc_dig_out10 = 0; // The pulse is over
break;
case 2:
for (pulsecount = 0 ; pulsecount < PULSE_WIDTH ; pulsecount++)
{
rc_dig_out11 = 1; // Make another pulse
};
rc_dig_out11 = 0; // The pulse is over
break;
case 3:
for (pulsecount = 0 ; pulsecount < PULSE_WIDTH ; pulsecount++)
{
rc_dig_out12 = 1; // Make another pulse
};
rc_dig_out12 = 0; // The pulse is over
break;
case 4:
if (ultra_left_flag == TRUE)
{
INTCONbits.GIEL = 0; // Disable Low Priority Interrupts
ultra_left_time = ultra_left_stop - ultra_left_start;
INTCONbits.GIEL = 1; // Enable Low Priority Interrupts
ultra_good_count++;
}
else
{
ultra_left_time = -1;
ultra_bad_count++;
};
if (ultra_front_flag == TRUE)
{
INTCONbits.GIEL = 0; // Disable Low Priority Interrupts
ultra_front_time = ultra_front_stop - ultra_front_start;
INTCONbits.GIEL = 1; // Enable Low Priority Interrupts
ultra_good_count++;
}
else
{
ultra_front_time = -1;
ultra_bad_count++;
};
if (ultra_right_flag == TRUE)
{
INTCONbits.GIEL = 0; // Disable Low Priority Interrupts
ultra_right_time = ultra_right_stop - ultra_right_start;
INTCONbits.GIEL = 1; // Enable Low Priority Interrupts
ultra_good_count++;
}
else
{
ultra_right_time = -1;
ultra_bad_count++;
};
ultra_left_flag = FALSE;
ultra_front_flag = FALSE;
ultra_right_flag = FALSE;
ultra_counter = 0;
break;
default: // for any unexpected result
ultra_left_flag = FALSE;
ultra_front_flag = FALSE;
ultra_right_flag = FALSE;
ultra_counter = 0;
break;
};
}
the variables ultra_bad_count and ultra_good_count were used during development and can be deleted. An example interrupt routine is: Code:
void Service_DIO4_Interrupt(unsigned char state)
{
if (state == 1) // rising-edge interrupt
{
ultra_front_start = Read_Timer_3 (); // Read Start Time.
}
else // falling-edge interrupt
{
ultra_front_flag = TRUE;
ultra_front_stop = Read_Timer_3 (); // Read Stop Time
}
}
Hopefully, this helps. Mike |
|
#11
|
||||
|
||||
|
Re: Ultrasonic will not work with another Ultrasonic plz help
I will try to convert this please check back tommorow and see if it worked thanks for the help.
Jackel |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 3D Studio Max won't work | David the bomb | 3D Animation and Competition | 3 | 03-03-2004 17:12 |
| Problems of the mind... effecting work | Gadget470 | Chit-Chat | 20 | 18-11-2003 11:56 |
| Edit doesn't work on original title posts??? | Elgin Clock | CD Forum Support | 6 | 12-03-2003 17:30 |
| Who knows how the motors [I]really[/I] work? | Wetzel | Chit-Chat | 5 | 13-02-2002 21:50 |
| Does anyone on this board work at home depot? | mnkysp6353 | General Forum | 2 | 30-12-2001 13:27 |