RTS Finalone

download RTS Finalone

of 29

  • date post

    14-Apr-2018
  • Category

    Documents

  • view

    225
  • download

    0

Embed Size (px)

Transcript of RTS Finalone

  • 7/27/2019 RTS Finalone

    1/29

    1

    UNIVERSITY OF NOTTINGHAM

    SCHOOL OF ELECTRICAL AND ELECTRONIC

    ENGINEERING

    INTRODUCTION TO REAL-TIME SYSTEMS(H61RTS)

    TITLE: REPORT (LABS 5-9)

    Students name:Anant Johri

    Students ID:4042046

    PC Number: 18

    Name of Partner:Adam NealeSubmission date: 30/5/06

  • 7/27/2019 RTS Finalone

    2/29

    2

    INDEX

    1. Introduction..3

    2. Aims .4

    3. Task 15

    4. Task 28

    5. Task 3...11

    6. Task 4...12

    7. Conclusion...13

    8. Appendix.14

  • 7/27/2019 RTS Finalone

    3/29

    3

    Introduction

    The uses of DSPs in modern technology is increasing day by day so now there are of

    companies which manufacture DSPs for industrial use, some of these are designed for

    specific applications. The particular DSP used in this project is the Texas InstrumentsDSP Starter Kit, a basic DSP suitable for the programs and applications included in this

    particular project.

    Most of the work in the lab sessions was carried out on a DSK board, Vero board and on

    the software Code Composer Studio. Simple devices were built onto the Vero board

    and were controlled through the input and output ports of the DSK. The controlling of

    these devices were carried out through C code written on the software Code Composer

    Studio, running in real time with functions taking place on the board. The projects

    covered most of the input and output features of the DSK.

    One of the major parts of the project was to write proper C codes for operating the

    different devices on the vero-board and obtaining the desired results. Considerations

    particularly of calibration should be kept in mind while writing the code for controlling

    and interaction with devices on the Veroboard.

    In the following lab sessions the students revisited the concepts of the DAC (Digital to

    Analogue Converter) and timing events. The labs also introduced new interface

    techniques such as various kinds of Bit Manipulation (Bit masking, bit shifting etc) and

    also introduced Interrupts. The key feature of the session was familiarization with the

    hardware ensemble of the DSK which includes the keypad and the LCD (liquid crystal

    display).

    The concept of the ADC (Analogue to Digital Converter) was introduced. ADC converts

    analogue signals to digital ones. This technique is very helpful in the field of

    communication since transmission of digital data is faster, secure and also more noise

    resistant. All the concepts were applied and tested in a series of four tasks which

    culminated with the building of a Stand Alone Voltmeter.

  • 7/27/2019 RTS Finalone

    4/29

    4

    AIMS

    The aim of the session was the completion of the following tasks:-

    1. To modify the DAC into an ADC and to use it as a voltmeter.

    2. To interface with the Liquid Crystal Display

    Writing a message onto the screen

    Exploring some of the Character Control Instructions given in lab

    sheet.

    Making a timing diagram between the R/W, RS and E during a

    write operation.

    3. To interface with the Keypad

    By writing a code in the main routine

    By using an Interrupt

    4. To make a Stand Alone Voltmeter

  • 7/27/2019 RTS Finalone

    5/29

    5

    Task 1.Modify the DAC to become an ADC

    This task was mainly about to build an ADC using the DAC made in the lab sessions 3

    and 4 and then testing the ADC using a potentiometer. With use of a comparator, the

    output of the DAC (VDAC) could be coupled with another DC voltage (Vi) and a digital

    voltage would be seen at the output. The output from the DAC is connected to the

    inverting input of the comparator and DC voltage is connected to the non-inverting input

    of the comparator. The unknown voltage Vi is provided from the potentiometer. Also 5

    volt supply is also supplied to the comparator.

    The resistor at the output of the comparator is present to give a definite switch between

    logic low and logic high. When the output of the comparator is at logic high, the

    potential difference across the resistor will be very close to zero and the output voltage

    will be pulled up to 5V. While when the comparator output is at logic low, the potential

    difference across the resistor is high and so the output is kept at zero volts.

    Also known from the connections to the comparator are the values of inputs that will

    govern the logic state of the output, it is known that;

    If Vi > VDAC then Vout = 5v and,

    If Vi

  • 7/27/2019 RTS Finalone

    6/29

    6

    The table below shows how the successive approximation was carried out;

    MSB LSB

    Bit 0-7

    VDAC

    V0

    (128)

    V1

    (64)

    V2

    (32)

    V3

    (16)

    V4

    (8)

    V5

    (4)

    V6

    (2)

    V7

    (1)

    LM393

    Output

    Low 1 0 0 0 0 0 0 0

    High 0 1 0 0 0 0 0 0

    Low 0 1 1 0 0 0 0 0

    Low 0 1 0 1 0 0 0 0

    High 0 1 0 0 1 0 0 0

    Low 0 1 0 0 1 1 0 0

    Low 0 1 0 0 1 0 1 0

    Switchin

    g

    0 1 0 0 1 0 0 1

    The table shows how the successive approximation was carried out, setting the Most

    Significant Bit to one (logic high) first and monitoring the output of the comparator.

    By looking at the two statements that were known to be true for values of Vi &VDAC it

    was possible to see whether the value of VDAC needed to be increased or decreased. The

    high/low statements to the left of the table represent the output of the comparator, when it

    was low the value of VDAC had to be decreased and vice versa. At the value of VDAC that

    matched the value of Vi the scope displayed some switching between the two logic levels,

    this was because the voltages at the two inputs were very closely matched, any

    fluctuations in these voltages would result in a change in the output value.

  • 7/27/2019 RTS Finalone

    7/29

    7

    To ensure that the ADC was accurate it would have to be calibrated, the correct value of

    VDAC in the program would have to correspond to the correct value as the result of the

    successive approximation. In brackets in the top row of the table is the value that each

    significant bit of the DAC represents at the output, with the maximum value being 255

    when all bits are set to high. The conversion between these numbers and the value that

    they represent can be carried using the following formula;

    Sum of values set to logic 1 x 3.3 = VDAC255

    Where 255 is the Max. value of DAC mask and 3.3 is the Max. voltage of DAC

    So using this formula the value of VDAC can be found at any point, although it was only

    necessary to find the voltage at the end of the successive approximation and compare it to

    the measured value.

  • 7/27/2019 RTS Finalone

    8/29

    8

    Task 2. Interface with the LCD

    The LCD is an interface which consists of a series of digital inputs to the display and itdisplays characters given to it either via code or by the keypad. There are 14 differentpins on the LCD which are used for power supply, register selection, data bits etc. Three

    of these pins are

    (1). RS: This pin selects the register to be used, that is, it chooses between the dataregister and the input register and it is connected to bit 6 of *dpr0.(2). R/W: This pin mainly selects the working mode, that is, the reading mode or thewriting mode and it is connected to bit 7 of *dpr0.(3). E: This pin enables the signal to read or write and it is connected to bit 5 of *dpr0.

    The functions performed by the LCD depend on the combinations in which the pins gohigh. For example putting in the code *dpr1 = 0 x 01 would set the pins DB1-DB7 as lowand only DB0 would be high which is a signal to clear the screen and putting *dpr1=0x42

    or =B will display B on the screen.

    The main task involved in this section was to test the working of the display using thedisplay_test.out code and then programming the LCD to display a message, hold it forfive seconds, clear and reset the display, followed by another message.After that to testthe character control instructions described in the data sheet provided on the webpage andin the last to draw a timing diagram of the E, R/W and RS pin signals.

    For these tasks first of all the file display_test.out was run to test the display unit ofthe DSK. The result of running the file was that a message Ea2 is greatwas displayed onthe screen on the LCD proving that the display unit is working properly.

    For the second test a program (included in appendix) was written. The code started withdeclaring the header files and then declared all the global variables. The two memorymapped latches used were declared and initialized. The display was initialised, modesloaded, and the cursor was initiated. All these functions were carried out using thevarious display libraries and C routines provided. These functions are predefined in thedisplay_lib.c file and enable the basic LCD functions. The following header files hadto be included in the code to access the LCD;

    Init_display() -Initialises display.

    Load_modes() -Modes of operation of the LCD.

    Displayon_cursorblink() -Turns display on and makes cursor blink.

    Write_character(xxxx) -Writes character to display. A table of reference must be

    consulted to set the correct hexadecimal value of the

    character to be displayed. Can be converted to decimal.

  • 7/27/2019 RTS Finalone

    9/29

    9

    The function write_character() was used to write the charac