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:
|
5719 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:
Message is in Reply To:
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
|
|
|
|