Quote:
Originally Posted by Alan Anderson
How are you printing it? Note that the function returns a long integer. If you're trying to print it with a %d format, you'll only get the topmost two bytes.
|
That's what I was thinking too--printf() is very particular about the data type coming in.
To print out the encoder count, you could typecast it to an int for printf:
Code:
printf("Encoder 1 is %d\r\n", (int)Get_Encoder_1_Count());
would do it, I think.
I can't seem to find the documentation for the printf function, so I can't give you the %whatever value you need to make a long int print...I'm not even sure if it's possible directly. Just typecast it as I showed, and it should give you a good value out.
JBot