Skip to content


August 2, 2011

I’m bummered. I almost had this project finished, and I was leaving something for the very end, and now I can’t figure out how to do it! 😦

How do I start, stop, and read a timer in NXC? I know how to do it in NXT-G, but not in NXC. Can anyone help me finish this?


From → Uncategorized

  1. store CurrentTick in an unsigned long, more later

    • I think I figured out CurrentTick, at least on a basic level. It seems to count (from a really low, negative number) to a really high number, then start over. But really fast. Since I wanted a pretty good (read: accurate) value, I ran a loop 10,000 times and checked the CurrentTick before and after the loop. then I divided the difference between the two CurrentTicks by 100,000 to find out how many ticks the loop took. Unfortunately, each time I ran the test, I had variances of +/- 3,000ish. But I’ve got a much better method (100 iterations instead of ten thousand) and it’s working much better. I think I need about one tick per millisecond, and about one millisecond per line of code, so about 33 ms.

      If it works out, I’ll be hopefully updating in a week or so, I’ve had some unexpected family happenings and visits and such, and some important hardware of mine just gave up on me today, so it’s a higher priority than my blog. 😦

      • Really low negative number? It returns an unsigned long, so that is probably your problem, use an unsigned long to store the tick

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: