Go to Post Sometimes it is worth it to stop and read what you've written before posting. - [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 01-25-2011, 03:09 AM
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: A place to show off your knowledge of encoders

Quote:
Originally Posted by jwakeman View Post
This I figured out on my own today and I just finished up the first draft of a class for implementing the SPI interface with the sensor. I uploaded the project to our repository (http://code.google.com/p/first-team63/source/browse/#svn%2Ftrunk%2FDevelopment%2FApps%2FcRIO%2FAS5030_ SPI). I can also attach the code here as a zip if anyone requests. Joe, I would appreciate your comments on this code if you have a moment to look over it. I used the sample code in one of the specs as a reference. One thing I wasn't sure about was a function they were using called DIO_HIGH_IMP() that they didn't show the definition of. This function was to change the mode of the DIO pin to input mode. I just kinda left this out of my code and i am hoping that is ok because we are using the DIO pin as output only in the 4 line configuration.
Looks like you are bit-banging the SPI interface. There is an SPI engine built in to the FPGA that will do this stuff for you and will be much faster. The functions to access it are in the ChipObject dir in the WPILib source. This is a pretty difficult interface to use, though... it's just the register interface. Thanks to the contributions of Peter Johnson from team 294, the next WPILib for C++ update will include an SPI class that is easier to use. You may want to consider holding out for that.

Quote:
Originally Posted by jwakeman View Post
I think I will see how my SPI interface treats me before I dive into this one! I am gathering though that the AnalogTrigger and AnalogTriggerOutput class would somehow be used to create a simulated DigitalInput to pass to the Encoder class? This one looks tough...
Fair enough. The AnalogTrigger will give you AnalogTriggerOutput objects which if you look at their header file, inherit from DigitalSource. The Encoders take DigitalSource type objects as parameters for the A and B channels.

-Joe
Reply With Quote
 


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 10:00 AM.

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