To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1769
1768  |  1770
Subject: 
Blocking SetUserDisplay?
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Sat, 4 Jun 2005 21:06:36 GMT
Viewed: 
5293 times
  
I have a program with a setup routine for calibrating light sensors. During the
setup routine, it does:

SetUserDisplay (a, 2);

Then in a loop, reads the values of 2 light sensors into x & y, averages the
readings and then does:

a = x * 100 + y;

to display them. This mostly works, but occasionally displays x or x * 100, I'm
assuming the intermediate calculations are actually being stored in the variable
a, and the display doesn't know so displays whatever is there.

I can work around it by doing:

b = x * 100 + y;
a = b;

but I was wondering if there's any other way to either force NQC to use
temporary space for calculations, or force the display routine to block until
the calculations are complete?

Or is this something that is governed by the firmware?

ROSCO



Message has 3 Replies:
  Re: Blocking SetUserDisplay?
 
(...) That's the only way around it as far as I know. JB (19 years ago, 4-Jun-05, to lugnet.robotics.rcx.nqc)
  Re: Blocking SetUserDisplay?
 
(...) You may be able to work around this by using parenthesis (untested). a = ((x * 100) + y); or you might try a = 0 + ((x * 100) + y); John Hansen (URL) (19 years ago, 5-Jun-05, to lugnet.robotics.rcx.nqc)
  Re: Blocking SetUserDisplay?
 
(...) In C you would declare a as volatile. Jürgen (19 years ago, 11-Jun-05, to lugnet.robotics.rcx.nqc)

6 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR