Go to Post 15 thread derailment points - EmileH [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 15-11-2006, 22:55
yogibear yogibear is offline
Registered User
no team
 
Join Date: Nov 2006
Location: Boulder, CO
Posts: 3
yogibear is an unknown quantity at this point
Vex SW Architecture

I would like to understand the SW architecture that is used on the Vex system. I have found 2 sources of information so far, but I am hoping for more detail. I want to understand any timing constraints so I can write code that can actually executed in the available time. IFI help folks could only suggest that I read the PIC documentation, even though their implementation is what I actually concerned with.

What is actually happening in the background when I have encoders and an ultrasonic range finder that generate interrupts?

I've been told that if I use PrintToScreen statements to check the timing of code, I will actually alter the time to execute. Sound a bit like Heizenberg's Uncertainty to me.

Thanks for any and all help,
Pat

The WPILib documentation says
"The user to master communication happens periodically over a serial bus connecting the two processors. Every 26ms for FRC or 14ms for VEX the master processor sends the current state of the OI to the user processor and receives the current speeds for the PWM outputs to drive the motors. If this communication does not happen, the master processor will stop the user processor resulting in the flashing red code error light."

The following code is found in the default main.c routine, which is not necessarily indicitive of how fast custom user code can run.
if (statusflag.NEW_SPI_DATA) /* 18.5ms loop area */
{ /* I'm slow! I only execute every 18.5ms because */
/* that's how fast the Master uP gives me data. */
Process_Data_From_Master_uP(); /* You edit this in user_routines.c */
  #2   Spotlight this post!  
Unread 16-11-2006, 09:00
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: Vex SW Architecture

Quote:
Originally Posted by yogibear
I would like to understand the SW architecture that is used on the Vex system. I have found 2 sources of information so far, but I am hoping for more detail. I want to understand any timing constraints so I can write code that can actually executed in the available time. IFI help folks could only suggest that I read the PIC documentation, even though their implementation is what I actually concerned with.

What is actually happening in the background when I have encoders and an ultrasonic range finder that generate interrupts?

I've been told that if I use PrintToScreen statements to check the timing of code, I will actually alter the time to execute. Sound a bit like Heizenberg's Uncertainty to me.

Thanks for any and all help,
Pat

The WPILib documentation says
"The user to master communication happens periodically over a serial bus connecting the two processors. Every 26ms for FRC or 14ms for VEX the master processor sends the current state of the OI to the user processor and receives the current speeds for the PWM outputs to drive the motors. If this communication does not happen, the master processor will stop the user processor resulting in the flashing red code error light."

The following code is found in the default main.c routine, which is not necessarily indicitive of how fast custom user code can run.
if (statusflag.NEW_SPI_DATA) /* 18.5ms loop area */
{ /* I'm slow! I only execute every 18.5ms because */
/* that's how fast the Master uP gives me data. */
Process_Data_From_Master_uP(); /* You edit this in user_routines.c */

Interrupts provide a way to signal the processor to stop what it is currently doing and run a special piece of code to handle the interrupt. When the processing of the interrupt is complete the processor returns to running the original program exactly where it left off. An interrupt provides a way to immediately handle an event rather than polling for changes in the state of an input within the main program. Interrupts allow us to be sure that we do not miss events (with some caveats) or more accurately measure the timing of events. For an encoder, the interrupt is used to increment the variable used to store the number of steps. In a polling loop, steps could be missed while the processor is doing something else resulting in an inaccuracy in the measurement. For the ultrasonic range finder, we want to measure the time between when the transmitter fires and the receiver detects the reflection. The timer is started when the transmitter is fired. The timer is stopped when the interrupt occurs. The use of the interrupt allows for more precise measurement of the time. In a polling loop there would be significantly more uncertainty in the measurement of the time. We might even miss the signal altogether if the signal from the receiver is shorter than duration of the loop. Interrupts are a powerful feature which must be used carefully. Interrupt service routines should be kept as short as possible. Do only the processing that is absolutely required. Let the main program loop do as much of the work as possible.
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010
  #3   Spotlight this post!  
Unread 16-11-2006, 15:59
yogibear yogibear is offline
Registered User
no team
 
Join Date: Nov 2006
Location: Boulder, CO
Posts: 3
yogibear is an unknown quantity at this point
Re: Vex SW Architecture

Quote:
Originally Posted by charrisTTI
Interrupts provide a way to signal the processor to stop what it is currently doing and run a special piece of code to handle the interrupt. When the processing of the interrupt is complete the processor returns to running the original program exactly where it left off. An interrupt provides a way to immediately handle an event rather than polling for changes in the state of an input within the main program. Interrupts allow us to be sure that we do not miss events (with some caveats) or more accurately measure the timing of events. For an encoder, the interrupt is used to increment the variable used to store the number of steps. In a polling loop, steps could be missed while the processor is doing something else resulting in an inaccuracy in the measurement. For the ultrasonic range finder, we want to measure the time between when the transmitter fires and the receiver detects the reflection. The timer is started when the transmitter is fired. The timer is stopped when the interrupt occurs. The use of the interrupt allows for more precise measurement of the time. In a polling loop there would be significantly more uncertainty in the measurement of the time. We might even miss the signal altogether if the signal from the receiver is shorter than duration of the loop. Interrupts are a powerful feature which must be used carefully. Interrupt service routines should be kept as short as possible. Do only the processing that is absolutely required. Let the main program loop do as much of the work as possible.
Thanks! That is terrific information for me that I was unaware of. Given what you said, how can I then quantify the effect of sensors that are interrupt driven, such as the encoders and ultrasonic range finder?

I still feel like I'm missing some key understanding of the software and timing, and that until I understand this, I won't be able to write code that effectively uses the available resources. If anyone has additional information, I would appreciate any and all of it.

Thanks again,
Pat
  #4   Spotlight this post!  
Unread 01-12-2006, 12:04
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Vex SW Architecture

Encoders and Ultrasonic are driven by interrupts that we handle for you. On event they take priority over everything else to execute a tiny bit of code.

Normal inputs are monitored via the user code loop speed. So, the smaller the user code is then the faster the inputs get checked. We did not bring out interrupts in easyC/easyC Lib for the user to access.

You may just want to write a program to monitor the loop time and then print it to screen after checking.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni

Last edited by Kingofl337 : 01-12-2006 at 12:06.
  #5   Spotlight this post!  
Unread 01-12-2006, 15:14
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Vex SW Architecture

All,

This post is a good read...

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
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
2006 WIRED Vex Challenge and Milwaukee Vex League Kevin Kolodziej Off-Season Events 15 04-12-2006 09:59
Vex Announcement: FIRST Vex Challenge Extended for 2006-2007 KathieK FIRST Tech Challenge 14 30-07-2006 23:42
VEX EDUbot hybrid or $50.00 VEX kit? Tazlikesrobots Robot Showcase 15 13-08-2005 22:12


All times are GMT -5. The time now is 22:34.

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