Upload
adamwaiz
View
216
Download
0
Embed Size (px)
Citation preview
8/2/2019 Lembaran amali 6_dis10
1/7
Lab6/ACS/E5123/_______
LAB NO. ; 6
TITLE : ROBOTIC ARM PROGRAMMING
OBJECTIVE : i. To introduce the basic programming of robotic arm.
ii. To familiarize the students with the basic program which produce servo motor
rotation for each axis.
iii. To familiarize the students with the program code downloading to MCU
procedures.
EQUIPMENTS: Laptop, robotic arm ABLELOGIC RBT-500A and PIC-PRG2 USB PIC programmer.
THEORY :
SERVO MOTOR:
A servo motor is an electromechanical device in which an electrical input determines the position of
the armature of a motor. A normal servo is applied to control an angular motion of between 0 and 180 degrees
for each axis. Servo is controlled by sending a pulse of variable width or PWM. The control wire is used to send
this pulse which is usually yellow in color while the black wire will be GND and the red color will be VCC. The
servo motor expects to see a pulse every 20 ms. The width of the pulse will determine the turning angle of theservo motor.
20 ms
20 ms
20 ms
1 ms
1.5 ms
2 ms
0 degree
neutral
180 degree
Neutral is defined to be the position where the servo has exactly the same amount of potential
rotation in the clockwise direction as it does in the counter clockwise direction. It is important to note that
different servos will have different constraints on their rotation but they all have a neutral position and that
position is always around 1.5 ms.
PROGRAM THE ROBOTIC ARM:
The operation of all the robotic arm servos are all controlled by a microcontroller board which is
located and mounted inside the main base unit(not visible to user). A PIC16F877A MCU is used to run programs
that control the operation of the motors. In order to program this robotic arm to run users own written
program, PIC-PRG2 USB PIC programmer will be used to download users program to the MCU via the ICSP
interface port.
1/7
8/2/2019 Lembaran amali 6_dis10
2/7
Lab6/ACS/E5123/_______
BASIC STEPS IN USING THE PIC-PROG2 USB PROGRAMMER:
1. Please ensure to push the ICSP switch to the PROGRAM position.2. Plug in the USB cable to the PC.
3. Open the WinPic800 software.
4. The software language can be chose at the language tab.
5. Then, click the Setting tab follow by hardware as shown in the figure below.
2/7
8/2/2019 Lembaran amali 6_dis10
3/7
Lab6/ACS/E5123/_______
6. Make sure the hardware setting is as below. Then, click Apply edits.
7. Please ensure 16f877a is shown in PIC family selection.
8. Then, click the File tab follow by Open to select desired hex file.9. Click Program icon to program the IC.
10. Finally, push the ICSP switch to the RUN position and observe the resulting movement.
3/7
8/2/2019 Lembaran amali 6_dis10
4/7
Lab6/ACS/E5123/_______
PROCEDURE :
1. Open the MicroCode Studio software.
2. Then, click the File tab follow by New.3. Write down the given program in the untitled window.
4. Then, click the Project tab follow by Compile.5. Download the hex file into PIC16F877a.6. Show the resulting movement to your labs instructor to get their endorsement for each experiment.
EXPERIMENT 1:
Base VAR BYTE
TRISB=0
PORTB=0
Base = 80
loop:
PULSOUT PORTB.1,Base
PAUSE 20
goto loop
Lecturer signature: Date:
EXPERIMENT 2:
Base VAR BYTE
TRISB=0
PORTB=0
Base = 210
loop:
PULSOUT PORTB.1,Base
PAUSE 18
goto loop
Lecturer signature: Date:
4/7
8/2/2019 Lembaran amali 6_dis10
5/7
Lab6/ACS/E5123/_______
EXPERIMENT 3:
temp VAR BYTE
Base VAR BYTE
TRISB=0
PORTB=0
loop:
FOR temp = 0 TO 150
Base = 80
PULSOUT PORTB.1,Base
PAUSE 20
NEXT
FOR temp = 0 TO 150
Base = 200PULSOUT PORTB.1,Base
PAUSE 18
NEXT
goto loop
Lecturer signature: Date:
EXPERIMENT 4:
temp VAR BYTEShoulder VAR BYTE
TRISB=0
PORTB=0
loop:
FOR temp = 0 TO 150
Shoulder = 170
PULSOUT PORTB.2,Shoulder
PAUSE 20
NEXT
FOR temp = 0 TO 150
Shoulder = 230
PULSOUT PORTB.2,Shoulder
PAUSE 18
NEXT
goto loop
5/7
8/2/2019 Lembaran amali 6_dis10
6/7
Lab6/ACS/E5123/_______
Lecturer signature: Date:
EXPERIMENT 5:
temp VAR BYTE
Elbow VAR BYTE
Supporter VAR BYTE
TRISB=0
PORTB=0
loop:
FOR temp = 0 TO 150
Elbow = 100
Supporter = 210
PULSOUT PORTB.3,Elbow
PULSOUT PORTB.2,SupporterPAUSE 20
NEXT
FOR temp = 0 TO 150
Elbow = 210
Supporter = 210
PULSOUT PORTB.3,Elbow
PULSOUT PORTB.2,Supporter
PAUSE 18
NEXT
goto loop
Lecturer signature: Date:
6/7
8/2/2019 Lembaran amali 6_dis10
7/7
Lab6/ACS/E5123/_______
DISCUSSIONS :
1. Discuss the movement of robotic arm for each experiment above.
CONCLUSION :
1. Write the conclusion for this experiment with your own words.
7/7