Sunday, June 20, 2010





Robotic Stacker as the name implies, it is use to stack object preferably on any slot of a shelves which is applicable in warehouses. This project is composed of 3 main parts: the main system, the shelf and the 2 object platform.
The main system is connected to a decoder which is also connected to a computer machine that runs the program for the main system. It is composed of:
· 5 stepper motor, which is use in the movement of the gripper, subarm, movement for vertical, horizontal and 90 rotation.
· A total of 20 relays connected together with other components (transistor, resistor and diode) which are primarily use to control the stepper motor.
· Thread, use as a guide for vertical movement of the gripper.
· Belt, use as a guide for horizontal movement the main arm.
· Input Switches, use for selecting a particular slot on the shelf where the operator intends to put or get the object. One switch serves as the exit path for terminating the program of the main system.
The shelf is use as a storing medium of the main system where objects are being put or get. It is composed of 12 available slots which each have its own Light Emitting Diode (LED). This LED corresponds to the switch selected by the operator, it will also serve as a guide for the operator to see on what slot the object will be put or get.
The 2 object platform, serves as the starting point for the main system. In the 1st platform the object will be place there for the main system to get a hold and put in the shelf. The 2nd platform will hold the object that has been obtained by the main system from the shelf.
This robotic stacker was design to perform specific tasks that was program to it. It can store 12 objects to any available slot of the shelf that was selected by the operator. It is able to show to the operator through a LED indicator where it intends to put or get the object on the particular slot of the shelf. The main arm is able to move horizontally and is able to rotate a total of 180® clockwise and counterclockwise. The subarm is able to move vertically and can move the gripper forward and backward.
The gripper is only able to grip 1” square box as much as the shelf can accept it. Because of the limitation of having the fine thread, the vertical movement of the system is very slow. In addition to that is the weight of the gripper and the subarm, limits the motor to be configured to use higher gears for faster movement. The shelf also was limited only to accepting and storing the object as it contain no sensors to detect object that was put in its slot.

OBJECTIVE OF THE DESIGN PROJECT
===To apply the knowledge, skills and the application of all our learning's from beginning of our stay in the college.
===To create a Robotic Arm system that is capable of following task:
=== Able to put the object in any empty slot of the shelf according to what number the user inputted using the switch.
===Able to get the object in any filled slot of the shelf according to what number the user inputted using the switch.

SCOPE AND LIMITATION
This robotic stacker was design to perform specific tasks that was program to it. It can store 12 objects to any available slot of the shelf that was selected by the operator. It is able to show to the operator through a LED indicator where it intends to put or get the object on the particular slot of the shelf. The main arm is able to move horizontally and is able to rotate a total of 180® clockwise and counterclockwise. The subarm is able to move vertically and can move the gripper forward and backward.

The gripper is only able to grip 1” square box as much as the shelf can accept it. Because of the limitation of having the fine thread, the vertical movement of the system is very slow. In addition to that is the weight of the gripper and the subarm, limits the motor to be configured to use higher gears for faster movement. The shelf also was limited only to accepting and storing the object as it contain no sensors to detect object that was put in its slot.

OPERATING PROCEDURE
1. ISA connector of the decoder must be connected to the ISA slot of the motherboard.

2.      Output port of the decoder must be connected to the 12 LEDs and 20 relays enable to control 5 stepper motors.
      Input port of the decoder must be connected to the 15   available switches of the system.
3. By turning the supply of the system, press F8 and the boot selection menu will be displayed.

                                    
            Select Command prompt only
       Type the file name (stacker) of the program.
 

 PUT OBJECT


  There are 3 switches that serve as, GET switch, PUT switch and the EXIT switch.  The user will select a button what will the robot will do (if the robot will put the object in the empty shelf or get the object inside a specific shelf).

4.       The user will press a PUT button and next press a number in a button pad (12 available buttons). Press P for PUT.

 
    The robotic stacker will get the object in the platform and put it in a blank slot of the shelf (12 available slots) according to the number the user selected in the button pad.


The LED in a particular envelope will turn ON the same with the number of the pressed button of the user shelf.

 If a number button is being pressed before GET or PUT button, the system will not respond.
 If a number button is being pressed twice, the system will respond to first action.

