Page 1 of 1

RCX rotation sensor with NXT

Posted: 24 Oct 2010, 06:11
by mattallen37
Why is it that sometimes when using the RCX rotation sensor with the NXT, it requires speeds of less than 360 RPM? It is rated for 500 RPM, and it works perfectly with the RCX (other than the low speed loss of count issue).

With the NXT, sometimes, I am required to use it at a really low speed at first. After a short while, I can start running it at about 360 RPM just fine. If I don't give it this "warm up", then sometimes, it only counts about 1/4-1/3 of the counts (I am not sure the exact fraction, but, based on the internal hardware, I assume it is exactly 1/4). This behavior seems somewhat erratic, but once the sensor is working properly, it will ALWAYS continue to be fine until I restart the program, then there is a chance. Also the "warm up" does NOT always fix it, but it usually helps.

Could this be a firmware (timing/threshold) issue with the low level programming of active sensors, or reading/counting?

I am running BCC 3.3.8.9 and 1.31 NXC/NBC firmware.

Re: RCX rotation sensor with NXT

Posted: 27 Oct 2010, 03:56
by afanofosc
I don't recall anything in the firmware sourcecode that would explain what you are seeing. How are you configuring your sensor port?

John Hansen

Re: RCX rotation sensor with NXT

Posted: 27 Oct 2010, 04:03
by mattallen37
I used
SetSensorType(IN_1, IN_TYPE_ANGLE);
And I tried both of the following (one at a time) in addition to the first.
SetSensorMode(IN_1, IN_MODE_ANGLESTEP);
SetSensorMode(IN_1, SENSOR_MODE_ROTATION);

Re: RCX rotation sensor with NXT

Posted: 27 Oct 2010, 04:14
by afanofosc
You should try

Code: Select all

SetSensor(S1, SENSOR_ROTATION);
This is equivalent to the following code:

Code: Select all

SetSensorType(S1, SENSOR_TYPE_ROTATION);
SetSensorMode(S1, SENSOR_MODE_ROTATION);
ResetSensor(S1);
You should never start using a sensor before it has time to be configured properly. That's what ResetSensor does. Never try to use a sensor unless you call ResetSensor after you change/set its type and/or mode.

John Hansen

Re: RCX rotation sensor with NXT

Posted: 27 Oct 2010, 04:16
by mattallen37
Thanks, I will try it soon.