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 / 1797
1796  |  1798
Subject: 
Re: direct manipulation of bits in RCX registers using NQC
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Tue, 13 Sep 2005 01:32:01 GMT
Viewed: 
5558 times
  
In lugnet.robotics.rcx.nqc, Matt Jones wrote:

Can anyone tell me if it is possible to use NQC
to directly set bits in RCX registers?

   Perhaps - but the standard firmware implements a "virtual machine", and so
you don't generally have access to physical registers. But...

Specifically, I want to turn on and off the red LED
in a LEGO light sensor brick, *without* disabling the
light sensor itself.

   You can configure the input port that the light sensor is connected to as a
"passive" sensor (so it's unpowered) but read it out as a raw value (or even a
percent, just like a "real" light sensor):

SetSensorType(IN_1,SENSOR_TYPE_TOUCH);
SetSensorMode(IN_1,SENSOR_MODE_RAW);

This will work, *but*... the light sensor needs power to read out the
phototransistor as well (it's not there just to light the red LED). With an
unpowered input port, the phototransitor isn't getting the voltage bias it
needs, and it would read out "right".
   It *will* give a reading, and one that has something to do with the
brightness of the surface under it - but the sensitivity drops waaay down.
   Why do you need to do this?

Apparently, the power for this LED is mapped to
bits 0-2 of "port 6" (an RCX register).

   Where did you find this? In the 2.0 SDK, there is no "port 6" - the sensor
information is listed as in "sources" 9 through 13. OK, not that this helps...

--
Brian Davis



Message has 1 Reply:
  Re: direct manipulation of bits in RCX registers using NQC
 
(...) Hi Brian, Thanks for your response. (...) I'm not sure if I get this, because of C code examples I've seen, which I'll discuss again below. (...) I've tried this already, and as you say, it works, but the sensitivity goes waay down. For a (...) (19 years ago, 13-Sep-05, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  direct manipulation of bits in RCX registers using NQC
 
Hi all, Can anyone tell me if it is possible to use NQC to directly set bits in RCX registers? And if so, how does one do it? I've seen C code examples of this in a few places, but no NQC examples. Specifically, I want to turn on and off the red (...) (19 years ago, 12-Sep-05, to lugnet.robotics.rcx.nqc)

13 Messages in This Thread:


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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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