RCX rotation sensor with NXT

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

RCX rotation sensor with NXT

Post 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.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: RCX rotation sensor with NXT

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: RCX rotation sensor with NXT

Post 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);
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: RCX rotation sensor with NXT

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: RCX rotation sensor with NXT

Post by mattallen37 »

Thanks, I will try it soon.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest