![]() |
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! |
Re: decoder issue
Quote:
On another note, I assume you are waiting for the fix-it windows to work on this right? |
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.... |
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 ) ; |
Re: decoder issue
Yeah I done that and it works.
Buy mu question from the begining was what are those numbers at all?? |
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).
|
Re: decoder issue
And how to be sure I did it right?
would you give an example please? |
Re: decoder issue
well all I can say is that if it is counting right, then you have done it right!
|
Re: decoder issue
You mean counting right or counting at all?
|
Re: decoder issue
Based on the output it looks like you were using %d to print a long instead of %ld.
|
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