BASCOM and instruction execution times

Status
Not open for further replies.

laser

Junior Member level 3
Joined
Sep 26, 2001
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
212
Hi all.
I´m thinking about starting to use BASCOM AVR, but first I would like to know if I can control execution times with this software.
This is easily achieved when programming in assembler, but when compilers are used, the programmer normaly does´nt have any control on how many clock cicles each instruction takes to execute.
And since I need to develop some timing sensitive applications, I would like to know if BASCOM is diferent, in this aspect.

Thank you all.
 

laser,

Most of compilers, in general C compilers, give you option to generate an assembly listing, interlaced or not with your high level code, so that you can easily (.....relatively easier) check for execution time and decide how optimize your code.

However BASCOM AVR, does not gives for this facility, that is it generate .hex file except for assembly listing. This is true till the version 1.11.6.2 at least. Cannot guarantee if newer versions, if any, have this facility.

For criticals routine (i.e. I/O) you can use inline asm directive, like this:

$ASM
Ldi R24,1 'load register R24 with the constant 1
St X,R24 ;store 1 into var c
$END ASM

Or, if you have free pins you can set a pin when routine start and reset it when routine elapsed. You must have an oscilloscope.

Or, much better use a C compiler. Even though BASCOM is a compiled basic, claimed for optimized, it is still BASIC. So you cannot have full control how routine you wrote will optimized.

If you want stand at BASIC, you can try FASTAVR BASIC. Try out www.fastavr.com. You should able to download a demo copy.
It generate for asm listing.
 

Compare between BASCOM and FastAVR, Which one should I choose and why?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…