GET OBJECT

   5. The user will press a GET button and next press a number in a button pad (12 available buttons). Press G for GET.

   The LED in a particular slot on shelf will turn ON the same with the number of the pressed button of the user.
The robotic stacker will get the object in the slot of the shelf selected by the user in the button pad and put it in the platform.
 If a number button is being pressed before GET or PUT button, the system will not respond.
If a number button is being pressed twice, the system will respond to first action.
 EXIT
 
6. Press the EXIT Switch at the switch pad. The program will automatically terminate. Press E for exit.


LIST OF COMPONENTS

        INTEGRATED CIRCUITS
DM74LS244 - Octal 3-STATE Buffer/Line Driver/Line Receiver
DM74LS373 - 3-STATE Octal D-Type Transparent Latches and Edge Triggered Flip-Flops
DM74LS02 - Quad 2-input NOR
DM74LS1 - Triple 3-Input NAND Gate
DM74LS138 - Decoder/Demultiplexer
        STEPPER MOTOR



         SWITCH

         RELAY
 

         RESISTOR

        TRANSISTOR

        DIODE

        LED  


          CIRCUIT DIAGRAM 
16 BIT DECODER, OUTPUT PORT, INPUT PORT CIRCUIT DIAGRAM


       RELAY AND MOTOR CIRCUIT DIAGRAM


       LED CIRCUIT DIAGRAM



SWITCH CIRCUIT DIAGRAM



SYSTEM BLOCK DIAGRAM

 

SOFTWARE USED

    CIRCUIT SIMULATION SOFTWARE
Circuit Maker is a circuit simulation software that allows to design, analyze and test a circuit virtually on a computer. They simulate the behavior of an electronic device/circuit, and are often used because it is cheaper, quicker and often more practical to simulate a circuit than to physically build one. It provides either analogue ("analog") or digital simulation capabilities or has a schematic editor, a waveform viewer, support resistors, capacitors, diodes, etc.


 

PCB DESIGN SOFTWARE
PCB Designer provides design layout of printed circuit board (PCB) designs. All PCB design packages allow designing boards from the component side of the board.
PCB Designer allows you to create single, or double sided PCBs, up to 14" square, using the PhotoEtch principle. Its main features are Double and single sided PCB's, Four fixed sizes of round PCB pads, Four fixed widths of PCB track, Four fixed IC sizes, 8pin 14pin and 16pin and Custom sized IC's, any number of pins, at 0.1", 0.3" and 0.6" widths.It is ideally suited for use in educational establishments, for the home hobbyist and for small businesses. PCB Designer is a Microsoft Windows application that enables you to design masks for printed circuit boards. It is to make this process as easy as possible. The program acts like a sheet of paper, onto which you can place pads, tracks, IC's, etc.


     
    PROGRAMMING LANGUAGE
  Assembly language is commonly called assembly or asm, is a human-readable notation for the machine language that a specific computer architecture uses. Machine language, a pattern of bits encoding machine operations, is made readable by replacing the raw values with symbols called mnemonics.
 



FLOWCHART               Click here to see the flowchart.

SOURCE CODE            Click here to see the source code.





 RECOMMENDATIONS


Every design project has its own scope and limitation. And this design 
has also some limitation. For further improvement of this project, the 
group would like to recommend the following:
First, as we try to use ULN2003 to serve as a controller for the stepper 
motor, we find it impractical because as the operation goes by it 
becomes hotter and hotter thus affecting its performance. That’s why in 
this design project the group recommends to use a relay controller.
Second, use a bigger tooth thread for faster movement vertically. It is 
because fine thread limits the speed even if the motor rotate on its top 
speed.
Third, use a stronger stepper motor so that it can be configure through 
the gears to carry move weight.
Fourth, use sensors to detect object inside the self so that the system 
can recognize if that particular slot of that shelf have been occupied.
Lastly, use high level language for convenient in programming. 

REFERENCES


