EDSIM.docx

Embed Size (px)

Citation preview

  • 7/27/2019 EDSIM.docx

    1/44

    User's Guide

    Home

    Preferthe

    Original?

    NewEdSim51

    SH

    Aboutthe

    Simulator

    User's

    Guide

    Installation

    Instructions

    Examples

    ContactUs

    TheFundament

    alSimulation

    s

    Beginner's Guide

    to the8051 -Online

    Site

    Map

    User's Guide

    The Microcontroller Panelo The Bitfield

    o Data and Code Memory

    The Assembly Code Panelo Source Pane Unlockero Load and Save

    o Copy and Pasteo A Few Notes on the Assemblero Debuggingo Breakpoints

    The Peripheralso The Logic Diagramo The LED Bank, DAC and the 7-segment Displayso The LCD Module

    o The Switch Bank and the ADCo The Comparator and the DACo The Motor

    o The UART

    o The Keypad

    http://www.edsim51.com/index.htmlhttp://www.edsim51.com/index.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/simInstructions.htmlhttp://www.edsim51.com/simInstructions.htmlhttp://www.edsim51.com/simInstructions.htmlhttp://www.edsim51.com/simInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/simInstructions.html#microcontrollerhttp://www.edsim51.com/simInstructions.html#microcontrollerhttp://www.edsim51.com/simInstructions.html#bitfieldhttp://www.edsim51.com/simInstructions.html#bitfieldhttp://www.edsim51.com/simInstructions.html#dataCodeMemoryhttp://www.edsim51.com/simInstructions.html#dataCodeMemoryhttp://www.edsim51.com/simInstructions.html#assemblyhttp://www.edsim51.com/simInstructions.html#assemblyhttp://www.edsim51.com/simInstructions.html#sourceUnlockhttp://www.edsim51.com/simInstructions.html#sourceUnlockhttp://www.edsim51.com/simInstructions.html#loadSavehttp://www.edsim51.com/simInstructions.html#loadSavehttp://www.edsim51.com/simInstructions.html#copyPastehttp://www.edsim51.com/simInstructions.html#copyPastehttp://www.edsim51.com/simInstructions.html#assemblerhttp://www.edsim51.com/simInstructions.html#assemblerhttp://www.edsim51.com/simInstructions.html#debugginghttp://www.edsim51.com/simInstructions.html#debugginghttp://www.edsim51.com/simInstructions.html#breakpointshttp://www.edsim51.com/simInstructions.html#breakpointshttp://www.edsim51.com/simInstructions.html#peripheralshttp://www.edsim51.com/simInstructions.html#peripheralshttp://www.edsim51.com/simInstructions.html#logicDiagramhttp://www.edsim51.com/simInstructions.html#logicDiagramhttp://www.edsim51.com/simInstructions.html#ledshttp://www.edsim51.com/simInstructions.html#ledshttp://www.edsim51.com/simInstructions.html#lcdModulehttp://www.edsim51.com/simInstructions.html#lcdModulehttp://www.edsim51.com/simInstructions.html#switcheshttp://www.edsim51.com/simInstructions.html#switcheshttp://www.edsim51.com/simInstructions.html#comparatorhttp://www.edsim51.com/simInstructions.html#comparatorhttp://www.edsim51.com/simInstructions.html#motorhttp://www.edsim51.com/simInstructions.html#motorhttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#motorhttp://www.edsim51.com/simInstructions.html#comparatorhttp://www.edsim51.com/simInstructions.html#switcheshttp://www.edsim51.com/simInstructions.html#lcdModulehttp://www.edsim51.com/simInstructions.html#ledshttp://www.edsim51.com/simInstructions.html#logicDiagramhttp://www.edsim51.com/simInstructions.html#peripheralshttp://www.edsim51.com/simInstructions.html#breakpointshttp://www.edsim51.com/simInstructions.html#debugginghttp://www.edsim51.com/simInstructions.html#assemblerhttp://www.edsim51.com/simInstructions.html#copyPastehttp://www.edsim51.com/simInstructions.html#loadSavehttp://www.edsim51.com/simInstructions.html#sourceUnlockhttp://www.edsim51.com/simInstructions.html#assemblyhttp://www.edsim51.com/simInstructions.html#dataCodeMemoryhttp://www.edsim51.com/simInstructions.html#bitfieldhttp://www.edsim51.com/simInstructions.html#microcontrollerhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/simInstructions.htmlhttp://www.edsim51.com/simInstructions.htmlhttp://www.edsim51.com/simInstructions.htmlhttp://www.edsim51.com/simInstructions.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/index.htmlhttp://www.edsim51.com/index.html
  • 7/27/2019 EDSIM.docx

    2/44

    New Features!

    Get the latest EdSim51 version

    The Dynamic Interface

    Now the user

    can switch

    the

    peripheralsto other port

    pins.

    Getmore

    information.

    Unlock the External UART

    Clicking

    on the

    button

    marked Uat the top

    left of theexternal

    UART

    places theUART in a

    separate

    frame, as

    shownbelow.

    This framehas muchlarger text

    windows

    for

    transmittedand

    http://www.edsim51.com/installationInstructions.html#simulatorInstallationInstructionshttp://www.edsim51.com/installationInstructions.html#simulatorInstallationInstructionshttp://www.edsim51.com/simInstructions.html#LDAndDIhttp://www.edsim51.com/simInstructions.html#LDAndDIhttp://www.edsim51.com/simInstructions.html#LDAndDIhttp://www.edsim51.com/simInstructions.html#LDAndDIhttp://www.edsim51.com/simInstructions.html#LDAndDIhttp://www.edsim51.com/simInstructions.html#LDAndDIhttp://www.edsim51.com/installationInstructions.html#simulatorInstallationInstructions
  • 7/27/2019 EDSIM.docx

    3/44

    receivedtext.

    Simply

    close thisframe to

    lock theUART

    back in the

    main

    window.

  • 7/27/2019 EDSIM.docx

    4/44

    SyntaxHighlightingNow, assembly code

    written in EdSim51 isautomatically syntax

    highlighted.

    Instructions are

  • 7/27/2019 EDSIM.docx

    5/44

    coloured blue,

    assembler directives(such as ORG,

    USING, etc) are

    coloured purple,aliases (for example,

    the assembler replaces

    TMOD with theaddress of TMOD) are

    coloured orange and

    comments arecoloured green.

    Switching off syntax

    highlighting: if youwish to turn off syntax

    highlighting, simply

    right-click anywhere

    in the assembly codewindow and respond

    to the prompt.

    Change the System Clock Frequency

    Originally, the simulator ran with a system clock frequency

    of 12 MHz. Now the user can enter a value for the systemclock frequency in MHz.

    UART Transmitting HEX Data

    Up until now, the external UART only

    transmitted text - whatever the user

    typed in the Tx field was transmitted to

    the 8051. Now, a list of 8-bit numbers(written in HEX) can be transmitted. To

    do so, the user encloses the list in curlybraces, each number separated by a

    comma, as shown in the image opposite.

    When text is transmitted, it is terminated

  • 7/27/2019 EDSIM.docx

    6/44

    by 0DH. This is not the case with a list

    of numbers. In the example shownopposite, the four numbers 56, 3a, 23

    and e7 are transmitted, nothing more.

    If the user wishes to send {56, 3a, 23, e7} as text rather than a list of 8-bit numbers, the text

    is escaped using the \ character. Therefore, \{56, 3a, 23, e7} in the Tx field would result in{56, 3a, 23, e7} followed by 0DH being transmitted to the 8051.

    LCD Module

    A simulation of the popular Hitachi HD44780

    LCD module has been implemented for the

    EdSim51 Simulator. And now CGRAMhas also

    been implemented. Find outmore.

    Zoom

    For high resolution monitors, click on the zoom button. The zoom button islocated below the red Exitbutton.

    Keypad Modes

    Now the user can select fromthree modes of operation:

    Standard- any number

    of keys can be closed at

    the same time.

    Pulse- once the mouse

    button is released the

    key reopens.

    Radio- in radio mode

    only one key at a timecan be closed.

    Keypad And External 1

    http://www.edsim51.com/simInstructions.html#lcdModulehttp://www.edsim51.com/simInstructions.html#lcdModulehttp://www.edsim51.com/simInstructions.html#lcdModulehttp://www.edsim51.com/simInstructions.html#lcdModule
  • 7/27/2019 EDSIM.docx

    7/44

    Interrupt

    Until now the keypad could

    only be implemented using

    busy-waiting. It can still be

    implemented in that manner,but it can also be used together

    with the 8051 external 1interrupt pin, P3.3.

    Note:this pin, P3.3, is also

    used by the display-select

    decoder, therefore multiplexingof the 7-segment displays

    cannot be implementedtogether with the keypad

    interrupt. To multiplex the

    displays and use the keypad atthe same time, the keypad must

    be implemented using busywaiting.

    More information on the

    keypad modes and the

    keypad interrupt

    Intel HEX Reader/Writer

    You can

    now saveyour

    source

    code inIntel HEX

    format.

    Or you

    can writeC code

    for the

    8051using one

    of many

    available

    http://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypad
  • 7/27/2019 EDSIM.docx

    8/44

    8051 Ccompilers,

    then

    import theHEX code

    into the

    EdSim51Simulator.

    Find out

    more.

    Simulator Window Update

    As with many microcontroller simulators, EdSim51 allows the user to either step through a

    program, executing a single instruction per step, or to run the program continuously. In theoriginal EdSim51 design, when running a program, the simulator would execute oneinstruction, update the screen, pause for a quarter second, then proceed with the next

    instruction and so on. This allowed the programmer to observe changes in the hardware and

    registers for each executed instruction. However, while this is very useful for debugging, itmeant the user would need to wait a long time for things to happen (examples: data transmitted

    on the serial port to appear on the UART, an LED flashing at half second intervals, etc).

    The best of both:now the user has the choice. Using theUpdate Freq.drop down menu (shown opposite) the

    programmer can choose how often the screen should beupdated. The choices are: update the screen after everyinstruction execution (the default), after 100, 1000,

    10,000 or 50,000 executed instructions.

    Type in a value:the options available from the menumay not be appropriate. Therefore, the user can now enter

    a number rather than select a value from the list. For the

    entered number to take effect, the user must hit Enter onthe computer keyboard.

    Find outmore.

    http://www.edsim51.com/intelHex.htmlhttp://www.edsim51.com/intelHex.htmlhttp://www.edsim51.com/simInstructions.html#updateFreqhttp://www.edsim51.com/simInstructions.html#updateFreqhttp://www.edsim51.com/simInstructions.html#updateFreqhttp://www.edsim51.com/simInstructions.html#updateFreqhttp://www.edsim51.com/intelHex.html
  • 7/27/2019 EDSIM.docx

    9/44

    The Microcontroller Panel

    A screenshot of the

    microcontroller panel.This gives the user access

    to all the 8051's registers

    and data memory.

    Boxes that are white can beedited directly. Those that

    are grey cannot. For

    example, the port latch bits

    can be edited directly bythe user, but the port pins

    are controlled by theexternal peripherals and

    the port latches and cannot

    be edited.

    When

    themouse

    pointer

    is left tohover

    over one

    of the

    registerlabels,

    the

    register'saddress

    appears,

    as

    shownopposite

    for the

    PCONregister.

  • 7/27/2019 EDSIM.docx

    10/44

    The Bitfield

    In the above image, the individual bits for the accumulator are shown (ACC). The user can enter

    any address or SFR name in the blue box (replacing ACC) and the bits for that given address willthen be displayed. Also, if you let the mouse pointer hover over one of the bits momentarily, the

    bit's description is displayed, as shown below:

    The bit field for the TMODSFRis shown. Notice bit 2 is the

    counter/timerbit. Also

    notice the background is grey.This is because the TMOD

    register is not bit-addressable -

    the user cannot alter these bits

    directly.

    The PSWis bit-addressable,therefore the background ofeach bit is white and the user

    can change any of the bits

    directly.

    The bitfield can be used to see

    the bit pattern of any address

    in RAM (0 to 7FH) by typing

    the address in the blue box. Ifthe location is bit-addressable,

    the bit backgrounds are white

    and the user can alter any ofthe eight bits.

    As with SFRs, if the location

    is not bit-addressable thebackgrounds are grey.

    Data and Code MemoryBy default, data memory is displayed. Any address in RAM (00H to 7FH) can be altered byentering the address in the blue box (labelled addr) and then entering the desired value in the

    box to the right (labelled value).

  • 7/27/2019 EDSIM.docx

    11/44

    Displaying Code Memory

    Code memory can also be examined and edited, as shown in the image above. To switch between

    data memory and code memory the user clicks on the button that is labelled Data Memorywhendata memory is displayed and Code Memorywhen code memory is displayed.

    The first 127 bytes of code memory are displayed. To view another area of code memory, enter

    the start address in the blue box. The 127 bytes from the start address onwards will then bedisplayed. Again, like data memory, the address specified in the blue addrbox can be altered by

    entering a value in the valuebox. However, it should be noted that this will result in the machine

    code and the assembly program being different.

    In the image above, the assembly code that generated the machine code (as displayed in code

    memory) can be seen on the right.

    Update Freq.

    The user can choose to either step through a program (executing a single instruction per step) or

    run the program continuously. When running a program, the rate at which the screen updates isdetermined by the setting in the Update Freq.menu.

  • 7/27/2019 EDSIM.docx

    12/44

    Using the Update Freq.drop down menu the

    user can choose how often the screen should

    be updated. The choices are: update the

    screen after every executed instruction, after

    100, 1000, 10,000 or 50,000 executedinstructions.

    Or, if none of these options is appropriate, the

    user can type in a number, then hit Enter.

    The update frequency may be changed while

    a user's program is running.

    The Assembly Code Panel

    A simple

    assemblyprogram

    is shown

    in the

    assemblycode

    panel to

    the left.This

    program

    runs in acontinuou

    s loop,

    displaying

    thenumbers 0

    to 9 and

    back to 0

    on thefirst 7-

    segment

    display. Asnapshot

  • 7/27/2019 EDSIM.docx

    13/44

    of its

    execution

    is shownto the

    right.

    When the background of the assembly codetext area is white is it editable. The

    programmer can write code directly here, or

    can load a program from file using the Loadbutton (dealt with in the next section).

    When the program is ready for testing, the

    user can either click on the Assmbutton to

    execute instructions one at a time, or on the

    Runbutton to run the program continuously.Either way, the program will first be

    assembled. If an error in the code isdiscovered, a message is displayed in the

    message box above the assembly code (with

    a red background) and the line with the error

    is highlighted within the code in red.

    If the code assembles without errors, Assm

    is replaced by Step, the text area's

    background changes to light grey. The codecannot be edited at this point.

    If you want to go back to editing your code,

    simply click on the Resetbutton.

    Source code window a bit small? Read about

    the source pane unlocker below.

    Source Pane UnlockerThe simulator was designed so that everything is visible on the screen at the same time - theinternal registers, the source code, the peripherals, etc. However, this means the code pane is

    quite small. But it can be expanded.Read more.

    Load and Save

    http://www.edsim51.com/sourcePaneUnlocker.htmlhttp://www.edsim51.com/sourcePaneUnlocker.htmlhttp://www.edsim51.com/sourcePaneUnlocker.htmlhttp://www.edsim51.com/sourcePaneUnlocker.html
  • 7/27/2019 EDSIM.docx

    14/44

    The user can write code directly into the text box when it is in edit mode, or an existing programcan be loaded from a file using the Loadbutton. Similarly, code in the text box can be saved tofile using the Savebutton.

    There are two file types handled. The first is plain-text. Assembly programs are saved as regular

    plain-text files (often called text-only) and usually with .aor .asmfile extension. By default,this is the format used when saving your source code in the EdSim51 Simulator.

    The

    other

    file typeis Intel

    HEX.

    The user

    can

    select tosave a

    file in

    HEXformat

    by

    choosingIntel

    HEX

    Files

    from theFiles

    ofType:

    menu inthe Save

    dialog

    box.Find out

    more on

    loading

    andsaving

    IntelHEXfiles.

    To make the simulator more user-friendly, the last directory accessed (either through loading a

    file or saving a file) will be remembered. Therefore, the next time the user opens a file dialogbox by clicking on either the Loador Savebuttons, the dialog box automatically opens in the

    last directory visited.

    http://www.edsim51.com/intelHex.htmlhttp://www.edsim51.com/intelHex.htmlhttp://www.edsim51.com/intelHex.htmlhttp://www.edsim51.com/intelHex.htmlhttp://www.edsim51.com/intelHex.html
  • 7/27/2019 EDSIM.docx

    15/44

    Copy and Paste

    You can select code in the assembly text area and copy it to the system clipboard using the Copybutton, the same as you do in your word processing package. This can then be pasted elsewhere

    in the assembly text area, using the Pastebutton (if the text area is editable - white background -

    if it is not, click Reset). Or you can paste the selected text into some other application (such asyour word processor). Similarly, you can copy text from another application and paste it into the

    assembly text area.

    A Few Notes on the Assembler

    The 2-pass assembler with the EdSim51 Simulator is not a full-blown assembler. It does not linkmultiple files and only some of the directives you might expect are implemented. However, I feel

    it is adequate for the beginner. Below is a list of its features:

    All of the 8051 instructions are implemented, except for MOVXinstructions, as the

    simulator does not handle external memory.

    JMP relequates to either SJMP relor AJMP rel. LJMP relmust be

    programmed explicitly.

    Similarly, CALLequates to ACALL. LCALLmust be programmed explicitly.

    SETand EQUdirectives are implemented.

    ORGis implemented.

    USINGdirective (states which register bank is being used) is implemented.

    ARnequates to the register address, as specified by USING(if the register bank is not

    specified prior to ARn's use, register bank 0 is assumed).

    SFR names and SFR bit names equate to the appropriate address. HIGHfollowed by an operand in brackets equates to the high byte of the operand.

    LOWfollowed by an operand in brackets equates to the low byte of the operand.

    Labels are followed by a semicolon.

    The default for numerical values is decimal. Hex values can be entered by appending H

    after the number, or placing 0xbefore it. If His used, the number cannot begin with a

    letter (example: F5Hmust be written as 0F5H). Binary values are entered by appending

    Bafter the number (as shown in the image below).

    The assembler is not case-sensitive.

    Debugging

  • 7/27/2019 EDSIM.docx

    16/44

    Regardless of whether thecode is running or being

    stepped, once the code

    assembles without errors,

    the address of each

    instruction is displayed tothe left.

    When stepping through

    the code, the instruction

    that was just executed isshown in the grey box at

    the top, together with the

    instruction's address

    (example shown:Executed 0x2A: MOV

    90H, A).

    The next instruction to beexecuted, its address is

    highlighted. (002CH).

    Breakpoints

    A breakpoint can be set by double-clicking the instruction's address, as shown in the images

    below.

  • 7/27/2019 EDSIM.docx

    17/44

    Setting a breakpoint:When stepping through

    the code, move the

    mouse over the address

    of the instruction and

    double-click.

    When the breakpoint is

    set the vertical bar (|)

    immediately to the right

    of the address is

    replaced by a star (*), as

    shown in the image on

    the right.

    Removing a

    breakpoint: A

    breakpoint is indicated

    by a star (*). To remove

    the breakpoint, move

    the mouse over the

    instruction's address and

    double-click. The *is

    replaced by |.

    Alternatively, you canremove all breakpoints

    with one click of:

    When the program is running and a breakpoint is encountered execution halts just before that

    instruction. In other words, the next instruction to be executed will be the breakpoint instruction.The programmer can then step through the code, or run the program, from that point.

    The Peripherals

    Note: The logic diagrams in this section were drawn for the default peripheral interface. You

    may wish to alter this interface, which you can do by clicking on the DIbutton (see the imagebelow). You can also view the logic diagram for the new interface by clicking on the LDbutton

  • 7/27/2019 EDSIM.docx

    18/44

    (again, see the image below).

    Also, there are instances in the following section where the sharing of port pins is pointed out.

    For example, the motor and the UART share the same port pins. This of course may not be true

    in your case, if, for example, you move the motor to other pins.

    The Peripheral Panel

  • 7/27/2019 EDSIM.docx

    19/44

    The Dynamic Interface Panel - remap the peripherals |full size image

    http://www.edsim51.com/8051simulator/images/screenShots/dynamicInterfaceLarge.pnghttp://www.edsim51.com/8051simulator/images/screenShots/dynamicInterfaceLarge.pnghttp://www.edsim51.com/8051simulator/images/screenShots/dynamicInterfaceLarge.pnghttp://www.edsim51.com/8051simulator/images/screenShots/dynamicInterfaceLarge.png
  • 7/27/2019 EDSIM.docx

    20/44

    An Instance of the Dynamic Logic Diagram

    The Peripherals:

    ADC

    Comparator

    Four 7-segment LED Displays

    LCD Module

    UART

    Keypad

    LED Bank

    Bi-directional Motor

    Switch Bank

  • 7/27/2019 EDSIM.docx

    21/44

    DAC (output displayed on oscilloscope)

    These image on the left shows what is connected

    to each of the 32 port pins. If a pin's descriptionis too long to fit, you can see the full description

    by hovering the mouse over it, or by clicking onthe zoom button (see below).

    Zoom

    Click on one of the buttons marked + to displaythat port's connections in a separate window. Anexample for port 2 is shown below.

    Port Pin Connections

    The logic diagram below gives details of the peripheral interfacing.

  • 7/27/2019 EDSIM.docx

    22/44

    EdSim51 Simulator Peripheral Logic Diagram

    The LED Bank, DAC and the 7-segment Displays

    As can be seen in the diagram below, the LED bank, the DAC inputs and the 7-segment display

  • 7/27/2019 EDSIM.docx

    23/44

    data lines all share port 1.

    The selection of which of the four displays is enabled is done via P3.3 and P3.4. These port pinsare applied to a 2-to-4 line decoder, the outputs of which are applied to the base of transistors

    that enable/disable the displays.

    Logic diagram showing the LED bank, DAC and 7-segment display connections only.

    The decoder is enabled via a logic 1 on P0.7. This pin is also applied to the DAC WR input,which is active-low. Therefore, to write data to the DAC the programmer disables the displays,

    which also has the effect of enabling the DAC's data lines. Data can then be written to the DAC.Whatever is on the inputs when the WR line is taken low is stored in (or written to) the DAC's

    internal register and remains there after the WR line is taken high. The analogue output for this

    data will be displayed on the scope until the next time WR is taken low and a new value is placedin the internal register.

    The keypad can be implemented using the external interrupt 1 line (seekeypad), but not while

    http://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypad
  • 7/27/2019 EDSIM.docx

    24/44

    also multiplexing the 7-segment displays. This is because the external interrupt 1 line (P3.3) isalso used by the display decoder (see logic diagram above). Therefore, keypad interrupt andmultiplexing the 7-segment display cannot be used at the same time - the keypad AND gate

    should be disabled.

    An example of the DAC in action is shown below:

    Ramp Generated via DAC Appears on Scope Code for

    Ramp

    Generatio

    n

    LED Bank and the

    7-segment Displays

    Panel

    The code that generated the above ramp is also shown (above middle). The DAC's WR input is

    taken low permanently (CLR P0.7) while the value in the accumulator is sent to the DAC's

    inputs, increased by 8 and then sent to the inputs again, and so on.

    When the mouse is placed over the scope screen, a tooltip appears, stating the scope's vertical

    scale is one volt per division and the horizontal scale is, in this case, 25 microseconds perdivision. The scope's horizontal scale is tied in with the 8051 system clock frequency (this is

    unrealistic, but I feel it's adequate for simulation purposes). If, for example, the system clockfrequency is changed to 11.059 MHz, then the scope's horizontal scale is 17.36 microseconds per

    division.

  • 7/27/2019 EDSIM.docx

    25/44

    The LCD Module

    As can be seen in the logic diagram below, the LCD Module also shares port 1 with the LEDs

    and DAC.

    Logic diagram showing the LED bank, DAC and

    LCD module connections only.

    4-bit Mode: The LCD module is a

    simulation of the Hitachi HD44780

    and is interfaced to the 8051 in 4-bit

    mode. P1.7 through P1.4 are

    connected to DB7 through DB4,while P1.3 is connected to the

    register-select pin and P1.2 is

    connected to the enable pin. Noticethe read-write pin is connected to

    ground - the module can only be

    written to.

    8-bit Mode: By default, as statedabove, the module is interfaced in 4-

    bit mode. However, the lower four

    data bits (DB3 through DB0) arealso available (on P1.3 throughP1.0). If the user wishes to write to

    the module in 8-bit mode, RS and E

    should be remapped to other port

    pins, using the DIbutton at the topleft of the peripheral panel.

    Details of the pin functions and the

    instructions for the LCD module are

    given below. For details on how to

    communicate with the module, seeHD44780.pdfand somesampleprograms.

    Reading:Instructions for readingfrom the module have not beenimplemented.

    http://www.edsim51.com/8051simulator/HD44780.pdfhttp://www.edsim51.com/8051simulator/HD44780.pdfhttp://www.edsim51.com/examples.html#prog4http://www.edsim51.com/examples.html#prog4http://www.edsim51.com/examples.html#prog4http://www.edsim51.com/examples.html#prog4http://www.edsim51.com/examples.html#prog4http://www.edsim51.com/examples.html#prog4http://www.edsim51.com/8051simulator/HD44780.pdf
  • 7/27/2019 EDSIM.docx

    26/44

    Character Blinking:Because the

    simulator does not run in real-time,it would be hard to know if the

    module was blinking. Therefore, if

    the programmer sets the module to

    blinking (seeDisplay on/off controlinstruction below), the cursor

    position character alternatesbetween blue text with red

    background and red text with blue

    background. In this way the

    programmer knows at a glance ifthe module is in blinking mode

    (when not in blinking mode, all

    characters are black with grey

    background).

  • 7/27/2019 EDSIM.docx

    27/44

    The enable pin(E, connectedto P1.2) is

    negative-edge

    triggered. On a

    negative-edgeon E, the

    module reads

    the data linesDB7 - DB4.

    4-bit Mode: As

    can be seen inthe logic

    diagram above,

    the module is

    interfaced withthe 8051 in 4-

    bit mode. In 4-

    bit mode, themodule's lines

    DB3, DB2,

    DB1 and DB0are not used.

    The 8-bit

    instruction or

    data must

    therefore besent in two 4-

    bit nibbles. Thehigh nibble is

    sent first,

    followed by thelow nibble.

    When the

    enable pin is

    taken high andthen low, this

    causes themodule to read

    the pins DB7-DB4 and store

    them in either

    the IR (if aninstruction is

    being sent - ie:

  • 7/27/2019 EDSIM.docx

    28/44

    RS = 0) or theDR (if data isbeing sent - ie:

    RS = 1).

    Initially, the

    module is in 8-bit mode and

    must be set to

    4-bit mode bythe programmer

    before any

    other

    communications with the

    module are

    attempted. This

    is done bysending the

    appropriate

    Function Setinstruction (see

    instruction set

    below).

    Why send

    Function set

    twice? As

    stated, themodule is

    initially in 8-bitmode,

    therefore the

    first instructionsent to it is read

    as an 8-bit

    instruction (as

    if DB3 - DB0were in use). If

    the correctinstruction is

    sent (with DL -on DB4 - set to

    zero, indicating

    4-bit - seebelow), then

    the module

  • 7/27/2019 EDSIM.docx

    29/44

    'knows' it isbeing set to 4-bit operation

    and it reads

    instructions and

    data in two 4-bit nibbles from

    then on.

    Because itreads the high

    nibble first, the

    Function set

    high nibblemust be sent

    again, followed

    by the low

    nibble.For more

    information,

    see pages 39and 42 of

    HD44780.pdf.

    The example onpage 42 is for a

    1-line display,

    but it

    nonetheless

    explains clearlyhow to initialise

    andcommunicate

    with the

    module in 4-bitmode.

    8-bit Mode:Even if 8-bitmode is being

    used,Functionsetmust first be

    called to ensurethe module is

    set to 2-line

    with 5 X8 font.See below.

    http://www.edsim51.com/8051simulator/HD44780.pdfhttp://www.edsim51.com/8051simulator/HD44780.pdfhttp://www.edsim51.com/8051simulator/HD44780.pdf
  • 7/27/2019 EDSIM.docx

    30/44

    2-line, 5 X8Font: The lownibble of

    Function set

    must be sent

    with N = 1(setting the

    number of lines

    on the displayto 2) and F = 0

    (setting the font

    to 5 X8 dots).

    Function Set

    Incorrectly:The

    programmermust set themodule to 2-

    line, 5 X8

    font. Thesimulation of

    the HD44780

    isimplemented

    for 2-line, 5 X8 font only.

    However, theprogrammer is

    still expected

    to write thecode that sets

    the module in

    this mode. If

    the mode isnot set

    correctly, an

    error message

    stating such isdisplayed, as

    shown here.

    Theprogrammer

    must then

    reset thesimulator,

  • 7/27/2019 EDSIM.docx

    31/44

    modify thecode and tryagain.

    LCD Module Instruction Set

    CGRAM

  • 7/27/2019 EDSIM.docx

    32/44

    CGRAM stands for character generator RAM. The module's ROM contains theASCIIcharacterset. For example, the ASCII code for the letter W is 87, so stored in location 87 in the module'sRAM is the pattern for W. This makes it relatively easy to write text to the display. The

    following code extract illustrates this point:

    MOV A, 'W'CALL sendCharacter ; a subroutine that sends the data in A to the LCD module's

    DDRAM

    When DDRAM receives a character, the corresponding pattern from ROM is displayed.

    Note in the ASCII set, the first seven locations are used for control characters. These charactersare not applicable to the LCD module, therefore these locations are reserved for CGRAM

    instead. When a value in the range 0 to 7 is sent to DDRAM, instead of displaying a character

    from ROM, the corresponding character from CGRAM is displayed.

    This means the user can create eight custom characters. The characters are programmed into

    CGRAM by pointing to CGRAM (instead of DDRAM) and then sending data to the module thesame as when sending data to DDRAM.

    If you look at the instruction set above you will see there is a Set CGRAM address instruction.

    Note the address is six bits in length - we will discuss these six bits shortly.

    Also notice there is only one instruction for writing to the module. To write to CGRAM, youmust first ensure the AC (address counter) is pointing to CGRAM. You do this by calling the Set

    CGRAM address instruction. As with writing to DDRAM, the AC is incremented (or

    decremented, depending on the increment/decrement setting) after each write to CGRAM.

    It was mentioned above that ROM contains the ASCII set. This is not altogether true. There are

    instances where the character in ROM does not correspond with ASCII. At location 92 youwould expect to see the \ symbol. Instead there is (probably because the HD44780 wasdeveloped in Japan). At location 126, instead of ~ in location 126 there is a right arrow symbol,

    followed by a left arrow symbol in location 127.

    So, if you want to display the \ symbol, for example, you will first need to create it in CGRAM.You can choose any of the eight CGRAM locations, but let's say we wish to put \ in location 2.

    Each character is made up of eight rows, with five dots in each row. You write the pattern for

    each row to CGRAM, one row at a time. The row's pattern is made up of 1s where dots are to bevisible and 0s where dots are to be invisible.

    The six CGRAM address bits are split into two parts. The top three bits determine which of theeight CGRAM characters is being written to, while the bottom three bits determine which of theeight rows of this character is being written to.

    CGRAM Character

    Address (binary)Row Address

    (binary)Value Written to

    CGRAM

    010 000 | | | | | 00000B = 00H

    http://www.asciitable.com/http://www.asciitable.com/http://www.asciitable.com/http://www.asciitable.com/
  • 7/27/2019 EDSIM.docx

    33/44

    010

    010

    010

    010

    010010

    010

    001

    010

    011

    100

    101110

    111

    | | | | |

    | | | | |

    | | | | |

    | | | | |

    | | | | || | | | |

    | | | | |

    10000B = 10H

    01000B = 08H

    00100B = 04H

    00010B = 02H

    00001B = 01H00000B = 00H

    00000B = 00H

    The three character bits and the three row bits make up the 6-bit CGRAM address.

    Note that the top row is row 0 while the bottom row is row 7 (111B). You can use the bottom

    row when creating a custom character, but it is not advisable to do so, especially if you intend

    using the cursor as well.

    The example above shows how to create the \ symbol in CGRAM location 2. You start by setting

    CGRAM address to 2, then send the pattern for the character's first row to CGRAM (in this case,00H). The AC will automatically increment to point to the next row. You then send the pattern

    for that row (in this case, 10H), and so on for all eight rows.

    Once completed, you can then display your new character by setting the DDRAM address to

    some value, then send the number 2 to DDRAM and your new character in CGRAM location 2

    will appear on the display.

    You might then write a test, as shown below, to ensure the correct symbol is displayed when

    writing \ to the LCD:

    ... ; data to be sent to LCD has been placed in ACJNE A, #'\', skip ; if A does not contain \ symbol, skip next line

    MOV A, #2 ; replace \ with location of \ in CGRAM

    skip: CALL sendCharacter ; call the subroutine that sends the contents of A to theLCD

    For complete instructions on how to program the LCD module, seeHD44780.pdf.

    The Switch Bank and the ADC

    http://www.edsim51.com/8051simulator/HD44780.pdfhttp://www.edsim51.com/8051simulator/HD44780.pdfhttp://www.edsim51.com/8051simulator/HD44780.pdfhttp://www.edsim51.com/8051simulator/HD44780.pdf
  • 7/27/2019 EDSIM.docx

    34/44

    When aswitch is

    open a

    logic 1

    appears

    on theport pin

    (via thepull-up

    resistor)

    whileclosing

    the

    switch

    connectsthe pin

    directlyto ground

    - logic 0.

    Theswitch

    bank and

    theoutputs

    of the

    ADC are

    appliedto port 2.

    Therefor

    e, it

    should benoted

    that

    when the

    ADC is

    being

    used the

    switchesin the

    switch

    bank

    should

    all beopen(in

    the

  • 7/27/2019 EDSIM.docx

    35/44

    simulator, the

    switches

    are grey

    when

    they areclosed).

    If aswitch is

    closed it

    doesn'tmatter

    what the

    ADC

    tries toput on

    that line,the line is

    held lowbecause

    it is

    connected directly

    to ground

    through

    theclosed

    switch.Logic diagram showing the switch bank and ADC connections only.

    The outputs of the ADC are tri-state:

    the RD line, which is connected toP3.7, must be low for the ADC

    reading to appear on the outputs.

    The WR line (connected to P3.6) is

    used to initiate a conversion. As it ispositive edge triggered, it must be

    taken low and then high to start aconversion.

    When the conversion is complete the

    INTR line goes low (and remains low

    until another conversion is initiated).This line is applied to the external 0

    interrupt line, INT0. In this way, the

  • 7/27/2019 EDSIM.docx

    36/44

    8051 can be interrupted by thecompletion of an ADC conversion.

    Note the tip that appears when the

    mouse is placed over the ADC button.

    Clicking on this button disables theADC and enabled the comparator. See

    theComparatorfor moreinformation.

    Switch Bank and the ADC Panel

    The function of the ADC pins are summarised in the following table:

    Pin Function

    RD Enables the tri-state outputs, when logic 0.

    WR On a positive edge, initiates conversion.

    INTRGoes to logic 0 when conversion is complete and remains low until anotherconversion is initiated.

    i/p Analogue input signal applied here.

    CS Enables the device, when logic 0.

    D0 -D7

    Tri-state digital outputs.

    Changing Switch Labels

    You can change the label of

    a switch in the switch bank

    by right-clicking on the

    switch and entering a newcharacter.

    A switch label can only beone character in length.

    The Comparator and the DAC

    Many lecturers like to get their students to develop their own ADC using a DAC and a

    comparator. To meet this need, the output of the DAC is also applied to the inverting pin of a

    comparator, as shown in the logic diagram extract below.

    http://www.edsim51.com/simInstructions.html#comparatorhttp://www.edsim51.com/simInstructions.html#comparatorhttp://www.edsim51.com/simInstructions.html#comparatorhttp://www.edsim51.com/simInstructions.html#comparator
  • 7/27/2019 EDSIM.docx

    37/44

    Logic diagram showing the comparator and DAC connections only (notice the ADC is

    disabled, therefore its connections to the 8051 are not shown).

    The analogue input that is applied to the ADC is also

    applied to the non-inverting pin of the comparator, as can

    be seen above (in this extract, since the ADC is disabled,

    the analogue voltage connection to the ADC is omitted).When the comparator is enabled, the button's label says

    Comparator, as can be seen in the image opposite.

    Hovering over the button displays a tip - click the buttonto disable the comparator and enable the ADC.

    The button corresponds to the switch at the ADC chipselect and the switch between the comparator output and

    P3.7 in the logic diagram extract above. You can see the

    switch between the comparator output and P3.7 is closed

    while at the same time the ADC CS line is switched to+V, disabling the ADC.

    Comparator Panel

  • 7/27/2019 EDSIM.docx

    38/44

    When the comparator is enabled it can then be used together with the DAC to implement anADC. There are many techniques that can be used.

    Learn about comparators and DACs used as ADCs(An external site that is not affiliated with

    EdSim51.)

    The Motor

    P3.0 and

    P3.1 are

    applied to adual bridge

    driver, the

    outputs ofwhich are

    applied to a

    bi-directionalDC motor.

    The truth

    table for the

    bridge andits effect on

    the motor is:

    A B motor

    0 0 stop

    0 1 forward

    1 0 reverse

    1 1 stop

    Logic diagram showing the motor and UART connections only.

    In the imageon the left,the motor's

    shaft is in the

    default

    position(pointing at 3

    http://www.allaboutcircuits.com/vol_4/chpt_13/5.htmlhttp://www.allaboutcircuits.com/vol_4/chpt_13/5.htmlhttp://www.allaboutcircuits.com/vol_4/chpt_13/5.html
  • 7/27/2019 EDSIM.docx

    39/44

    o'clock).Notice the

    sensor

    (depicted by a

    vertical line

    at the top ofthe motor) is

    black.

    When the

    motor's shaftlines up with

    the sensor,

    the sensor

    changes fromblack to red,

    as shown inthe image onthe right.

    Motor Panel

    The motor sensor, which is applied to P3.5, goes low once every revolution (in the simulator,whenever the motor shaft lines up with the sensor, the sensor changes from black to red and P3.5

    goes to logic 0). P3.5 is the external clock source for timer 1. Therefore, code can be written that,

    using timer 1, counts the motor's revolutions.

    The speed of the motor can be varied manually (using the slider to the right of the motor - take a

    look at the hardware screenshots above). This will make the rev. counting programs moreinteresting.

    Note: The motor control lines share the TXD and RXD lines for the 8051's internal serial port.As can be seen in the logic diagram extract above, these lines are also connected to the external

    UART. Therefore, when exercising the motor, garbage messages may appear in the UART's

    receiver window. The function of the external UART is explained below.

    The motor can be disabled by clicking on the Motor Enabledbutton. Why would you want to

    disable the motor? See The UARTbelow.

    The UART

  • 7/27/2019 EDSIM.docx

    40/44

    As stated above, themotor control lines

    share the same port

    pins as the 8051

    serial port RXD and

    TXD. An externalUART is connected

    to P3.0 and P3.1.

    Data received from

    the 8051's serialport appears in the

    Rxwindow. Thedata in this window

    can be cleared at

    any time by

    clicking the RxResetbutton.

    External UART Panel

    Data can be transmitted to the 8051's serial port by typing text in the Txwindow and clicking on

    the Tx Sendbutton, which initiates transmission. When this button is clicked, the Txwindow's

    background colour changes to grey, indicating the window is not editable. The title of the Tx

    Sendbutton changes to Tx Reset. Clicking on the button at this point clears the Txwindow. Its

    background colour changes back to white - the user can type more text and click Tx Sendto

    restart transmission.

    The data transmitted by the external UART is terminated with the \rcharacter (theASCIIcodefor \ris 0DH). In other words, when the text abcis transmitted by the UART, the actual data

    sent is abc\r(or, in ASCII - 61H 62H 63H 0DH). The UART can also transmit a list of 8-bit

    numbers instead of text. SeeHEX in Uartfor more information.

    The UART's default Baud rate is 4800. The user can select from a drop-down list of standardBaud rates (as can be seen below). Whenever the Baud rate is changed, the external UART's

    receiver and transmitter are reset.

    The UART can be set to even parity, odd parity or no parity by clicking on the Paritybutton,

    cycling through the three options:No Parity(the default), Odd Parityand Even Parity.

    For more information on the 8051 serial port and on adding a parity bit, clickBeginner's Guide

    to the 8051 - Serial Port.

    When communicating with the UART, the pins P3.0 and P3.1 will therefore be changing value,which will have the side effect of turning the motor. To stop this, the user can click the Motor

    http://www.asciitable.com/http://www.asciitable.com/http://www.asciitable.com/http://www.edsim51.com/simInstructions.html#hexInUart2http://www.edsim51.com/simInstructions.html#hexInUart2http://www.edsim51.com/simInstructions.html#hexInUart2http://www.edsim51.com/8051Notes/8051/serial.htmlhttp://www.edsim51.com/8051Notes/8051/serial.htmlhttp://www.edsim51.com/8051Notes/8051/serial.htmlhttp://www.edsim51.com/8051Notes/8051/serial.htmlhttp://www.edsim51.com/8051Notes/8051/serial.htmlhttp://www.edsim51.com/8051Notes/8051/serial.htmlhttp://www.edsim51.com/simInstructions.html#hexInUart2http://www.asciitable.com/
  • 7/27/2019 EDSIM.docx

    41/44

    Enabledbutton which has the effect of disabling the motor (the button's title then changes toMotor Disabledand the motor can be re-enabled by clicking the button again).

    UART Transmitting HEX Data

    Rather than text, a list of 8-bit numbers(written in HEX) can be transmitted. To

    do so, the user encloses the list in curlybraces, each number separated by a

    comma, as shown in the image opposite.

    When text is transmitted, it is terminated

    by 0DH. This is not the case with a list

    of numbers. In the example shown

    opposite, the four numbers 56, 3a, 23and e7 are transmitted, nothing more.

    If the user wishes to send {56, 3a, 23, e7} as text rather than a list of 8-bit numbers, the text isescaped using the \ character. Therefore, \{56, 3a, 23, e7} in the Tx field would result in {56,

    3a, 23, e7} followed by 0DH being transmitted to the 8051.

    The Keypad

  • 7/27/2019 EDSIM.docx

    42/44

    Logic diagram showing the keypad connections only.

    The 4 X3 keypad is interfaced in a standard format, as can be seen in the logic diagram extract

    above. All of port 0's pins, except pin 7, are used by the keypad.

    External 1 Interrupt: The 3 columns are connected to the inputs of an AND gate, the output of

    which is connected to P3.3, the external 1 interrupt pin. The AND gate is disabled (by default)

    because this pin (P3.3) is also used by the display-select decoder (seeDisplayabove). To makeuse of the external 1 interrupt with the keypad, make sure the AND gate is enabled. But

    remember, you won't be able to multiplex the displays and use keypad interrupts at the

    same time. Instead you should use busy-waiting on the keypad.

    Key Bounce

    If Key Bounceis enabled, as shown in the image

    opposite, then the keys will bounce when closed (the

    keypad only bounces if thekeypad modeis set tostandard). So the user knows a key is bouncing, its

    colour alternates between red (switch open) and dark red

    (switch closed). Once the switch finishes bouncing, itscolour reverts to dark grey. The length of the switch

    bounce is 30 ms.

    Note: a key will only bounce while a program is

    running. If the user pauses the running program,

    then the switch bounce also pauses.

    Notes on interfacing to a keypad:Beginner's Guide to the 8051 - Peripheral Interfacing

    Keypad Modes

    Next to the keypad is a menu (see image above). This gives the user a choice of three settings for

    the type of keypad. By default the keypad mode is set to Standard. The other two types are

    Pulseand Radio.

    Standard- in standard mode the keys are independent of each other. Any number of

    keys can be closed at the same time. A closed key is reopened simply by clicking on it

    again.

    Pulse- in pulse mode a key is closed while the (left) mouse button is held down. Oncethe mouse button is released the key reopens.

    Radio- in radio mode only one key at a time can be closed. For example, if key 5is

    pressed (ie: closed) and then key 7is pressed, key 5automatically reopens. As in

    standard mode, a closed key is reopened simply by clicking on it again.

    When the user switches to another keypad mode, using the adjacent menu, all closed keys are

    automatically reopened.

    http://www.edsim51.com/simInstructions.html#ledshttp://www.edsim51.com/simInstructions.html#ledshttp://www.edsim51.com/simInstructions.html#ledshttp://www.edsim51.com/simInstructions.html#keypadModeshttp://www.edsim51.com/simInstructions.html#keypadModeshttp://www.edsim51.com/simInstructions.html#keypadModeshttp://www.edsim51.com/8051Notes/interfacing.html#keypadhttp://www.edsim51.com/8051Notes/interfacing.html#keypadhttp://www.edsim51.com/8051Notes/interfacing.html#keypadhttp://www.edsim51.com/8051Notes/interfacing.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadModeshttp://www.edsim51.com/simInstructions.html#leds
  • 7/27/2019 EDSIM.docx

    43/44

    Changing Key Labels

    You can change the labelof a key by right-clicking

    on the key and entering a

    new character. Key labelscan be any length. The

    keypad resizes

    automatically.

    Saved Settings

    The following settings are saved during the simulator shut down process:

    Original Setting

    Update Freq. 1

    Bitfield Address ACC

    Data/Code Memory Data Memory

    File System Directory Operating System Dependent

    ADC/Comparator Enabled ADC Enabled

    External UART Parity No Parity

    External UART Baud Rate 4800 Baud

    Keypad AND Gate Disabled

    Keypad Type Standard

    Key Bounce No Key Bounce

    Key Labels #, 0, *, 9, 8, 7, 6, 5, 4, 3, 2, 1

    Switch Labels 0, 1, 2, 3, 4, 5, 6, 7

    Motor Enabled/Disabled Enabled

    These settings are saved in two files, edsim51diSettings.serand

    edsim51diHardwareSettings.ser . The files are (most likely) saved in the same folder as the

    edsim51di.jarJAR file on Windows or Mac and in the user's home folder on Linux. When the

    simulator is launched it tries to open these file. If the files exist then the information in them isused to restore the system settings to the values they were when the simulator was last shutdown. If the files do not exist or are corrupted in some way, they are ignored and the simulator is

    launched with the original settings.

    http://www.edsim51.com/simInstructions.html#updateFreqhttp://www.edsim51.com/simInstructions.html#updateFreqhttp://www.edsim51.com/simInstructions.html#bitfieldhttp://www.edsim51.com/simInstructions.html#bitfieldhttp://www.edsim51.com/simInstructions.html#dataCodeMemoryhttp://www.edsim51.com/simInstructions.html#dataCodeMemoryhttp://www.edsim51.com/simInstructions.html#loadSavehttp://www.edsim51.com/simInstructions.html#loadSavehttp://www.edsim51.com/simInstructions.html#switcheshttp://www.edsim51.com/simInstructions.html#switcheshttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#switchBouncehttp://www.edsim51.com/simInstructions.html#changingKeyLabelshttp://www.edsim51.com/simInstructions.html#changingKeyLabelshttp://www.edsim51.com/simInstructions.html#changingSwitchLabelshttp://www.edsim51.com/simInstructions.html#motorhttp://www.edsim51.com/simInstructions.html#motorhttp://www.edsim51.com/simInstructions.html#motorhttp://www.edsim51.com/simInstructions.html#changingSwitchLabelshttp://www.edsim51.com/simInstructions.html#changingKeyLabelshttp://www.edsim51.com/simInstructions.html#switchBouncehttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#keypadhttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#uarthttp://www.edsim51.com/simInstructions.html#switcheshttp://www.edsim51.com/simInstructions.html#loadSavehttp://www.edsim51.com/simInstructions.html#dataCodeMemoryhttp://www.edsim51.com/simInstructions.html#bitfieldhttp://www.edsim51.com/simInstructions.html#updateFreq
  • 7/27/2019 EDSIM.docx

    44/44

    Note:When stepping through or running code, the length of time that passes is not onlyexperiencedby the 8051, but by all the peripherals as well.

    If the instruction being executed is a 1 cycle instruction then, with a system clock is 12 MHz, the

    length of time passed is 1 us. Therefore, 1 us has passed for the UART and for the ADC and so

    on. In other words, if code is not being executed, time has stopped.

    If you have questions about the EdSim51 simulator, please visit ourCommentspage.

    Home

    Preferthe

    Original?

    NewEdSim51

    SH

    Aboutthe

    Simulator

    User's

    Guide

    Installation

    Instructions

    Examples

    ContactUs

    TheFundament

    alSimulation

    s

    Beginner's Guide

    to the8051 -Online

    Site

    Map

    Copyright (c) 2005-2012 James Rogers

    http://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/index.htmlhttp://www.edsim51.com/index.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://home/jrogers/Documents/softwareDevelopments/edsim51/simInstructions.htmlhttp://home/jrogers/Documents/softwareDevelopments/edsim51/simInstructions.htmlhttp://home/jrogers/Documents/softwareDevelopments/edsim51/simInstructions.htmlhttp://home/jrogers/Documents/softwareDevelopments/edsim51/simInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/map.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/8051Notes/index.htmlhttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/microDemohttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/bugs/index.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/examples.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://www.edsim51.com/installationInstructions.htmlhttp://home/jrogers/Documents/softwareDevelopments/edsim51/simInstructions.htmlhttp://home/jrogers/Documents/softwareDevelopments/edsim51/simInstructions.htmlhttp://home/jrogers/Documents/softwareDevelopments/edsim51/simInstructions.htmlhttp://home/jrogers/Documents/softwareDevelopments/edsim51/simInstructions.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/introduction.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/targetBoard.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/original.htmlhttp://www.edsim51.com/index.htmlhttp://www.edsim51.com/index.htmlhttp://www.edsim51.com/bugs/index.html