• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month
Page
  1. 1
    1
  2. 2
    2
  3. 3
    3
  4. 4
    4
  5. 5
    5
  6. 6
    6
  7. 7
    7
  8. 8
    8
  9. 9
    9
  10. 10
    10
  11. 11
    11
  12. 12
    12
  13. 13
    13
  14. 14
    14
  15. 15
    15
  16. 16
    16
  17. 17
    17
  18. 18
    18
  19. 19
    19
  20. 20
    20
  21. 21
    21
  22. 22
    22
  23. 23
    23
  24. 24
    24
  25. 25
    25
  26. 26
    26

Traffic Light Simulation and Machine Code Program.

Extracts from this document...

Introduction

        PAGE

Traffic Light Simulation and Machine Code Program. – Unit Code – 19/1/H1/21417P


Terms of Reference

I will be writing be writing a machine code program which controls a set of traffic lights and provides the timing of the light sequence with the 8086 micro-simulator.

I will be using the 8086 micro-simulator to create the traffic light program, the time for this program is provided and the fully working program will be virus check and fully operational.


Contents Page

Terms of Reference

Contents Page

Part One, the Traffic Light Program

Timing sequence

Machine code

Example of program working

Question One Basic Architecture and Operations of the Microsimulator

Technical terms for the microsimulator

Question two – The Advantages And Disadvantages of programming in machine code over higher level languages


Part One, the Traffic Light Program

Timing sequence

This is the table that has the timing sequences I will use for the traffic light program: -

Light 1

Light 2

Time at the stage

Red

Red

1 second

Red – Amber

Red

2 seconds

Green

Red

30 seconds

Amber

Red

2 seconds

Red

Red

1 seconds

Red

Red- Amber

2 seconds

Red

Green

15 seconds

Red

Amber

2 seconds

Machine code

; _____ CONTROL THE TRAFFIC LIGHTS _____________________________

        JMP Start

        DB 70

Start:

        STI                ; RED

        MOV        AL,90        ; Copy 10010000 into the AL register.

        OUT        01        ; Send AL to Port One (The traffic lights).

        MOV        BL,01        ; SENDS VALUE 01 to BL (02 THE SECONDS TO COUNT DOWN).

        CALL        60        ; CALLS SUBROUTINE 60 (DELAY SUBROUTINE)

                        ; RED - AMBER / RED

                        ; Turn on all the traffic lights.

        MOV        AL,D0        ; Copy 11010000 into the AL register.

        OUT        01        ; Send AL to Port One (The traffic lights).

        MOV        BL,02        ; SENDS VALUE 02 to BL.

        CALL        60        ; CALLS SUBROUTINE 60 (DELAY SUBROUTINE)

                        ; GREEN / RED

        MOV        AL,30        ; Copy 110000 into the AL register.

        OUT        01        ; Send AL to Port One (The traffic lights).

        MOV        BL,1E        ; SENDS VALUE 1E to BL (30 SECONDS).

        CALL        60        ; CALLS SUBROUTINE 60 (DELAY SUBROUTINE)

                        ; AMBER - RED

        MOV        AL,50        ; Copy 00000000 into the AL register.

        OUT        01        ; Send AL to Port One (The traffic lights).

...read more.

Middle

CPU Clock Speed can be altered.

Peripherals        Example Programs

Keyboard Input        99keyb.asm

Traffic Lights        99tlight.asm

Seven Segment Display        99sevseg.asm

Heater and Thermostat        99hon.asm   99hoff.asm

Snake and Maze        99snake.asm

Stepper Motor        99step.asm

Memory Mapped VDU        99keyb.asm

This simulator enables you to put into practice most of the topics discussed below.

The simulator consists of a central processing unit (CPU), 256 bytes of random access memory (RAM) and 16 input output (IO) ports.  Only five are used.  There is a hardware timer that triggers interrupt 02 at regular time intervals that you can pre-set using the configuration tab.  

image01.png

The simulator is programmable in that you can run many different programs.  In real life, the RAM would be replaced by read only memory (ROM) and the system would only ever run one program hard wired into the ROM.  There are hundreds of examples of systems like this controlling traffic lights, CD players, simple games consoles, many children's games, TV remote controls, microwave oven timers, clock radios, car engine management systems, central heating controllers, environmental control systems and the list goes on.

Random Access Memory

The simulator has 256 bytes of ram.  The addresses are from 0 to 255 in decimal numbers or from [00] to [FF] in hexadecimal.  RAM addresses are usually given in square brackets such as [7C] where 7C is a hexadecimal number.  Read [7C] as "the data stored at location 7C".