The Intel Microprocessor 8086/8088,80186
/80188,80286,80386,80486 Architecture, Programming and 
Interfacing 6th Edition by Barry B. Brey
Philippine Edition published by Pearson Education
South Asia PTE ltd., Copyright @ 2003
Digital Design by  Morris Mano
http://www.fairchildsemi.com
http://en.wikipedia.org/wiki/Resistor
http://en.wikipedia.org/wiki/Capacitor
http://en.wikipedia.org/wiki/Robotic_arm
http://en.wikipedia.org/wiki/Light-emitting_diode
http://en.wikipedia.org/wiki/Transistor
http://www.discovercircuits.com
http://www.allaboutcircuits.com
http://www.arduino.cc/en/Tutorial/Stepper 

DESIGN PICTURES


DECODER and SYSTEM UNIT


 

ROBOTIC ARM attach to the MAIN SYSTEM


 

PRIMARY CONTROL SWITCH


 

OBJECT PLATFORM


 

OBJECT SHELF


 

THIS DESIGN PROJECT is created by:

Jimmy E. Lumogdang II
Saturnino L. Serrano
Maricel Barcebal
Mc Laurence Saligumba

Saturday, June 19, 2010

SOURCE CODE Version 1.0 (Assembly Language Program)

page 60,132
title robotic arm
.model small
.stack 64
.data
.code
.486
begin proc far
        mov ax,@data
        mov ds,ax
start:                     ;----input for the start get or put operation                     
        call inf6
        cmp al,0dfh
        je put
        call inf7
        cmp al,0efh
        je get
        call inf6
        cmp al,7fh
        je exit
        jne start
exit:                    ;----for terminating the program
        mov ax,0000h
        call outf0
        call outf1
        call outf2
        call outf3
        call outf4
        mov ax,4c00h
        int 21h
;******************************************
put:                     ;----input for put
        call inf6
        cmp al,0fdh
        je slot1
        call inf7
        cmp al,0feh
        je slot2
        call inf6
        cmp al,0efh
        je slot3
        call inf6
        cmp al,0feh
        je slot4
        call inf6
        cmp al,0fbh
        je slot5
        call inf6
        cmp al,0bfh
        je slot6
        call inf7
        cmp al,0bfh
        je slot7
        call inf7
        cmp al,0dfh
        je slot8
        call inf7
        cmp al,0fbh
        je slot9
        call inf7
        cmp al,0f7h
        je slot10
        call inf7
        cmp al,0fdh
        je slot11
        call inf7
        cmp al,07fh
        je slot12
        jne put
;*****************************************
get:                    ;----input for get
        call inf6
        cmp al,0fdh
        je slotget1
        call inf7
        cmp al,0feh
        je slotget2
        call inf6
        cmp al,0efh
        je slotget3
        call inf6
        cmp al,0feh
        je slotget4
        call inf6
        cmp al,0fbh
        je slotget5
        call inf6
        cmp al,0bfh
        je slotget6
        call inf7
        cmp al,0bfh
        je slotget7
        call inf7
        cmp al,0dfh
        je slotget8
        call inf7
        cmp al,0fbh
        je slotget9
        call inf7
        cmp al,0f7h
        je slotget10
        call inf7
        cmp al,0fdh
        je slotget11
        call inf7
        cmp al,07fh
        je slotget12
        jne get
;********************************************
slot1:
        mov ax,01h
        call outf0
        call shelf1
        jmp start
slot2:
        mov ax,02h
        call outf0
        call shelf2
        jmp start

slot3:
        mov ax,04h
        call outf0
        call shelf3
        jmp start
slot4:
        mov ax,08h
        call outf0
        call shelf4
        jmp start
slot5:
        mov ax,10h
        call outf0
        call shelf5
        jmp start
slot6:
        mov ax,20h
        call outf0
        call shelf6
        jmp start
slot7:
        mov ax,40h
        call outf0
        call shelf7
        jmp start
slot8:
        mov ax,80h
        call outf0
        call shelf8
        jmp start
slot9:
        mov ax,10h
        call outf2
        call shelf9
        jmp start
slot10:
        mov ax,20h
        call outf2
        call shelf10
        jmp start
slot11:
        mov ax,40h
        call outf2
        call shelf11
        jmp start
slot12:
        mov ax,80h
        call outf2
        call shelf12
        jmp start
;**********************************************
slotget1:
        mov ax,01h
        call outf0
        call shelfget1
        jmp start
slotget2:
        mov ax,02h
        call outf0
        call shelfget2
        jmp start

slotget3:
        mov ax,04h
        call outf0
        call shelfget3
        jmp start
