Use multimedia timer library

  • This sample demonstrates the usage of the mmtimer library.
    Smallest resolution of the timer is 1 ms.

    Files

    • nd_mmtimer.zip

      (13.66 kB, downloaded 324 times, last: )

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,
    i suggest that such a component is not available for .NET. Note, code under .NET does not fulfill the real-time requirements. So a timer with a 1ms resolution makes no sense!
    I would do such measurements in a driver/application written c++ and access the data to from .NET application via windows messages or ... .

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Quote from "fs-support_ZU"

    Hello,
    i suggest that such a component is not available for .NET. Note, code under .NET does not fulfill the real-time requirements. So a timer with a 1ms resolution makes no sense!
    I would do such measurements in a driver/application written c++ and access the data to from .NET application via windows messages or ... .



    Hello,
    we are using OpennetCF framework that theorically allow "RealTimePriority" using threads.
    In my realtime thread I need to send CAN messages every 100ms exactly (+- 10 ms).
    In my thread I make the jobs and then sleep() the difference in ms to 100 for the other proccess.
    With another microcontroller board, I sniff can messages transmited by NetDCU10 and capture real time slices of that messages.
    Initially, 100ms CAN period seems to complain, but "sometimes", one CAN messages takes 120ms or 85ms ... so, there is a small desviation.
    After several test, it seems that this desviation is due to GUI refresh of operative system (I refresh some information in screen with Invoke / BeginInvoke) , but with no GUI refresh, CAN desviation seems dont ocurr.
    I have tried to increase CAN priority from register, too.
    So my question are:
    Which version of CAN driver use NetDCU 10? I'm not sure if it use v1, its manages through SPI ? Has then SPI interrupt influence?
    Can I decrease GUI refresh in "some way" in my applications, what doesit depend on?


    All your suggestions are really appreciated.

  • Hello,

    Quote

    we are using OpennetCF framework that theorically allow "RealTimePriority" using threads

    What does this mean? What does happens if the garbage collector starts? You have only real time ability using native code.


    Ok, 100ms are a lot of time, and i think you could manage it by set the priority of the "CAN thread" in your application very high (<100) and sleep in slices (25...5ms). After each slice you measure the time which is over form the last CAN action and if you are in the area of 100+/-10 you do you the current CAN action. This may not be the best solution but is is simple and may work. If you do not set the priority of the CAN thread within your app. it has the same priority as the GUI.


    PS: NetDCU10 CAN interface is SJA100 (and does not use SPI).

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello again.
    After several test and documents read, I understand that no real time is possible due tu garbage collection in .NET or managed code.
    So I',m trying to migrate part of my managed code to native code for CAN transmission.
    I have compiled a small application with VS2005 and C++ smartphone project for sending CAN messages with my specifications, its a .exe file and it works fine.
    Now I'd like to make a .DLL for smartphone and call this DLL from my managed code.
    I have not found any project example to follow for smartphone, and after 2 days trying to use my compiled C++ DLL, can not use it from my C# programm in WinCE.
    I have used DLL wizard, empty project,... but no results, I think there must be a problem with the way to export DLL functions, or to invoke from managed code.
    Someone have any small project / example code to see how to create a C++ DLL and use it from C# for WinCE ?


    Any other idea ?

  • Hello,
    - for how to create and use a DLL you will get a lot of samples from the www (e.g.http://en.wikipedia.org/wiki/Dynamic-link_library)
    - you dont need to use SDK for smartphones. In out downlaod (http://www.fs-net.de/download/bin/) you will finde SDK for your board.
    Hope this helps.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.