Connect with us

68HC11 & Code Performance

Discussion in 'Electronic Basics' started by rasega, Sep 14, 2005.

Scroll to continue with content
  1. rasega

    rasega Guest

    Hi,
    I'm trying & debugging a little software wrote by me and some other
    friend of mine in 68HC11 Assembly code.
    Now I'd like to "benchmark" this software !!

    What's the best way to estimate and/or measure the duration of the main
    program or some little cycle ??
    How can I also know what's the dimension taken on 68HC11 RAM by the
    software since I know how many KB it takes on my pc ??

    Thank to All for any suggestion...
     
  2. BobG

    BobG Guest

    I just run the subroutine 1000 times in a loop with a 'begin' and 'end'
    printout and time it with a watch
     
  3. I usually toggle an i/o pin at the beginning and end of the routine.
    Then use an o-scope to measure the time.
    If you wrote it in assembler, you should "just know" the answer.
     
  4. rasega

    rasega Guest

    What about using the "time" function with PCBUG11 ??
    Sorry, I'm a newbie than...Why (and how !!) I "just know" the answer
    please ??
     
  5. BobG

    BobG Guest

    Each assembly language instruction takes from 2 to 6 cycles depending
    on how complicated they are, so laets say 3 cycles average, and a cycle
    is xtal/4, so 8mhz xtal->2mhz instruction cycle-> 500 or 600 thousand
    instructions per sec, 500 or 600 instruction per ms. So if you
    subroutine is 100 inline instructions, I bet it takes a 5th or a 6th of
    a sec. Time it and tell me if I'm right.
     
  6. Jasen Betts

    Jasen Betts Guest

    set one of the output pins when you enter it and clear it when you exit,
    attach an analogue voltmeter to the pin, the voltage you see represents
    the fraction of time spent in that section of code. if you want to
    measure duration attach an oscilloscope.
    that depends what the program does.
    as for how much memory the machinne code itself ocupies lookup the
    details on the motorola Srec format and open your assembler output
    in a text reader.

    Bye.
    Jasen
     
  7. Guest

    The reason you should 'just know' is that the assembler (any I've used)
    requires you to define the RAM locations you're going to use so you
    have a list. Count them up. The assembler likely generated a list file
    showing the memory locations used for RAM, tables and code.

    The software that would help is a simulator. Google for it as there may
    be some freeware. The simulator will display the running total of
    machine cycles used for each instruction. Knowing the crystal frequency
    and number of machine cycles vs crystal (its in the data book. The
    ..PDFs are freebie downloads from Freescale) you can tell the run time
    to the microsecond.

    GG
     
  8. John Fields

    John Fields Guest

    ---
    No. Benchmarking code isn't quite the same as setting ignition
    point dwell on a '55 Chevy. The SET and CLEAR trick is OK, but you
    need to use that signal to gate an external counter and then, when
    you get the result, subtract out the execution times of the SET and
    CLEAR instructions to get the real length of the cycle.
    ---
    ---
    No, it doesn't. All he wants to know is how much of an HC11's RAM
    is being used by his process and, since he assigned storage, all he
    has to do is count up them variables.

    In any case, his output listing should give him the last used byte
    of RAM and, since he orged the first byte, (or his assembler did
    when it was told what it was assembling for) a simple subtraction
    will define the space.
    ---
    ---
    I think you're trying to bullshit your way into an arena where you'd
    best not venture if you want to stay out of trouble.

    For example, Motorola "S" records contain much more than just object
    code, so why would you want to use them to determine the length of
    the program when you can use your assembler's output listing and
    save yourself a lot of grief?
     
  9. peter

    peter Guest

  10. BobG

    BobG Guest

    think you're trying to bullshit your way into an arena where you'd
    best not venture if you want to stay out of trouble.

    John Fields
    Professional Circuit Designer
    =================================================
    You should add a line that says "and Programming Expert" so we know
    there is some credibility behind all the bluster and accusatoy tone.
     
  11. John Fields

    John Fields Guest

     
  12. Jasen Betts

    Jasen Betts Guest

    so it's only an aproximation
    an osciloscope scope will tell you how long the pulse is,m if the clock ia
    stable that's enough.

    if that's all he does he'll get the wrong answer.
    you also need to add up all the stack space that could be in use
    simultaneously, and a number of other factors.
    Yeah that'd be easier.
    To tell the truth I forgot about the output listing...
    It's been a couple of months snce I laste programmed a microcontroller.

    Bye.
    Jasen
     
  13. Jasen Betts

    Jasen Betts Guest

    On 2005-09-18, John Fields <
    wrote
    so it's only an aproximatio
    an osciloscope scope will tell you how long the pulse is,m if th
    clock i
    stable that's enough.
    if that's all he does he'll get the wrong answer
    you also need to add up all the stack space that could be in us
    simultaneously, and a number of other factors
    Yeah that'd be easier
    To tell the truth I forgot about the output listing...
    It's been a couple of months snce I laste programmed
    microcontroller

    Bye
    Jase
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-