Microprocessor Simulator 0 Help


Example - 08table.asm - Data Tables



Download 1.18 Mb.
Page51/82
Date18.03.2021
Size1.18 Mb.
#56105
1   ...   47   48   49   50   51   52   53   54   ...   82
sms32v50 (3)
sms32v50 (3), sms32v50 (6)

Example - 08table.asm - Data Tables


Contents


Example - 08table.asm

; ----- EXAMPLE 8 ------- DATA TABLES --------------------------


JMP Start ; Skip past the data table.
DB 84 ; Data table begins.

DB C8 ; These values control the traffic lights

DB 31 ; This sequence is simplified.

DB 58 ; Last entry is also used as end marker


Start:

MOV BL,02 ; 02 is start address of data table

Rep:

MOV AL,[BL] ; Copy data from table to AL



OUT 01 ; Output from AL register to port 01
CMP AL,58 ; Last item in data table ???

JZ Start ; If yes then jump to Start

INC BL ; In no then point BL to the next entry

JMP Rep ; Jump back to do next table entry


END

; --------------------------------------------------------------


TASK
18) Improve the traffic lights data table so there is an

overlap with both sets of lights on red.


19) Use a data table to navigate the snake through the maze.

This is on port 04. Send FF to the snake to reset it.

Up, down left and right are controlled by the left four bits.

The right four bits control the distance moved.


20) Write a program to spin the stepper motor. Activate bits

1, 2, 4 and 8 in sequence to energise the electromagnets

in turn. The motor can be half stepped by turning on pairs

of magnets followed by a single magnet followed by a pair

and so on.
21) Use a data table to make the motor perform a complex sequence

of forward and reverse moves. This is the type of control

needed in robotic systems, printers and plotters. For this

exercise, it does not matter exactly what the motor does.


; --------------------------------------------------------------

You can copy this example program from the help page and paste it into the source code editor.

DB 84


DB stands for Define Byte/s. In this case 84hex is stored into RAM at address [02]. Addresses [00] and [01] are occupied by the JMP Start machine codes.

84 hex is 1000 0100 in binary. This is the pattern or noughts and ones needed to turn on the left red light and the right green light.



Download 1.18 Mb.

Share with your friends:
1   ...   47   48   49   50   51   52   53   54   ...   82




The database is protected by copyright ©ininet.org 2024
send message

    Main page