12.07.2015 Views

Programming Manual Elektor Proton Robot - ELEKTOR.se

Programming Manual Elektor Proton Robot - ELEKTOR.se

Programming Manual Elektor Proton Robot - ELEKTOR.se

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Speed1 RegisterDepending on what mode you are in, this register can affect the speed of one motor or bothmotors. If you are in mode 0 or 1 it will <strong>se</strong>t the speed and direction of motor 1. The largerthe number written to this register, the more power is applied to the motor. A mode of 2 or3 will control the speed and direction of both motors (subject to effect of turn register).Speed2/Turn RegisterWhen in mode 0 or 1 this register operates the speed and direction of motor 2. When inmode 2 or 3 Speed2 becomes a Turn register, and any value in this register is combined withthe contents of Speed1 to steer the device (<strong>se</strong>e below).Turn modeTurn mode looks at the speed1 register to decide if the direction is forward or rever<strong>se</strong>. Thenit applies a subtraction or addition of the turn value on either motor.so if the direction is forwardmotor speed1 = speed - turnmotor speed2 = speed + turnel<strong>se</strong> the direction is rever<strong>se</strong> somotor speed1 = speed + turnmotor speed2 = speed - turnIf the either motor is not able to achieve the required speed for the turn (beyond themaximum output), then the other motor is automatically changed by the program to meetthe required difference.Encoder registersEach motor has its encoder count stored in an array of four bytes, together the bytes form asigned 32 bit number, the encoder count is captured on a read of the highest byte (registers2, 6) and the sub<strong>se</strong>quent lower bytes will be held until another read of the highest bytetakes place. The count is stored with the highest byte in the lowest numbered register. Theregisters can be zeroed at any time by writing 32 (0x20) to the command register.Battery voltsA reading of the voltage of the connected battery is available in this register. It reads as 10times the voltage (121 for 12.1v).Motor 1 and 2 currentA guide reading of the average current through the motor is available in this register. It readsapprox ten times the number of Amps (25 at 2.5A).Software Revision numberThis register contains the revision number of the software in the modules PIC16F873controller - currently 1 at the time of writing.Acceleration RateIf you require a controlled acceleration period for the attached motors to reach thereBart Huyskens <strong>Manual</strong> <strong>Elektor</strong> <strong>Proton</strong> V1.0 3 April 2011 76

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!