Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   decoder issue (http://www.chiefdelphi.com/forums/showthread.php?t=44883)

TEAM1949 01-03-2006 09:39

decoder issue
 
I have a problem to solve tiil nexr sunday.

We are planing to use the decoder sensor.
when I run a program with it {with a working motor ofcourse} the output is running numbers.
Each whole loop of the Small 21 tooth Sprocket is a value of 136321 or close.

What does those numbers?
can anyone give as an exmaple some numbers he go?


tnx!

TubaMorg 01-03-2006 10:36

Re: decoder issue
 
Quote:

Originally Posted by TEAM1949
I have a problem to solve tiil nexr sunday.

We are planing to use the decoder sensor.
when I run a program with it {with a working motor ofcourse} the output is running numbers.
Each whole loop of the Small 21 tooth Sprocket is a value of 136321 or close.

What does those numbers?
can anyone give as an exmaple some numbers he go?


tnx!

Hmmm, this question is a little hard to decode :) By "decoder" are you talking about the gear tooth sensor? Since you are posting in the EasyC section I am assuming you are using the EasyC GearToothTest example. Output from the GetGTSensor is a 'long', but the print output is wrong because of overflow (this from another post).

On another note, I assume you are waiting for the fix-it windows to work on this right?

TEAM1949 03-03-2006 07:09

Re: decoder issue
 
ammmm yeah I forgot to mention that its the gear tooth sensor

but still I didnt understand what are does running numbers ?

Its important till tomorrow so....

TubaMorg 03-03-2006 19:05

Re: decoder issue
 
Well, again I am assuming your are using the test program, try casting it as a long so that it looks like this:

Code:

PrintToScreen ( "Gear tooth count = %ld\n" , (long)geartooth ) ;
That should fix the output so that it makes since to you. I believe you are just having overflow because a long can't be stuffed into an int.

TEAM1949 04-03-2006 07:02

Re: decoder issue
 
Yeah I done that and it works.
Buy mu question from the begining was what are those numbers at all??

TubaMorg 04-03-2006 13:29

Re: decoder issue
 
Generally, whenever you overflow a variable, it is hard to predict what will happen. In some cases it wraps around, in other cases it flows into unassigned memory addresses. The main thing is that when you get strange output, one of the things to look at is to make sure your variable is cast correctly (which you did).

TEAM1949 04-03-2006 14:37

Re: decoder issue
 
And how to be sure I did it right?
would you give an example please?

TubaMorg 04-03-2006 16:56

Re: decoder issue
 
well all I can say is that if it is counting right, then you have done it right!

TEAM1949 06-03-2006 08:31

Re: decoder issue
 
You mean counting right or counting at all?

Kingofl337 06-03-2006 08:38

Re: decoder issue
 
Based on the output it looks like you were using %d to print a long instead of %ld.

TEAM1949 07-03-2006 14:34

Re: decoder issue
 
Nope, sir!

I was using the %ld as it should be.


All times are GMT -5. The time now is 03:19.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi