View unanswered posts | View active topics It is currently Sat Apr 19, 2014 3:13 am






Reply to topic  [ 5 posts ] 
Multiple sensors 
Author Message
Rookie

Joined: Mon Oct 26, 2009 8:29 pm
Posts: 4
Post Multiple sensors
Is it possible to have multiple (3) sonar sensors and 2 encoders on one microcontroller? There are enough spaces but they dont seem to work at the same time. Need all these sensors for this project. If its not supposed to be possible is there a workaround?


Mon Oct 26, 2009 8:32 pm
Profile
Novice

Joined: Tue Jan 13, 2009 5:22 pm
Posts: 72
Location: USA, Pennsylvania
Post Re: Multiple sensors
It should work.
Though you have to go to the motors and sensors setup and name and set the ports to whatever sensor you're using because different sensors have different values, sonar = inches and button 1 or 0.
If you don't assign the sensors to what they are, the robot will read them as 1 or 0 as a button.

_________________
We need a Linux Version!


Tue Oct 27, 2009 7:45 pm
Profile WWW
Rookie

Joined: Mon Oct 26, 2009 8:29 pm
Posts: 4
Post Re: Multiple sensors
I understand that. Heres my current problem. robotc only allows for interrupts 1 and 2 to be used for sonar. I need one more. Why is this? How do I fix this? See attachment.


Attachments:
sen.jpg
sen.jpg [ 114.62 KiB | Viewed 1561 times ]
Sun Nov 01, 2009 12:26 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: Multiple sensors
The Ultrasonic Rangefinder / Sonar Sensor relies on timers internal to the VEX to track how long it took for a pulse it sent out to bounce back. The reason that you're limited to two sensors, is that there are only two of the timers.

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Tue Nov 03, 2009 6:37 pm
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 614
Post Re: Multiple sensors
jbflot wrote:
The Ultrasonic Rangefinder / Sonar Sensor relies on timers internal to the VEX to track how long it took for a pulse it sent out to bounce back. The reason that you're limited to two sensors, is that there are only two of the timers.

This explanation is pretty close. ROBOTC relies on "edge triggered" interrupts for detecting the response from a SONAR sensor. Only the first two of the PIC microchip's six interrupts can be edge triggered.

The other four generate an interrupt on any transition. And the interrupt is "there's been a value change in one of the four interrupt pins". So it is up to the firmware to figure was it a high to low transition (that's what is desired) and on which pin. The code for this is not terribly complicated, but it is not something that has been implemented in ROBOTC firmware at present because of the low usage.


Wed Dec 09, 2009 4:07 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.