68HC11 & Code Performance

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...

Reply to
rasega
Loading thread data ...

I just run the subroutine 1000 times in a loop with a 'begin' and 'end' printout and time it with a watch

Reply to
BobG

main

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.

Reply to
Anthony Fremont

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

Reply to
rasega

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.

Reply to
BobG

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

Reply to
Jasen Betts

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

Reply to
stratus46

--
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.
Reply to
John Fields

Try to use my free simulator to test and measure code runtime.

formatting link

Peter

Reply to
peter

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.

Reply to
BobG

--
Thanks for your concern, but I prefer to remain incredible.
Reply to
John Fields

Sep 2005 21:46:17 +1200, Jasen Betts

pins when you enter it and clear it when you exit,

voltmeter to the pin, the voltage you see represents

spent in that section of code. if you want to

oscilloscope.

ignition

so it's only an aproximation

SET and CLEAR trick is OK, but you

counter and then, when

the SET and

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

by the

depends what the program does.

much of an HC11's RAM

storage, all he

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.

Motorola "S" records contain much more than just object

want to use them to determine the length of

assembler's output listing and

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

Reply to
Jasen Betts

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

Reply to
Jasen Betts

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.