Go to Post the whole process is the most valuable part, not the award itself - Rich Kressly [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Spotlight this post!  
Unread 03-05-2008, 21:56
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Re: Automatic counter-Encoder

Part I:

Woah there! Plenty of help, thanks!

As for Kevins code: count = (count + ((dig_in ^ old_dig_in)?1:0))%30;
old_dig_in = dig_in;

Do I simply replace dig_in with rc_dig_in05 for example if im using digital 05 as my input. Will I have to replace old_dig_in with anything or leave it as is....

So everytime I need to call back to find where the count is, I have to refer to using "count"? right? so in the case that count = 25 is true, do this etc etc...if count is 26 do this and so on. Would it be possible to start the count when the switch is either a 0 or a 1? For example, I always want the first number 1 to be when the switch is 1, and then when the switch is 0, that would become 2, if I had to reset, and the current switch is sitting at 0, it would not start the count unless the switch is at 1.

So can someone run this through with me? When the system boots up, what is it doing initially? It has no count to begin with? Does it start counting as soon as it detects that a change has occured?

Could it be made so that initially, if the switch is 0, it would count it as a 1, and when the switch starts with a 1, it would count is as an automatic 2. This way, each 0 that comes back from the switch becomes an odd number, while each 1, is an even number.

If you are wondering what this wheel is, it is actually a motor that I've been making in the shop. its made to track distance covered by the rotations.

Part II:

How do I print the current count in a printf format?

Last edited by Generalx5 : 03-05-2008 at 21:59. Reason: Added part II
 


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
Automatic Something... synth3tk IT / Communications 8 08-03-2008 20:20
Automatic Transmission gnirts Programming 6 18-01-2007 20:44
Automatic Power Swampcoder2 Control System 6 03-02-2005 17:08
Automatic Power Swampcoder2 Electrical 6 03-02-2005 17:08
automatic archiving Joe Ross CD Forum Support 5 04-08-2003 13:27


All times are GMT -5. The time now is 20:26.

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