15
Drive a Robot using 8085 Microprocessor kit Robot: A Robot is an entity designed for some specific task. The science of robots is called robotics. Task: The task assigned was to drive a robot using the 8255A in the microprocessor kit. To drive means to move the robot in the forward and backward direction and also to turn it in clockwise and anticlockwise manner. Articles used: The microprocessor kit Supply voltage source 2 cars driven by DC motors Adapter to convert 220V Ac into 12V Dc IC 7805 to convert 12V into 5V L293D the H bridge driver Soldering iron Wires Verroboard

Robot

Embed Size (px)

Citation preview

Page 1: Robot

Drive a Robot using 8085 Microprocessor kit

Robot: A Robot is an entity designed for some specific task. The science of robots is called robotics.

Task: The task assigned was to drive a robot using the 8255A in the microprocessor kit. To drive means to move the robot in the forward and backward direction and also to turn it in clockwise and anticlockwise manner.

Articles used:

The microprocessor kit Supply voltage source 2 cars driven by DC motors Adapter to convert 220V Ac into 12V Dc IC 7805 to convert 12V into 5V L293D the H bridge driver Soldering iron Wires Verroboard

Page 2: Robot

How to start:

Phase 1: Collecting the materials needed

Two toy cars (as is figure 1) driven by Dc motors are bought from the market. Each cost around Rs 60. (After a lot of bargaining ).

Figure 1

Then the Ics and adapter were bought from the market. The cost of the respective items wereIC 7805 Rs 6IC L293D Rs 65Adapter Rs 220

The laboratory provided the Processor kit, the soldering iron and the wires.

Phase 2: Building the base

A knife was used to break the toy car. Inside the toy car two tyres on one side are connected with a motor and a gearbox. So these portions of the two cars were joined together to get the base of the robot. The base now has two pairs of tyres, each pair driven by a DC motor and a gearbox

Page 3: Robot

associated with it. On it was placed a pitch board and our base is now ready.

Phase 3: Design

Actuators:-

Actuators are devices, which transform an input electrical signal into mechanical motion. In our distance-tracking robot the actuator used is the D.C motor as they are very easy to implement. The main issue of the design is mainly concentrated on controlling the speed and torque of the D.C motor to track the white path accurately

In this design a greater torque is required which is achieved from high-speed D.C motor by using gearbox. These gear boxes trades off the speed to achieve greater torque.

Page 4: Robot

a DC Motor Specifications

Operating Voltage: Recommended voltage for powering the motor.

Operating Current: Current drawn at a certain load on the shaft.

Stall Current: Maximum current drawn, when motor not allowed rotating.

Stall Torque: Rotation force needed to hold the motor in stall condition.

b DC Motor Characteristics

Free running torque & current are ideally zero Increased load implies, increased torque, current

drawn & power consumption Power supplied by a motor is the product of output

shaft’s rotational velocity & torque DC Motors are high–speed, low-torque devices. Using gears, the high speed of the motor is traded

off into torque. Zero speed at maximum load (stall torque) Highest speed while free running (zero load) Highest power at half speed & half load.

c DC Motor Drivers

Drivers are the circuitry used to control the speed and direction of rotation of the motor.

Direction control is done by using H-Bridge circuits which closes the corresponding switches so as to move the

motor clockwise or anticlockwise.

S1 S2 S3 S4 Current Direction

Effect

1 0 0 1 1 to 2 Motor spins forward

0 1 1 0 2 to 1 Motor spins backward

1 1 1 1 - Braking Occurs

0 0 0 0 - Free running

Page 5: Robot

PWM is a technique using which we can modify the duty cycle of a waveform depending upon an input control voltage. This forms the backbone of our speed control circuit. But in our application this technique was not implemented.

d DC MOTOR DRIVER IC:- The DC motor driver IC used to drive the two dc motors is L293D. The L293D is a quadruple high-current half-Hdriver designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V.

e CIRCIT DIAGRAM:-

Page 6: Robot

f PIN CONFIGURATION:- g PICTURE OF DRIVER IC

Circuit diagram

Page 7: Robot

ALGORITHM

The Algorithm implemented in the 8085 microprocessor kit to drive the DC Motor is as shown:

1) Busy Wait for a Key Press

2) Detects a Key Pressed

3) Identify the Key

4) Passes Control to the Appropriate Subroutine

5) go back to 1 unless the Exit Key was identified in step 3

Page 8: Robot

Assembly Code and Listing

0001 0000 0002 0000 .ORG 2000h0003 2000 31 00 29 LXI SP, 2900H ;Initialise the Stack Pointer0004 2003 3E 08 MVI A,08h0005 2005 20 RIM0006 2006 CD 32 20 KBREAD: CALL RDKBD ;READ KEYBOARD FUNCTION0007 2009 0008 2009

;USING THE KEYBOARD AS JOYSTICK :The following key patterns are used

; 9-->The BOT will be driven toward the Front; 4-->The BOT will be turned toward the Left; 6-->The BOT will be turned toward the Right; 1-->The BOT will be driven backward; 5-->The Exit Code. This will result into Program Termination

; 9; 4 5 6; 1

;Given below is the assembly code that checks the key-value. This is analogous to switch-case programming structure in C

0023 2009 FE 09 CPI 09h ;compare with key value 090024 200B CC 00 21 CZ FRONT ;If matched call the subroutine FRONT0025 200E CA 06 20 JZ KBREAD ;Go back to Read the Keyboard0026 2011

Page 9: Robot

0027 2011 0028 2011 FE 01 CPI 01h ;compare with key value 010029 2013 CC 1E 21 CZ BACK ;If matched call the subroutine BACK0030 2016 CA 06 20 JZ KBREAD ;Go back to Read the Keyboard0031 2019 0032 2019 FE 06 CPI 06h ;;compare with key value 010033 201B CC 3C 21 CZ RIGHT ;If matched call the subroutine RIGHT0034 201E CA 06 20 JZ KBREAD0035 2021 0036 2021 FE 04 CPI 04h0037 2023 CC 5A 21 CZ LEFT0038 2026 CA 06 20 JZ KBREAD0039 2029 0040 2029 FE 05 CPI 05h0041 202B CA 31 20 JZ EXIT;If Key 5 was pressed Exit 0042 202E C3 06 20 JMP KBREAD0043 2031 0044 2031 76 EXIT: HLT0045 2032

;Subroutines FRONT , BACK , RIGHT , LEFT are described below ;These Subroutines interface the 8085 kit with the DC Motor Interfacing Driver IC ( we have used L293D )via the 8255 chip.

; 8255 INTERFACING CHIP HAVE BEEN USED IN MODE 0(ZERO) FOR OUR APPLICATION

;PORT B has been used by our application for Output .So the A register has been initialised with the control word 90H

; A ---> 10010000 ; The data sent via the control port XX03H .Here XX=00

; The data to be sent to the output port for the SUBROUTINE FRONT is A0H (10100000) [ Refer to the L293D Pin Configuration]

Page 10: Robot

; The data to be sent to the output port for the SUBROUTINE BACK is 50H(01010000);The data to be sent to the output port for the SUBROUTINE RIGHT is 60H(01100000);The data to be sent to the output port for the SUBROUTINE LEFT is 90H(10010000)

;This data is sent via the control port XX02H . Here XX=00;For each subroutine C has been initialised as a counter, with initial value of 50 . ;This has to be manipulated during the TESTING PHASE to get the desired accuracy

0069 2035 0070 2035 0071 2035 .ORG 2100H0072 2100 0073 2100 0074 2100 FRONT:0075 2100 ; Save the machine registers by pushing them inside the stack.0080 2100 F5 PUSH PSW 0081 2101 C5 PUSH B0082 2102 00 NOP0083 2103 D5 PUSH D0084 2104 0085 2104 3E 90 MVI A,90H ;Control word0086 2106 32 03 00 STA 0003H ;Control Port0087 2109 0E 50 MVI C,50H ;Counter value0088 210B 0089 210B 3E A0 MVI A,0A0H;Output Data0090 210D 32 02 00 STA 0002H ;Data transferred to the 8255

;Once a value is set at PORT B wait till the counter reduces to Zero;Reset the PORT B after the work is done

Page 11: Robot

0095 2110 0D LOOP_F: DCR C0096 2111 C2 10 21 JNZ LOOP_F0097 2114 0098 2114 3E 00 MVI A,00H ;Reset0099 2116 32 02 00 STA 0002H0100 2119 0101 2119 ;Job is done.Restore the machine register before passing the control to the Calling Function0102 2119 0103 2119 D1 POP D0104 211A 00 NOP0105 211B C1 POP B0106 211C F1 POP PSW0107 211D C9 RET ;Return the Calling Function0108 211E 0109 211E 0110 211E 0111 211E F5 BACK: PUSH PSW0112 211F C5 PUSH B0113 2120 00 NOP0114 2121 D5 PUSH D0115 2122 0116 2122 3E 90 MVI A,90H ;Control word0117 2124 32 03 00 STA 0003H ;Control Port0118 2127 0E 50 MVI C,50H ;Counter value0119 2129 0120 2129 3E 50 MVI A,50H;Output PORT B0121 212B 32 02 00 STA 0002H0122 212E 0123 212E ;Decrement to Zero0124 212E 0D LOOP_B: DCR C0125 212F C2 2E 21 JNZ LOOP_B0126 2132 0127 2132 3E 00 MVI A,00H;Reset PORT B to Zero0128 2134 32 02 00 STA 0002H0129 2137 0130 2137 D1 POP D0131 2138 00 NOP0132 2139 C1 POP B0133 213A F1 POP PSW0134 213B C9 RET

Page 12: Robot

0135 213C 0136 213C F5 RIGHT: PUSH PSW0137 213D 0138 213D C5 PUSH B0139 213E 00 NOP0140 213F D5 PUSH D0141 2140 0142 2140 3E 90 MVI A,90H ;Control word0143 2142 32 03 00 STA 0003H ;Control Port0144 2145 0E 50 MVI C,50H ;Counter value0145 2147 0146 2147 3E 60 MVI A,60H;Output Data0147 2149 32 02 00 STA 0002H0148 214C 0D LOOP_R: DCR C0149 214D C2 4C 21 JNZ LOOP_R0150 2150 3E 00 MVI A,00H0151 2152 32 02 00 STA 0002H0152 2155 0153 2155 D1 POP D0154 2156 00 NOP0155 2157 C1 POP B0156 2158 0157 2158 F1 POP PSW0158 2159 C9 RET

0163 215A F5 LEFT: PUSH PSW0164 215B 0165 215B C5 PUSH B0166 215C D5 PUSH D0167 215D 0168 215D 3E 90 MVI A,90H ;Control word0169 215F 32 03 00 STA 0003H ;Control Port0170 2162 0E 50 MVI C,50H ;Counter value0171 2164 0172 2164 3E 90 MVI A,90H;Output Data0173 2166 32 02 00 STA 0002H0174 2169 0175 2169 0D LOOP_L: DCR C0176 216A C2 69 21 JNZ LOOP_L0177 216D 3E 00 MVI A,00H0178 216F 32 02 00 STA 0002H0179 2172 0180 2172 D1 POP D

Page 13: Robot

0181 2173 C1 POP B0182 2174 F1 POP PSW0183 2175 C9 RET0184 2176