Busses

Busses are collections of wires used to carry signals around the computer.  They are commonly printed as parallel tracks on circuit boards.  Slots are sockets that enable cards to be connected to the system bus.  An 8-bit computer typically has registers 8 bits wide and 8 wires in a bus.  A 16-bit computer has 16 bit registers and 16 address and data wires and so on.

...read more.

Conclusion

compiler. Once the program has been compiled, the resulting machine code is saved separately, and can be run on its own at any time. As with assembly-language programs, updating or correcting a compiled program requires that the original (source) program be modified appropriately and then recompiled to form a new machine-language (object) program. Typically, the compiled machine code is less efficient than the code produced when using assembly language. This means that it runs a bit more slowly and uses a bit more memory than the equivalent assembled program. To offset this drawback, however, we also have the fact that it takes much less time to develop a compiler-language program, so it can be ready to go sooner than the assembly-language program.


Interpreter Language

An interpreter language, like a compiler language, is considered to be high level. However, it operates in a totally different manner from a compiler language. Rather, the interpreter program resides in memory, and directly executes the high-level program without preliminary translation to machine code. This use of an interpreter program to directly execute the user's program has both advantages and disadvantages. The primary advantage is that you can run the program to test its operation, make a few changes, and run it again directly. There is no need to recompile because no new machine code is ever produced. This can enormously speed up the development and testing process. On the down side, this arrangement requires that both the interpreter and the user's program reside in memory at the same time. In addition, because the interpreter has to scan the user's program one line at a time and execute internal portions of itself in response, execution of an interpreted program is much slower than for a compiled program”.

Information taken from - http://www.play-hookey.com/computers/language_levels.html

COMPUTER ACHITECTURE                 

...read more.

This student written piece of work is one of many that can be found in our University Degree Computer Science section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

See related essaysSee related essays

Related University Degree Computer Science essays

  1. Marked by a teacher

    UK Copyright and File Sharing

    5 star(s)

    I believe that the creative industries are searching for a magic bullet solution to their record sales woes in an attempt to entirely stop file sharing. This bullet does not exist. The only way this will be achieved is to stop producing the content entirely, and clearly this will never happen.

  2. Marked by a teacher

    Cisc v risc. To begin this assignment , I will outline the definition ...

    As mentioned above the goal of pipelining is to perform each step paraellel , so as one instruction is being retrived ( fetch ) the previous one is being read ( decode ) while the previous one to that is being performed ( executed )

  1. The purpose of this assignment is to research about Electronic data interchange and needs ...

    Stand-alone packages have data entry front-ends so a user can manually enter dater into the package, which will then translate what was entered in to an EDI document for transmission to the trading partner (8) Software which facilitates integration, Referred to as integrated EDI software, which are the ECS/EDI processor.

  2. Examine the many micro operations and their activities in Brussels airport.

    Quality by not wasting time and effort, speed by higher turnover of customers and lower administrative overheads, dependability by eliminating disruption and flexibility by adapting to changing circumstances without wasting time and capacity. For example, an intensive cost-cutting policy have been pursued in the areas that come under the competence of the Facilities and Maintenance division of the airport4.

  1. Phong Shading and Gouraud Shading The standard reflection model in computer graphics that ...

    The up-vector defines a unique orientation for the camera. In the reshape code, before the viewing transformation can be specified, the current matrix is set to the identity matrix with glLoadIdentity(). This step is necessary since most of the transformation commands multiply the current matrix by the specified matrix and then set the result to be the current matrix.

  2. Measurement of Processors Performance report. In the experiment, a testing code was developed in ...

    Experiment Overview 1.1 Theoretical Background Computer's memory is always structured into memory hierarchy in which each level is distinguished by the response time with the top-most level being the fastest. The memory hierarchy in most computer is: * Processor registers - fastest possible access (usually 1 CPU cycle), only hundreds of bytes in size * Level 1 (L1)

  1. The project explains various algorithms that are exercised to recognize the characters present on ...

    Image clarity and resolution of the picture, both are highly dependent on the type of the camera used for capturing the image. As shown in figure 5.1 below, along with an original plate used as an input image during simulation, it also consists of a Processed Plate Results that is the binary image and the result of the resizing algorithm.

  2. Applying AI to Finance. The Symbolic and Sub-Symbolic approaches.

    The training process of an ANN itself is relatively simple. The pre-processing of the data, however, including the data selection and representation to the ANN and the post processing of the outputs, required for interpretation of the output and performance evaluation, require a significant amount of work.

  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work