Subject: SDL-News: real-time simul. and time on microcontroller
doldi.laurent#wanadoo.fr
Date: Sun Feb 23 2003 - 18:07:49 GMT
Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From doldi.laurent#wanadoo.fr to sdlnews -----
Hi Scott,
There is no standard SDL statement returning the time unit.
To do real-time simulation :
- in ObjectGeode : real-time simulation is not available,
the time is discretized. If you set a 10000 time units
timer - SET(NOW+1000, T1) - you will not wait for 10000
seconds or milliseconds or etc. to see the timeout.
- in Tau SDL Suite Simulator : real-time simulation is
available, the time unit is seconds on Windows.
- other tools : I have not tried.
Concerning code generation for a target, the time unit
depends on the tool used and on the target. Here is an example
for a Motorola 68HC11 microcontroller, with C code generated
using ObjectGeode for bare systems (i.e. having no executive
on the target) code generation (my board has 32 kilobytes of
RAM and ROM):
A code fragment I wrote manually to get the current time
value (in seconds) in hc11second, by counting the
interrupts:
=================================================
long hc11second;
##pragma interrupt_handler RtiInt
void RtiInt()
{ static int tictac = 0;
if (++tictac >= 400){ /* for 12 MHz */
tictac = 0;
++hc11second;
}
TFLG2 |= 0x40;
}
##pragma abs_address:0xFFF0
void (*rtiint_vector)() = RtiInt ;
##pragma end_abs_address
=================================================
In lib/g2_com.h (file in the ObjectGeode library), I replaced
"time" with "hc11second" in :
extern long hc11second;
##define G2T_NOW() \
((GX_TIME_T)(hc11second / GX_TIMER_SCALE))
Then in the SDL model, the time unit is 1 second.
Naturally, you do not have to write such code for targets such
as VxWorks, win32 etc. where a clock is available.
Tau SDL Suite code generators (C Advanced or C Micro) provide
similar features.
Regards,
Laurent Doldi.
At 10:09 21/02/2003 -0800, you wrote:
>>>>
Hi all:
Sorry I didn't know my approach is specific to the tool and host that I use.
questions. I need to do real-time (realistic) simulation on my SDL design,
so is there any way in SDL I can know the time unit being used if I switch
tools or host systems? It sounds like that different tool/host will give me
different forms of NOW, in different time unit, when I run a real-time
simulation?
Regards, and thanks for all the comments,
Scott
Laurent DOLDI
*** book: SDL Illustrated *** see http://perso.wanadoo.fr/doldi/sdl
TransMeth Sud-Ouest
27, av. Segoffin 31400 TOULOUSE FRANCE
Tel.: +33 5 61 25 59 54 Fax: +33 6 07 74 87 71
Mobile: +33 6 80 26 62 31
--End text from doldi.laurent#wanadoo.fr to sdlnews ---
For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>
This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT