To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 2941
  Expression limitations w/bytecode
 
As I understand it, the bytecode interpreter doesn't allow you to do fairly simple things like subtract two variables from each other. That makes doing comparisions between sensors somewhat challenging if you want to know the magnitude of the (...) (25 years ago, 19-Jan-99, to lugnet.robotics)
 
  Re: Expression limitations w/bytecode
 
(...) The firmware does support basic arithmetic operations. You can use them in NQC like this... int a, b; task main { a = IN_1; b = IN_1; b -= a; } Dave p.s. As a side note, NQC does not support stuff like "a=b+c", but this is due to concurrency (...) (25 years ago, 19-Jan-99, to lugnet.robotics)
 
  Re: Expression limitations w/bytecode
 
(...) The supplied programming environment does not allow you to subtract one sensor value from another, but the bytecode interpreter does. See: (URL) see NQC, as Dave Baum pointed out. You do not have to resort to replacement firmware unless you (...) (25 years ago, 19-Jan-99, to lugnet.robotics)
 
  Re: Expression limitations w/bytecode
 
Dave Baum writes: > The firmware does support basic arithmetic operations. You can use them > in NQC like this... Ah, my mistake. I had tried something like "if (a - b > 20)" using NQC, and it failed. I referred to the docs, and my read of the (...) (25 years ago, 19-Jan-99, to lugnet.robotics)
 
  Re: Expression limitations w/bytecode
 
Kekoa Proudfoot writes: > Or see NQC, as Dave Baum pointed out. For my current project, I'll do that. :-) > You do not have to resort to replacement firmware unless you really want > to. Coming from programming some of the 68hc11 boards, I find that (...) (25 years ago, 19-Jan-99, to lugnet.robotics)
 
  Re: Expression limitations w/bytecode
 
One more note on arithmetic... The firmware supports operations where the second operand is either a constant or a variable, but not other sources (such as input values, timers, etc). Present versions of NQC don't check this, so code like "a -= (...) (25 years ago, 19-Jan-99, to lugnet.robotics)
 
  Re: Expression limitations w/bytecode
 
In article <13987.52974.46098.5...falo.edu>, Matthew D. Stock <stock@perdix.acsu.buffalo.edu> writes (...) Surely 34 10 0 0011 will subtract variables 10 and 11? (25 years ago, 19-Jan-99, to lugnet.robotics)

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