This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I am using an MSP430F5659 with the internal RTC and am trying to implement the standard gnu time functions in my code.
I find in time.h, that "NOTE : clock AND time ARE SYSTEM SPECIFIC". So, I figured I just needed to implement time() and clock() to utilize the RTC and that would allow me to use all of the rest of the standard time and calendar functions in my code.
However, it appears that my implementation of time() is not being called - some other function is being linked in. And, of course, it doesn't work.
Can anybody give me a pointer on how to overload the library function with my own local function? Is this even the correct way to implement the standard time functions?
Any help would be appreciated.
Hi,
I think, there is a RTC.h include file in your main. Also there are few functions in assembly that are used by higher level functions to keep track of calender time (increamentSeconds, increamentminutes, incrementhours and...).I do not think that you can overload these functions at your application layer. But you might want to completely exclude them from your project .
Regards,
Yes, the rtc.h is included in driverlib and is the header for some driver level functions of the on-board real time clock/calendar.
However, I am wanting the convenience of the standard time functions such as difftime, strftime, etc.
What I am wanting to do is use the on-board rtc hardware to drive the standard library time and calendar functions. When I examined 'time.h' in the MSP430 build tools, it looked like all I had to do was implement the time() function and construct it so as to utilize the on-board rtc hardware.
My question is, is this the right approach? And if so, how do I go about replacing the function that seems to be being linked in by the linker.
Another item of info: I am using Code Composer Studio 5.5.
Thanks in advance.
Hi Mark,
I know your RTClib includes assembly routine RTC_TA which configures your timer A (I think) for a 1 second interrupts , assuming 32.768 KHZ XTAL. If you have a different XTAL or you need to configure a different timer on the target you need either to modify the existing assembly code RTC_TA or rewrite your code in c and delete the existing library.In this case what you are currently doing is correct way to go if you include proper initialization for your timer and RTC hardware. Otherwise you can use the existing Lib's routines to create other higher level functions. (i.e. difftime,..)
Regards,
**Attention** This is a public forum