| The oDCMotor2 Object monitors the Speed and the Brake properties, and based on their numeric values controls the power, polarity, and braking properties of a oHBridgeH object which in turn control a physical H-Bridge motor driver circuit connected to the motor. When the oDCMotor2 object is initialized, it configures the oHBridgeH object to use the L293D H-Bridge by setting the oHBridgeH object's properties. It then sets the oDCMotor2 object's properties as specified in the arguments to the Init method.
The Speed property controls the speed of the motor. When operating, a 0 in the Speed property will cause the motor to be at a full stop. If the Speed property is greater than 0, then the DC Motor will go forward at a speed specified by the Speed property. The higher the number (up to 127), the faster the motor will turn. If the Speed property is less than 0, then the DC Motor will go backwards at a speed specified by the Speed property. The lower the number (down to negative 128), the faster the motor will turn in reverse. The actual direction that the DC Motor spins when going in the "forward" direction can be reversed by setting the Invert property. When the Brake property is set to 1, the L293D H-Bridge is set in such a way that the motor to generate power back into itself, effectively driving itself back the other way which causes it to come to an abrupt stop without the need for mechanical braking. The Operate property specifies if the motor is on or off. When the Operate property is set to 1 the L293D H-Bridge is set to drive the motor. When the Operate property is set to 0 the L293D H-Bridge is reconfigured and the motor stops. The HBridge property is an instance of the oHBridgeH object which is created when the oDCMotor2 object is. The oDCMotor2 object configures the oHBridgeH object in such a way that it will provide the proper I/O control of the L293D H-Bridge that is connected to the DC Motor. Attributes of the motor's operation can be adjusted by directly manipulating the oHBridgeH object. Note that doing so may change the way the motor behaves to something different than the way described in this document. (see oHBridgeH object for more detail) The maximum number of oDCMotor objects that can be dimensioned in a single application program is 2, limited only be the number of PWM channels available in the ooPIC. |