#21 set RotationCount does not work

compiler
closed-rejected
NXC (53)
5
2007-08-22
2007-08-06
Anonymous
No

If you set a new RotationCount value for a motor like:

1. SetOutput(OUT_B, RotationCount, 100);
or
2. SetIOMA(OutputIORotationCount(OUT_B), 100);

the value is not set permanently.

Calling MotorRotationCount(OUT_B) directly after setting the value returns the new value (100).

Calling MotorRotationCount(OUT_B) a few ms after setting the newValue returns the old value (e.g. 0).

Sample code:

task main()
{
// RotationCount is 0 at start

long value = 123;
long rotationCount;

// It does not matter which function we use
// to set the RotationCount value:

//SetOutput(OUT_B, RotationCount, value);
SetIOMA(OutputIORotationCount(OUT_B), value);

rotationCount = MotorRotationCount(OUT_B);
// dbL is a debug function to display long values
dbL("rotation1=", rotationCount); // displays 123

Wait(100);

rotationCount = MotorRotationCount(OUT_B);
dbL("rotation2=", rotationCount); // displays 0

// waits until a key is pressed
dbKey();
}

Discussion

  • John Hansen

    John Hansen - 2007-08-22

    Logged In: YES
    user_id=661666
    Originator: NO

    This is one of several fields in the Output IOMap which are designed to be read only in the standard NXT firmware.

     
  • John Hansen

    John Hansen - 2007-08-22
    • status: open --> closed-rejected
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks