Go to Post Just like it is not all about the robots, it is not all about winning the Chairman's Award. - Paul Copioli [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 16-02-2006, 22:38
colman77
 
Posts: n/a
digital inputs lag 0.5-1.0 second before registering change

It appears as though there's some sort of buffer or something on our digital in's...
We noticed that our banner sensors had a 0.5-1.0 second lagtime in registering the change from a 1 to a 0.
Then we took a pwn cable and shorted out the white to the black, and noticed the same phenomenon... in other words, it's something in the programing or the RC hardware.

for testing, we were using...
- default code

- a printf statement in user_routines_fast.c, in the function where it says to put code you wish to be executed every program loop (I don't remember the function name... but it was second to last I believe)

- rc_dig_in01 and rc_dig_in07, same thing happened on both

We'd connect black to white, and watch printf keep spitting out 1's for about .5 to 1 second, then it'd go to zero. Disconnect, watch 0's print out for .5-1.0 secs, then change to 1.

What is going on???
  #2   Spotlight this post!  
Unread 16-02-2006, 22:46
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: digital inputs lag 0.5-1.0 second before registering change

Sometimes this happens because you are writing too much data to the serial port. If you write faster than your terminal emulator can print out on your screen, it will appear to lag behind. I've been thrown by this a few times - the solution is to either print less data or use a better terminal.
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #3   Spotlight this post!  
Unread 16-02-2006, 22:46
Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
FRC #5507 (Robotic Eagles)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,031
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: digital inputs lag 0.5-1.0 second before registering change

Have you considered that the latency could be in the computer you are using to read the printfs? One of our mentors uses a laptop that gets about 12 seconds of latency on its serial port.

What if you make the code to immediately provide feedback to something else (say a servo) as soon as the digital input goes to one? This way you could see if the problem is really in the digital input, or if it is in the way you are reading the digital input.
  #4   Spotlight this post!  
Unread 16-02-2006, 23:28
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: digital inputs lag 0.5-1.0 second before registering change

printf's slow down the code in the RC, and as others have pointed out the serial port is very slow.

Your final version of competition code should have all the printf statements commented out (to get the fastest code loop execution times). Be aware that if you fine-tuned some SW function with printF's in the code, it will run faster when you comment them out, and it may act differently.
  #5   Spotlight this post!  
Unread 16-02-2006, 23:31
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: digital inputs lag 0.5-1.0 second before registering change

Check it with Hyperterminal. The terminal window built into the IFI loader definitely has lag in it.
  #6   Spotlight this post!  
Unread 17-02-2006, 05:51
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: digital inputs lag 0.5-1.0 second before registering change

Quote:
Originally Posted by steven114
Sometimes this happens because you are writing too much data to the serial port. If you write faster than your terminal emulator can print out on your screen, it will appear to lag behind. I've been thrown by this a few times - the solution is to either print less data or use a better terminal.
That would be my guess. Try only printing whenever the value changes.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #7   Spotlight this post!  
Unread 17-02-2006, 12:40
colman77
 
Posts: n/a
Re: digital inputs lag 0.5-1.0 second before registering change

Thank you all muchly... I'll take the printf out of the equation and use a servo or pwm or something to test the response of the digital in. The info about the printf function is very helpful.
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
heres the code. y this not working omega Programming 16 31-03-2004 15:18
Digital Inputs interfering with each other Bongle Programming 8 23-02-2004 11:18
digital inputs not valid just after initialization? WizardOfAz Programming 2 26-01-2004 13:21
Change to Initializing Inputs and Outputs Jferrante Programming 4 07-01-2003 11:36
Wife 1.0 archiver 2000 0 23-06-2002 22:04


All times are GMT -5. The time now is 21:56.

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