Go to Post Seniors, do you realize this is your last robot season?! - atomikitten [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 18-08-2006, 16:42
GlennGraham's Avatar
GlennGraham GlennGraham is offline
Registered User
AKA: Glenn Graham
FLL #0006 (Shark Bait!)
Team Role: Coach
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Beaverton, Oregon
Posts: 20
GlennGraham is an unknown quantity at this point
Reading an encoder with interrupts

I started with EasyC, and then moved to MPLab using EasyC libraries. Now I am trying to get the same functionality by making the necessary changes to the VexCode source (user_routines.[ch] and user_routines_fast.c). I am trying to count clicks of the shaft encoder using an interrupt and I've been analyzing the user_routines_sensor_test_fast.c code as an example. The comment at the top that "Encoder not ready yet" had me worried but I saw a lot of code associated with it so I read on With few comments in the code associated with the encoder, its tough for a beginner to work out the behavior. VexLabs makes it clear that they don't support the code so I thought I would ask and see if anyone here can lend some guidance.

Has anyone here used this example successfuly? Would you mind explaining how the encoder interrupt handler works with the timer2 interrupt handler?

Does anyone have another (possibly clearer) example they would like to share?

Can someone explain why they would make this assignment:
rc_dig_out11 ^= 1; rather than rc_dig_out11 = 1; ?
Its a digital output so would there be a difference?

I see quite a few uninitialized variables. EncoderDataTickCounter is an example. It is declared and incremented but never initialized. Must not be an issue for some reason.

In the interrupt handler, EncoderDataFlag.bit1 is set but I don't see anywhere that it is cleared. The comment says it indicates that data is ready to be read.

I will keep working on the problem and report back if I have anything useful for others in the same situation.


Thanks for your time,
-Glenn
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with reading and writing EEPROM DKolberg Programming 4 16-03-2004 19:29
Help with pots/interrupts mtrawls Programming 10 24-02-2004 17:01
EDU Demo Code: Encoder Interfacing Using Interrupts Kevin Watson Programming 4 08-01-2004 23:14
help with Interrupts thoughtful Programming 5 08-01-2004 16:07
Problem with interrupts on the PIC Mike Betts Programming 7 16-12-2003 21:26


All times are GMT -5. The time now is 12:40.

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