• 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)

    A vast number of file sharers are not aware that they are breaking the law. Wouldn't reaching out to these people be more effective than introducing ineffective and arguably unethical regulations? By definition, the internet is not a medium which can be regulated with ease.

  2. Marked by a teacher

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

    The use of the cisc architecture is set back in history as there were no compliers and programs had to be coded by hand , one instruction at a time . the more complicated instructions are means they are very inefficient in hardware .cisc was mainly brought about by the

  1. Information systems development literature review. Since the 1960s Methodologies, Frameworks, Approaches and CASE ...

    Each entity was created either with a Primary/foreign or composite key depending on the information stored. Where an entity attribute has been underlined this indicates this to be the primary key for the table. Where an astrix is present before the name of an attributes this identifies this to be a primary key from a related table.

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

    This is made more difficult, due to the fact that most micro-operations are independent, meaning that the OD has very limited control over them. Design The airport has to be designed in such a way so to support its purpose.

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

    The final polygon colour is the sum of all four light components, each of which is formed by multiplying the glMaterial colour by the glLight colour (modified by the directionality in the case of Diffuse and Specular). Since there is no Emission colour for the glLight, that is added to the final colour without modification.

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

    For the caches, only sequential access was performed and measured, while for the main memory both sequential and random access were measured. The detailed experimental design is described in Section 3 and the results are represented in Section 4. Section 5 of the report analyses and discusses the results and conclusions are developed.

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

    CCD and converts it into YCrCb 422 format that is amenable for compression or display. c) Hardware 3A (H3A) - It provides statistical information on the raw color data, which can be further used to adjust various parameters for video or image processing.

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

    Expert systems are a great tool for companies especially, as depicted here, companies in finance. However, it is important for companies to remember that humans should make the final decision, and not the computer. Humans still have the insight and intuition that computers are unable to possess now.

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