![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: Windows Multimedia Timer adapter 4.0.1 Topic Summary: Created On: 27-Apr-2005 21:02 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|||
These are instruction on how to use the Windows Multimedia Timer with Rhapsody.
1. Extract the WinMMTPkg.zip to your generated code directory. It should extract 3 files, WinMMT.lib, MyTimerFactory.h, MyWinMMTimer.h. 2. In your Rhapsody project, place the following libraries into the "Library" field of your component: winmm.lib,WinMMT.lib 3. For your component configuration, change the property CG::Configuration: ![]() MyTimerFactory *myLLTimerFactory = new MyTimerFactory; OXF::setTheTickTimerFactory((OMAbstractTickTimerFactory *)myLLTimerFactory); 4. For your component configuration, change the property CPP_CG::Configuration::SpecificationProlog to have the following: #include "MyTimerFactory.h" 5. Now build and run your application. Your application will now be using the Windows Multimedia Timer. This timer is more accurate than the timer supplied with Rhapsody for the Windows OS. With the Multimedia Timer you can have a resolution down to 1 millisecond. To change the resolution for your timeouts, change the property CPP_CG::Framework::TimerResolution for your configuration. The lowest possible value is 1 and the default is 100 ms.
|
|||
![]() |
|||
![]() |
|||
Hi!
As this was just what I need to create a host and target version that are as similar as possible I downloaded it immediately. But I ran into trouble as we use the .NET environment which does not have the msvcirtd.lib required by the winMMT.lib. I tried, unsuccessfully as one would expect, to load the lib from my visualc++ 6.0. Is there anything one could do? I am not so keen on replacing the timer in oxf as I would need to find out how... I havent work on the lower side of oxf... if there is no other option I suppose thats what I need to do... best regards /lars-arne axelsson |
|||
![]() |
|||
![]() |
|||
We are using .NET too, so we have the same problem as mr. Axelsson.
Is it possible to have the sourcecode for the lib? ------------------------- Jesper Gissel Johnson Controls Denmark, Marine Controls |
|||
![]() |
|||
![]() |
|||
Attached is the code and original project for creating the WinMMT.lib. Good luck.
|
|||
![]() |
|||
![]() |
|||
Great, Thanks for the source.
There was no problem in compiling and using the MMTimer with .NET, but it seems to me, that the framework timer is more accurate than the MMTimer! :confused: If I change the timeout value from 10 to 1000 in the test statechart to get a longer test, I get 1006 ms from the framework timer, but the MMTimer gives me 1028 ms!!! Any comments on that? It should be noted, that I have not examined the code thoroughly yet, but when I get the time, I surely will... That is, if no one has done this for me at that time ![]() ------------------------- Jesper Gissel Johnson Controls Denmark, Marine Controls |
|||
![]() |
|||
![]() |
|||
jegissel,
You may need to tweak the CPP_CG::Framework::TimerResolution property. It is set to 1 ms in that test model. That causes a lot of overhead and actualy makes the timer run slower. As a rule of thumb, I typicly change it to whatever the lowest tm I have in my model. If that is indeed 1 ms then you may want to find another means of acheiveing this acuracy. One way is to use a hardware timer in conjunction with the Rhapsody triggered operations. Anyway, if you change this property to 10 instead of 1, you will see it is much more accurate. At least it was for me. |
|||
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.