Page 5 of 5

Re: New BricxCC and NBC/NXC release

Posted: 19 Mar 2011, 04:23
by mattallen37
I seem to be able to open it perfectly with the release from last summer (3.3.8.7). However, this program won't open without crashing that release.

Code: Select all

#define SHORT_WAIT 3                //short wait for value to stabilize

int A,B,C,E,AF,BF,CF,EF,Final;                             //global

task main()
{

  SetUserDisplay (Final,0);
  SetSensor (SENSOR_1, SENSOR_TOUCH);
  Wait (100);
  SetSensor(SENSOR_1, SENSOR_LIGHT);    //power on sensor by making it light type
  SetSensorType (SENSOR_2, SENSOR_TYPE_TOUCH);
  while (true)                      //loop forever
  {
    if (SENSOR_1== 100)
  {
        SetSensor(SENSOR_1, SENSOR_TOUCH);
        SetSensor(SENSOR_1, SENSOR_LIGHT);
        Wait(SHORT_WAIT);
   }


    A = SENSOR_1*1;                   //read the A and scale by 1

    SetSensor(SENSOR_1, SENSOR_TOUCH);  //toggle power to change to channel 2
    SetSensor(SENSOR_1, SENSOR_LIGHT);
    Wait(SHORT_WAIT);
    B = SENSOR_1*1;                   //read the B and scale by 1

    SetSensor(SENSOR_1, SENSOR_TOUCH);  //toggle power to change to channel 3
    SetSensor(SENSOR_1, SENSOR_LIGHT);
    Wait(SHORT_WAIT);
    C = SENSOR_1*1;                   //read the C and scale by 1

    SetSensor(SENSOR_1, SENSOR_TOUCH);  //toggle power to change to channel 0
    SetSensor(SENSOR_1, SENSOR_LIGHT);

    if (A == 0) { AF = 0; }
    else{ AF = 1; }

    if (B == 0) { BF = 0; }
    else { BF = 10; }

    if (C == 0) { CF = 0; }
    else{ CF = 100; }

    EF = 1000;
    Final = AF + BF + CF + EF;
  }

}


I have the programs saved as .nqc files. When I go to open a program, the default type is NXC, so I have to click on the dropdown menu and select NQC. Yes I did recently change to tabbed mode. Should I switch back to MDI and see what happens?

Re: New BricxCC and NBC/NXC release

Posted: 19 Mar 2011, 04:25
by muntoo
afanofosc wrote:You did recently switch from MDI mode to tabbed mode, didn't you?
10 Days, 23 Hours, and 52 minutes ago.

Muntoo "still trying to win next year's prolific poster award" ;)

Re: New BricxCC and NBC/NXC release

Posted: 19 Mar 2011, 04:29
by mattallen37
muntoo wrote:...Muntoo "still trying to win next year's prolific poster award" ;)
LOL

Keep trying, and the banhammer will swing for the first time (I think first anyhow) :lol:

Re: New BricxCC and NBC/NXC release

Posted: 19 Mar 2011, 04:36
by mattallen37
Okay,I switched to MDI mode, and so far so good (tried with both versions of BCC). I opened 20 programs (that's all I have on this computer so far), and it didn't crash once :D Hopefully my success won't be short-lived.

Re: New BricxCC and NBC/NXC release

Posted: 19 Mar 2011, 07:17
by slavkozn
afanofosc wrote:I will correct the source archive.
OK, thanks

Edit: i was success, the packages uploaded in my repo (http://slavino.sk/ulozisko-apt) for both (i386, amd64) archs.

Re: New BricxCC and NBC/NXC release

Posted: 21 Mar 2011, 19:22
by schodet
Hello,

Thanks for including absolute regulation!

Here is some precision about questions I have seen:

About SetMotorRegulationTime: this can be used to change the interval between regulation update. You really should reduce it to 10 ms to use absolute regulation. More details.

About SetMotorRegulationOptions: this provides advanced control on the control loop. The default firmware code will limit P term and I term of the PID algorithm to 50 % of the output power. If you want a pure P control loop for example, this is not optimal. Using the OUT_REGOPTION_NO_SATURATION options, the limit is removed and you can reach full motor power with only the P part.

About MaxSpeed: this is between 0 and 100. 0 is a special value which means "no limit, no speed control".

About MaxAcceleration: this is also between 0 and 100. 0 is a special value which means "no acceleration control, always use max speed". For any other value, MaxSpeed should be set. You will usually use small Acceleration values or else the effect will be unnoticed.

There is a tutorial here.