|
Page 1 of 1
|
[ 5 posts ] |
|
HiTechnic DC Motor Shaft Encoder Problem with RobotC
| Author |
Message |
|
cdvenkat
Rookie
Joined: Sun Sep 21, 2008 1:43 am Posts: 11
|
 HiTechnic DC Motor Shaft Encoder Problem with RobotC
We are trying to make Shaft encoders to work on RobotC 1.44. The listing below. Trying to run the motor until shaft encode reaches 1000. Motor is keeps running not stopping. Motors are working fine though. We mounted the the Shaft encoders as per instructions on the Shaft Encoders.
Connection: MotorE --> DC Motor Controller Motor2 and Enc2
Here is program, we are running. #pragma config(Hubs, S1, HTMotor, HTServo, none, none) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop, reversed) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, PIDControl) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { nMotorEncoder[motorE] = 0; nMotorEncoderTarget[motorE] = 1000; motor[motorE]=75; while(nMotorEncoder[motorE] < 1000) { nxtDisplayTextLine(1, "EV=%d", nMotorEncoderTarget[motorE] ); } wait10Msec(100); }
-C D Venkatesh
|
| Sun Nov 02, 2008 3:44 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: HiTechnic DC Motor Shaft Encoder Problem with RobotC
Your code never stops motorE.
_________________ Jeff McBride Benson Robotics Club
|
| Sun Nov 02, 2008 4:22 pm |
|
 |
|
cdvenkat
Rookie
Joined: Sun Sep 21, 2008 1:43 am Posts: 11
|
 Re: HiTechnic DC Motor Shaft Encoder Problem with RobotC
Thanks Jeff. I have tried that.., but still no use. Forgot to mention.., though, the Encoder Value I am printing is always zero. It appears, it is not reading the value at all. In "NXT Device Control Display", "Tach Limit" is saying 1000. But in the "NXT Device Control Display" window is showing as 1000. Other Tach numbers are zero. Appreciate your help.
I wonder what I am doing wrong..
Here is the new program. #pragma config(Hubs, S1, HTMotor, HTServo, none, none) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop, reversed) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, PIDControl) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { //nMotorEncoder[motorE] = 0; nMotorEncoderTarget[motorE] = 1000; motor[motorE]=75; while(nMotorEncoder[motorE] < 1000 ) { nxtDisplayTextLine(1, "EV=%d", nMotorEncoderTarget[motorE] ); wait10Msec(1); }
motor[motorE]=0; wait10Msec(100); }
|
| Sun Nov 02, 2008 8:53 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: HiTechnic DC Motor Shaft Encoder Problem with RobotC
If the MotorEncoder[] value is always zero then either there is something wrong with your shaft encoder or it isn't wired properly. Those encoders are very fragile. Are you positive that you assebled it correctly?
_________________ Jeff McBride Benson Robotics Club
|
| Mon Nov 03, 2008 12:12 am |
|
 |
|
cdvenkat
Rookie
Joined: Sun Sep 21, 2008 1:43 am Posts: 11
|
 Re: HiTechnic DC Motor Shaft Encoder Problem with RobotC
Thx. Jeff. we rechecked --> I think, we may have dis-assemble the Shaft encoder and try again. At least we know there nothing wrong with Robotc Program. -CD
|
| Mon Nov 03, 2008 12:14 pm |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|