Go to Post I'm glad to be on the same team as smart people. - Andy Baker [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 22-01-2006, 20:06
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Question Missing teeth with kit tooth counter

I'm having problems with the kit tooth counters. I've attached one to digital input 1, enabled the interrupt, etc.

The interrupt works. But it seems to not fire all the time, like it's not firing all the time. When I get the value to the user by dashboard (User_Byte1), it doesn't increment every time it should.

We've also got the camera hooked up and operating. (The usage of the camera is not optional.)

The code I'm using is a stripped-down version of Kevin's encoder code. (Major stripped down.)

I'm not getting the red light o' death, or any other obvious signs of problems. I'm not using PWM13-16, I've made them all USER_CCP, and I'm linking with FRC_alltimers.lib.

Any recommendations on testing this, or possible causes?
  #2   Spotlight this post!  
Unread 22-01-2006, 20:30
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Missing teeth with kit tooth counter

How fast, or what's the maximum rate, do you figure the interrupts are coming in?

There is a certain minimum time and tooth gap required to make the gear tooth sensors work properly.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #3   Spotlight this post!  
Unread 22-01-2006, 21:02
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,370
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: Missing teeth with kit tooth counter

Are you measuring gear teeth or sprocket teeth? The sensor orientation and air gap are critical. Look at the spec sheet to confirm the mounting position.
If you are trying to measure gear teeth, they maybe too fine for the sensor.
  #4   Spotlight this post!  
Unread 22-01-2006, 22:37
devicenull devicenull is offline
Robot? We need a robot?
no team
 
Join Date: Sep 2004
Rookie Year: 1234
Location: n/a
Posts: 359
devicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nice
Re: Missing teeth with kit tooth counter

Make sure it's not the code.. From what I remember of last year, the encoders counts are "long"'s, while the user byte is an int. I'm not sure what would happen if you didn't explicitly cast it back to int with (int)encoder_count. I know I spent about a week trying to figure out a very similar problem, only to have it be that problem.
  #5   Spotlight this post!  
Unread 23-01-2006, 00:45
Biff Biff is offline
Registered User
AKA: Tom Cooper
#1227 (Techno Gremlins)
Team Role: Mentor
 
Join Date: Jan 2004
Location: Grand Rapids MI
Posts: 214
Biff is a jewel in the roughBiff is a jewel in the roughBiff is a jewel in the roughBiff is a jewel in the rough
Re: Missing teeth with kit tooth counter

We did test the tooth sensor before sending it off to programming. It's reading a 10 tooth #35 chain steel sprocket on a Cim shaft. My scope on the signal wire showed about 839 Hz when the motor was flat out. And clean waveforms in both directions. I will have to recheck to make sure that hasn't changed. In the mean time any help with the programming would be a great help. Thanks
  #6   Spotlight this post!  
Unread 23-01-2006, 20:33
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Missing teeth with kit tooth counter

What Biff (our electrical mentor) said.

The estimated maximum rate is 700 Hz. It's a sprocket (not a gear).

I was asking in the programming forum because I'm pretty sure it's programming.

We managed to get it working for a bit (turned out I had forgotten to set the "use prescalar" bit on TMR0 ). But when I restored the code that revealed this, it ceased to count at all. (PWM value ~120.)

The basic idea of the code is that at the end of the slow loop, it starts TMR0 and enables the counters. When TMR0 goes off, it disables the counters and the timer, then copies the counts and clears them.

I'm using 0 printf()'s.

I'm pretty sure it's not the sizes because it's always 0 (not sometimes 1 or something), and I also used bytes 1-3 to display a different part of the count.
  #7   Spotlight this post!  
Unread 23-01-2006, 22:04
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Missing teeth with kit tooth counter

Have you verified it worked with Kevin's default code? It's best to start with a known good program.

Since it sounds like you're getting very deep into counters and timers and such, it's going to be virtually impossible to help you without seeing the code.
  #8   Spotlight this post!  
Unread 24-01-2006, 16:08
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Missing teeth with kit tooth counter

Quote:
Originally Posted by Joe Ross
Have you verified it worked with Kevin's default code? It's best to start with a known good program.
I didn't realize kevin had code for tooth counters.

Quote:
Originally Posted by Joe Ross
Since it sounds like you're getting very deep into counters and timers and such, it's going to be virtually impossible to help you without seeing the code.
Aye. I did find the problem.

Basically, TMR0 was set to wait longer than 26.2ms, and every slow loop I restarted it. Meaning it never went off.

As it also turns out, the counts for the timer are also screwy. We're going to look at the whole system with an oscilliscope tonight.

(BTW, this isn't very clear from the PIC18 manual and 8722 datasheet. When using TMR0, and likely other 16-bit registers, you read the low byte first and the high byte second. Writing is the opposite way, write high byte first and low byte second.)
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
MISSING VIRTUAL KIT PARTS!!! Hershey Inventor 3 20-01-2005 15:26
Who is missing stuff from KOP? Matthew_H Kit & Additional Hardware 52 05-02-2004 19:52
Anyone missing as many parts as we are? Drew Hopman Technical Discussion 4 19-01-2004 19:06
Anyone missing the EDU kit? Adam Shapiro Kit & Additional Hardware 3 11-01-2004 15:03
missing kit parts Stephen Kowski Kit & Additional Hardware 57 22-01-2003 12:27


All times are GMT -5. The time now is 01:54.

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