slotget4:
        mov ax,08h
        call outf0
        call shelfget4
        jmp start
slotget5:
        mov ax,10h
        call outf0
        call shelfget5
        jmp start
slotget6:
        mov ax,20h
        call outf0
        call shelfget6
        jmp start
slotget7:
        mov ax,40h
        call outf0
        call shelfget7
        jmp start
slotget8:
        mov ax,80h
        call outf0
        call shelfget8
        jmp start
slotget9:
        mov ax,10h
        call outf2
        call shelfget9
        jmp start
slotget10:
        mov ax,20h
        call outf2
        call shelfget10
        jmp start
slotget11:
        mov ax,40h
        call outf0
        call shelfget11
        jmp start
slotget12:
        mov ax,80h
        call outf0
        call shelfget12
        jmp start
;*********************************************
begin endp                      ;----begin procedure
shelf1 proc near                ;----put on slot1
        mov ax,00
        mov bx,00
shel1:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call subarmforward
        call ungrip
        call subarmback
        call rotateleft
        call clearled
        ret
shelf1 endp
shelf2 proc near                ;----put on slot2
        mov ax,00              
        mov bx,00
shel2:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call horizontal
        call subarmforward
        call ungrip
        call subarmback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelf2 endp
shelf3 proc near                ;----put on slot3
        mov ax,00
        mov bx,00
shel3:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call horizontal
        call horizontal
        call subarmforward
        call ungrip
        call subarmback
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelf3 endp
shelf4 proc near                ;----put on slot4
        mov ax,00
        mov bx,00
shel4:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call rotateleft
        call clearled
        ret
shelf4 endp
shelf5 proc near                ;----put on slot5
        mov ax,00
        mov bx,00
shel5:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call horizontal
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call horizontalback
        call rotateleft
        call clearled
        ret
shelf5 endp
shelf6 proc near                ;----put on slot6
        mov ax,00
        mov bx,00
shel6:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call horizontal
        call horizontal
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelf6 endp
shelf7 proc near                ;----put on slot7
        mov ax,00
        mov bx,00
shel7:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call up
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call down
        call rotateleft
        call clearled
        ret
shelf7 endp
shelf8 proc near                ;----put on slot8
        mov ax,00
        mov bx,00
shel8:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call horizontal
        call up
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call down
        call horizontalback
        call rotateleft
        call clearled
        ret
shelf8 endp
shelf9 proc near                ;----put on slot9
        mov ax,00
        mov bx,00
shel9:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call horizontal
        call horizontal
        call up
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call down
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelf9 endp
shelf10 proc near               ;----put on slot10
        mov ax,00
        mov bx,00
shel10:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call up
        call up
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call down
        call down
        call rotateleft
        call clearled
        ret
shelf10 endp
shelf11 proc near               ;----put on slot11
        mov ax,00
        mov bx,00
shel11:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call horizontal
        call up
        call up
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call down
        call down
        call horizontalback
        call rotateleft
        call clearled
        ret
shelf11 endp
shelf12 proc near               ;----put on slot12
        mov ax,00
        mov bx,00
shel12:
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call horizontal
        call horizontal
        call up
        call up
        call up
        call subarmforward
        call ungrip
        call subarmback
        call down
        call down
        call down
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelf12 endp
;*************************************************
shelfget1 proc near             ;----get on slot1
        mov ax,00
        mov bx,00
shelget1:
        call rotateright
        call subarmforward
        call gripp
        call subarmback
        call horizontal
        call horizontal
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget1 endp
shelfget2 proc near             ;----get on slot2
        mov ax,00
        mov bx,00
shelget2:
        call rotateright
        call horizontal
        call subarmforward
        call gripp
        call subarmback
        call horizontal
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget2 endp
shelfget3 proc near             ;----get on slot3
        mov ax,00
        mov bx,00
shelget3:
        call rotateright
        call horizontal
        call horizontal
        call subarmforward
        call gripp
        call subarmback
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget3 endp
shelfget4 proc near             ;----get on slot4
        mov ax,00
        mov bx,00
shelget4:
        call rotateright
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call horizontal
        call horizontal
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget4 endp
shelfget5 proc near             ;----get on slot5
        mov ax,00
        mov bx,00
