Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....


Postby ken_alone » Mon Apr 05, 2010 10:35 am

I've bought a IFC-BH02 recently... So as usual, i tried to compile given source code to test with the main board and power card... But when i build a hex code with sample 1 bh-02,it built successfully... Though, when i burned the programming into MB00 and what i get was the beeps and error led with any switch pressed...
my question was :
1. Does it officially needs an encoder?
2. What was the flag functioned to base on the code below...
            // This is an infinity loop after SW3 on IFC-MB00 is pressed.
            // The two motors will running independently.
            // The speeds will increase and decrease gradually and then direction will be changed.
            // This program will running repeatedly until the reset button is pressed.

            temp1+=1;                  // increase temp1
            if(temp1>10000)               // the value of temp1 here will determine the
            {                        // acceleration of the motors, the bigger the value here,
                                    // the slower the speed of the increment or decrement
               temp1=0;               // clear temp1   
               if(speed1>=255)flag1=1;      // set flag 1 to 1 when maximum speed 1 is reached.
               else if(speed1<=0)         
                  flag1=0;                  // set [color=#800040]flag[/color] 1 to 0 when minimum speed 1 is reached.
                  dir1^=1;                  // change direction of motor 1 for
                  if(dir1==0)bh_1_ccw(add_bh1);   // every speed 1 is equal to 0.
                  else bh_1_cw(add_bh1);
               if(flag1==0)speed1++;      // increase speed 1 by one if flag 1 is 0.
               else speed1--;            // decrease speed 1 by one if flag 1 is 1.
               bh_1_speed(add_bh1,speed1);   // set motor 1 speed

               if(speed2>=255)flag2=1;      // set flag 2 to 1 when maximum speed 2 is reached.
               else if(speed2<=0)
                  flag2=0;                  // set flag 2 to 0 when minimum speed 2 is reached.
                  dir2^=1;                  // change direction of motor 2 for
                  if(dir2==0)bh_2_ccw(add_bh1);   // every speed 2 is equal to 0.
                  else bh_2_cw(add_bh1);
               if(flag2==0)speed2++;      // increase speed 2 by one if flag 2 is 0.
               else speed2--;            // decrease speed 2 by one if flag 2 is 1.
               bh_2_speed(add_bh1,speed2);   // set motor 2 speed

3.If it doesn't need an encoder, can i abort the SW2 programming which was related to encoder?
Posts: 34
Joined: Thu Dec 31, 2009 3:40 pm

Re: IFC_BH02

Postby A380 » Mon Apr 05, 2010 11:34 am

no encoder is needed for the sample program. make sure the address on your BH02 card is correct, 000010.
User avatar
Posts: 119
Joined: Tue May 19, 2009 2:44 pm
Location: Malaysia

Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 13 guests