Simulink Equivalent to 'now'?
3 views (last 30 days)
Show older comments
I have been declaring 'now' an extrinsic function in an embedded MATLAB function in Simulink. The trouble is, you can't use extrinsic functions in real time applications using Real Time Windows Target. There doesn't seem to be a Simulink block to access the system time.
I feel the need to write a C/C++ S-Function to try and give the same result. I've never written anything in C/C++ and I don't really think I'm going to be able to figure it out soon enough.
Can anybody help me out here? I kind of figured there would be something in the File Exchange, but searches like 'simulink system time' return huge applications that seem to have nothing to do with what I want.
Thanks in advance,
Zack
0 Comments
Answers (1)
Walter Roberson
on 30 Nov 2011
I would not really expect Simulink to have a block for that, unless it was a target-specific block, as there are a lot of embedded systems that do not have any time-of-day device.
Time-of-day devices need to have a battery backup, as they must keep counting while the system is otherwise turned off. Those batteries run out, making time-of-day devices unsuitable for situations where there is no interface for the user to input the time.
There is not just one way to interface time-of-day devices: some are port-mapped and some are memory-mapped and some involve running special instruction sequences.
4 Comments
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!