shelget5:
        call rotateright
        call horizontal
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call horizontal
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget5 endp
shelfget6 proc near             ;----get on slot6
        mov ax,00
        mov bx,00
shelget6:
        call rotateright
        call horizontal
        call horizontal
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget6 endp
shelfget7 proc near             ;----get on slot7
        mov ax,00
        mov bx,00
shelget7:
        call rotateright
        call up
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call down
        call horizontal
        call horizontal
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget7 endp
shelfget8 proc near             ;----get on slot8
        mov ax,00
        mov bx,00
shelget8:
        call rotateright
        call horizontal
        call up
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call down
        call horizontal
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget8 endp
shelfget9 proc near             ;----get on slot9
        mov ax,00
        mov bx,00
shelget9:
        call rotateright
        call horizontal
        call horizontal
        call up
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call down
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget9 endp
shelfget10 proc near            ;----get on slot10
        mov ax,00
        mov bx,00
shelget10:
        call rotateright
        call up
        call up
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call down
        call down
        call horizontal
        call horizontal
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget10 endp
shelfget11 proc near            ;----get on slot11
        mov ax,00
        mov bx,00
shelget11:
        call rotateright
        call horizontal
        call up
        call up
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call down
        call down
        call horizontal
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget11 endp
shelfget12 proc near            ;----get on slot12
        mov ax,00
        mov bx,00
shelget12:
        call rotateright
        call horizontal
        call horizontal
        call up
        call up
        call up
        call subarmforward
        call gripp
        call subarmback
        call down
        call down
        call down
        call rotateright
        call ungrip
        call rotateleft
        call horizontalback
        call horizontalback
        call rotateleft
        call clearled
        ret
shelfget12 endp
;*********************************************
up proc near                    ;----movement for up
        mov ax,00
        mov bx,00
        call upp
        call uph
        ret
up endp
upp proc near
        mov ax,00
        mov bx,00
up1:
        mov al,0ch
        call outf4
        call delayvertical
up2:
        shr al,1
        call outf4
        call delayvertical
        cmp al,03h
        jne up2
        mov al,09h
        call outf4
        call delayvertical
        inc bx
        cmp bx,0fh              ;====number of loops     
        jne up1
        ret
upp endp
uph proc near
        mov ax,00
        mov bx,00
uphigh:
        mov al,0ch
        call outf4
        call delayvertical1
uphigh1:
        shr al,1
        call outf4
        call delayvertical1
        cmp al,03h
        jne uphigh1
        mov al,09h
        call outf4
        call delayvertical1
        inc bx
        cmp bx,007ffh              ;----number of loops (up&downhigh)    
        jne uphigh
        ret
uph endp
down proc near                  ;====for down                 
        mov ax,00
        mov bx,00
        call downhigh
        ret
down endp
downhigh proc near
downh1:
        mov ax,09h
        call outf4
        call delayvertical1
        mov ax,03h
        call outf4
        call delayvertical1
downh2:
        shl ax,1
        call outf4
        call delayvertical1
        cmp ax,0ch
        jne downh2
        call outf4
        call delayvertical1
        inc bx
        cmp bx,007ffh              ;====number of loops     
        jne downh1
        ret
downhigh endp
horizontal proc near            ;----horizontal
        mov ax,00
        mov bx,00
hor:
        mov al,0ch
        call outf3
        call delayhorizontal
hor1:
        shr ax,1
        call outf3
        call delayhorizontal
        cmp ax,03h
        jne hor1
        mov ax,09h
        call outf3
        call delayhorizontal
        inc bl
        cmp bl,2fh              ;====number of loops
        jne hor
        ret
horizontal endp
horizontalback proc near        ;----horizontal back
        mov ax,00
        mov bx,00
hor2:
        mov al,09h
        call outf3
        call delayhorizontal
        mov al,03h
        call outf3
        call delayhorizontal
hor3:
        shl al,1
        call outf3
        call delayhorizontal
        cmp al,0ch
        jne hor3
        inc bl
        cmp bl,2fh              ;====number of loops     
        jne hor2
        ret
horizontalback endp
rotateleft proc near            ;----for rotateleft
        mov ax,00
        mov bx,00
rot:
        mov al,090h
        call outf3
        call delaysub
        mov al,030h
        call outf3
        call delaysub
