A robotic arm is controlled by several stepper motors.

Stepper motor (or step motor) is a brushless DC electric motor that divides a full rotation (360 degree) into a number of equal steps (10 degree/step in this case). The motor's position can then be commanded to move and hold at one of these steps without any feedback sensor (an open-loop controller). This motor usually has 4 wires. To move a motor, the following bit patterns should be applied to these 4 wires.

 

Clockwise rotation: 1100à0110à0011à1001 and these 4 patterns repeated again such as à1100à0110....

Counter clockwise rotation: 1100à1001à0011à0110à and these 4 patterns repeated again such as 1100à1001….

 

Each input pattern (for example 1100) moves motor 10 degree. Assume the first four bits (least Significant bits) of register R2 are connected to one these motors.

Write a program in LC-3 assembly language, to do the following:

If you type “1” motor moves 120 degree clockwise (sending 12 patterns) and then 90 degree counter clockwise (sending 9 patterns). If you type “2” motor moves 50 degree counter clockwise (sending 5 patterns).

Depends on what number you enter; the console should display all the related patterns sending to the motor.

Submit your program (asm file).



이게 과제 질문이고


요 아래것이 제 코드인데..


ORIG x3000
LD R6,ASCII
AND R0,R0,#0
ADD R0,R0,R6
TRAP x23
BRp JUMP
LEA R0,L2
TRAP x22
TRAP x25
JUMP LEA R0,L1
TRAP x22
TRAP x25
ASCII .FILL #48
L1 .STRINGZ "110001100011110010010"
L2 .STRINGZ "11001"
.END


도통 감이 안잡힙니다, BR문 이용해서 1 하고 2를 분리해야 되는데 어떻게 해야되는건지 시불 ㅋㅋ

저거 줄 안맞는거는 무시하셔도 됩니다, 복붙이 이상하게 됬네