Go to Post Our coolant system consists of a freshman with a squirt bottle. - Holtzman [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-01-2013, 11:55
sanddrag sanddrag is offline
On to my 16th year in FRC
FRC #0696 (Circuit Breakers)
Team Role: Teacher
 
Join Date: Jul 2002
Rookie Year: 2002
Location: Glendale, CA
Posts: 8,514
sanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond repute
US Digital Encoders - How many CPR?

Forgive me, I'm not a programmer and my students won't be here until this afternoon. This is a rather simple question but I couldn't find the answer. Can we use any number of count US Digital Encoders with Java? The students asked me to purchase 250 count, but I'm wondering if some lesser count would be better for high speed things. Is Java set up to use any number of count encoders? We may need to read three simultaneously if that makes any difference.
__________________
Teacher/Engineer/Machinist - Team 696 Circuit Breakers, 2011 - Present
Mentor/Engineer/Machinist, Team 968 RAWC, 2007-2010
Technical Mentor, Team 696 Circuit Breakers, 2005-2007
Student Mechanical Leader and Driver, Team 696 Circuit Breakers, 2002-2004
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2013, 12:11
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,572
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: US Digital Encoders - How many CPR?

The FPGA can decode approximately 153k edges per second and can handle 8 single channel counters and 4 two channel encoders simultaneously (each at 153k). If you're using a quaderature encoder (with four edges per count, the max is approximately 38k). This is the same across all languages. Neither the FPGA or the code care how many counts the encoder is, as long as it doesn't exceed 153k/38k limit. If you're running a shooter that only runs in one direction, you only need to use a single channel of the encoder with a counter object.

There is good discussion in the following thread about how the FPGA's clock rate affects the noise in measuring periods at high speed. http://www.chiefdelphi.com/forums/sh...d.php?t=112193. I recommend playing with the spreadsheet that Ether posted in that thread. The averaging feature used in that spreadsheet isn't user-accessible in Java, without recompiling WPILib. It wouldn't be hard to add, however. Without using averaging, it is better to use a lower count encoder.

Last edited by Joe Ross : 30-01-2013 at 18:15.
Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2013, 16:57
sanddrag sanddrag is offline
On to my 16th year in FRC
FRC #0696 (Circuit Breakers)
Team Role: Teacher
 
Join Date: Jul 2002
Rookie Year: 2002
Location: Glendale, CA
Posts: 8,514
sanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond repute
Re: US Digital Encoders - How many CPR?

Thanks for the help Joe. You posted just in time before I had to put the order in.
__________________
Teacher/Engineer/Machinist - Team 696 Circuit Breakers, 2011 - Present
Mentor/Engineer/Machinist, Team 968 RAWC, 2007-2010
Technical Mentor, Team 696 Circuit Breakers, 2005-2007
Student Mechanical Leader and Driver, Team 696 Circuit Breakers, 2002-2004
Reply With Quote
  #4   Spotlight this post!  
Unread 30-01-2013, 17:38
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: US Digital Encoders - How many CPR?

Quote:
Originally Posted by Joe Ross View Post
The FPGA can decode approximately 153k edges per second and can handle 8 single channel counters and 4 two channel encoders simultaneously (each at 153k). If you're using a quaderature encoder (with four edges per count, the max is approximately 38k).
The quadrature encoder uses two separate DIO channels. On each channel, there are only 2 edges per cycle (one rising and one falling).

So shouldn't the max be 153K/2 instead of 38K? Or do the two FPGA channels get tied together somehow when you configure them for quadrature decoding, so that each channel is no longer capable of 153K?



Reply With Quote
  #5   Spotlight this post!  
Unread 30-01-2013, 18:14
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,572
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: US Digital Encoders - How many CPR?

Quote:
Originally Posted by Ether View Post
The quadrature encoder uses two separate DIO channels. On each channel, there are only 2 edges per cycle (one rising and one falling).

So shouldn't the max be 153K/2 instead of 38K? Or do the two FPGA channels get tied together somehow when you configure them for quadrature decoding, so that each channel is no longer capable of 153K?
I got that from an old post on the NI forums from Joe Hershberger. https://decibel.ni.com/content/message/12541#12541 It probably has to do with quadrature detection for direction. It seems like it would need one clock in each of the 4 states.
Reply With Quote
  #6   Spotlight this post!  
Unread 30-01-2013, 18:17
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: US Digital Encoders - How many CPR?

Quote:
Originally Posted by Joe Ross View Post
I got that from an old post on the NI forums from Joe Hershberger. https://decibel.ni.com/content/message/12541#12541 It probably has to do with quadrature detection for direction. It seems like it would need one clock in each of the 4 states.
Thanks. I'll check with Joe and share what I find out.


Reply With Quote
  #7   Spotlight this post!  
Unread 01-02-2013, 13:53
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: US Digital Encoders - How many CPR?

Quote:
Originally Posted by Ether View Post
The quadrature encoder uses two separate DIO channels. On each channel, there are only 2 edges per cycle (one rising and one falling).

So shouldn't the max be 153K/2 instead of 38K? Or do the two FPGA channels get tied together somehow when you configure them for quadrature decoding, so that each channel is no longer capable of 153K?



My understanding is that the 4 quadrature decoders just use a single counter, counting rising and falling edges on two discrete lines which is why it is 38K max (and keeps track of A and B phase for direction). I do not believe it use two separate counters for each DIO channel.
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner

Last edited by NotInControl : 01-02-2013 at 14:01.
Reply With Quote
  #8   Spotlight this post!  
Unread 01-02-2013, 14:29
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: US Digital Encoders - How many CPR?

Quote:
Originally Posted by NotInControl View Post
My understanding is that the 4 quadrature decoders just use a single counter, counting rising and falling edges on two discrete lines which is why it is 38K max (and keeps track of A and B phase for direction). I do not believe it use two separate counters for each DIO channel.
No. A quadrature encoder uses 2 DIO channels. Each channel gets polled synchronously by the FPGA at 153KHz. Each channel counts its 720 edges at 153Khz.

But the encoder will not work if the elapsed time between rising edge on channel A and rising edge on channel B (or vice versa) exceeds 1/153KHz seconds, because the FPGA won't be able to tell which came first. That's where the 38K limit comes from.


Reply With Quote
Reply


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


All times are GMT -5. The time now is 11:39.

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