Microcontroller Based Bi-Directional Motor With Pushbutton Controller
Get Price Quote
The circuit shown below is of an 89S51 based bi directional motor whose direction can be controlled using 2 push button switches. The circuit is very similar to the previous one except for the two push button switches. These pushbutton switches are interfaced to P0rt 3 of the microcontroller. Resistors R2 and R3 are the pull down resistors for P3.0 and 3.1 respectively. Push button controlled bi-directional DC motor the code for the above project is so written that initially when power is switched ON, the motor remains OFF. When push button switch S2 is pressed P1.0 goes high and P1.1 remains low. The motor run in the clockwise direction and this condition is maintained until S3 is pressed. When push button switch S3 is pressed the logic of P1.0 and P1.1 toggles making the motor to run in the opposite direction and this condition is maintained until the next press of S2. We are a reliable Manufacturer and Supplier of Microcontroller (89S51) Based Bi-Directional Motor With Pushbutton Controller in India. Program : Org 00h // Initial Starting Address Mov P3,#00000000b // Initiates P3 As The Pushbutton Interface Mov P1,#00000000b // Clears P1 For Keeping The Motor Off Initially Main: Mov A,P3 // Moves The Current State Of P3 To Accumulator Cjne A,#00000001b,Label1 // Checks Whether S2 Is Pressed Mov P1,#00000001b // Makes The Motor Run Clockwise Label1:Cjne A,#00000010b,Label2 // Checks Whether S3 Is Pressed Mov P1,#00000010b // Makes The Motor To Run Anti Clockwise Label2:Sjmp Main // Jumps Back To The Main Loop End About the program :Checking whether a particular push button is pressed is done using the CJNE (compare and jump if not equal) instruction. In simple words the CJNE instruction compares two operands and jump to a predefined LABEL if the operands are not equal. If the two operands are equal nothing happens and the next instruction is executed. Whenever push button S2 is pressed the status of P3 will be 00000001B .This status is moved to accumulator A and compared with 00000001B using the CJNE instruction. Both operands are equal means S2 is pressed and the next instruction (MOV P1,#00000001B)which makes the motor run clockwise is executed. If the operands are not equal that means the S2 is not pressed and the controller jumps to LABEL1 which is to check the S3. To check S3, status of P3 is moved to A again and it is compared with 00000010B using the CJNE instruction. Both operands are equal means the S3 is pressed and the next instruction (MOV P1,#00000010B) which makes the motor run anti clockwise is executed. Both operands are not equal means S3 is not pressed and the controller goes to check S2 again and this cycle is repeated.
Led Panel Light
Get Price Quote
Best Deals from Electronic Active Devices
Led Panel Light
4,660 Per Piece
Led Panel Light
Get Price Quote
Led Panel Light, Led Lights, Led Downlight, canopy lights, Tubelights