rot1:
        shl al,1
        call outf3
        call delaysub
        cmp al,0c0h
        jne rot1
        inc bl
        cmp bl,4eh              ;====number of loops     
        jne rot
        ret
rotateleft endp
rotateright proc near           ;----for rotate right
        mov ax,00
        mov bx,00
rot2:
        mov al,0c0h
        call outf3
        call delaysub
rot3:
        shr ax,1
        call outf3
        call delaysub
        cmp ax,030h
        jne rot3
        mov ax,090h
        call outf3
        call delaysub
        inc bl
        cmp bl,4eh              ;====number of loops
        jne rot2
        ret
rotateright endp
subarmforward proc near         ;----for subarm forward
        mov ax,00
        mov bx,00
sub0:           
        mov ax,09h
        call outf1
        call delaysub
        mov ax,03h
        call outf1
        call delaysub
sub1:
        shl al,1
        call outf1
        call delaysub
        cmp ax,0ch
        jne sub1
        inc bl
        cmp bl,6fh              ;====number of loops     
        jne sub0
        ret
subarmforward endp
subarmback proc near            ;----for subarm back
        mov ax,00
        mov bx,00
sub2:
        mov ax,0ch
        call outf1
        call delaysub
sub3:
        shr ax,1
        call outf1
        call delaysub
        cmp ax,03h
        jne sub3
        mov ax,09h
        call outf1
        call delaysub
        inc bl
        cmp bl,6fh              ;====number of loops
        jne sub2                    
        ret
subarmback endp
gripp proc near                 ;----for grip
        mov ax,00
        mov bx,00
grip:
        mov ax,08h
        call outf2
        call delaygrip
grip1:
        shr ax,1
        call outf2
        call delaygrip
        cmp ax,01h
        jne grip1
        inc bl
        cmp bl,07h              ;====number of loops     
        jne grip
        ret
gripp endp
ungrip proc near                ;----for ungrip
        mov ax,00
        mov bx,00
grip2:
        mov al,09h
        call outf2
        call delaygrip
        mov al,03h
        call outf2
        call delaygrip
grip3:
        shl al,1
        call outf2
        call delaygrip
        cmp al,0ch
        jne grip3
        inc bl
        cmp bl,04h              ;====number of loops     
        jne grip2
        ret
ungrip endp
;********************************************
delayvertical proc near         ;----delay for vertical movement
        mov cx,008fh
time4:
        mov si,00ffh
time5:
        dec si
        cmp si,09ffh
        jne time5
        loop time4
        ret
delayvertical endp
delayvertical1 proc near       
        mov cx,0019h
time6:
        mov si,00ffh
time7:
        dec si
        cmp si,09ffh
        jne time7
        loop time6
        ret
delayvertical1 endp
delayhorizontal proc near       ;----delay for horizontal movement
        mov cx,004dh
time8:
        mov si,00ffh
time9:
        dec si
        cmp si,09ffh
        jne time9
        loop time8
        ret
delayhorizontal endp
delaysub proc near              ;----delay for subarm movement
        mov cx,004dh
time1:
        mov si,00ffh
time:
        dec si
        cmp si,09ffh
        jne time
        loop time1
        ret
delaysub endp
delaygrip proc near             ;----delay for gripper
        mov cx,00ffh
time3:
        mov si,00ffh
time2:
        dec si
        cmp si,09ffh
        jne time2
        loop time3
        ret
delaygrip endp
clearled proc near
        mov ax,0000h
        call outf0
        call outf1
clearled endp
;**********************************************
outf0 proc near
        mov dx,00f0h
        out dx,ax
        ret
outf0 endp
outf1 proc near
        mov dx,00f1h
        out dx,ax
        ret
outf1 endp
outf2 proc near
        mov dx,00f2h
        out dx,ax
        ret
outf2 endp
outf3 proc near
        mov dx,00f3h
        out dx,ax
        ret
outf3 endp
outf4 proc near
        mov dx,00f4h
        out dx,ax
        ret
outf4 endp
inf6 proc near
      mov dx,00f6h
      in al,dx
      ret
inf6 endp
inf7 proc near
      mov dx,00f7h
      in al,dx
      ret        
inf7 endp
END BEGIN