For Julian Day, floating point is required. Since for the day part, it comprises the day and the fraction of the day. For example, the Julian day for June 4 now is different from a Julian day for June 4, 5 hours later by some value which is decimal in size. After computing for Julian day, I need to get the azimuth and altitude for motor controlling. The computations should be almost precise and every decimal value is needed. Sorry I didn't specify earlier.
The Keil Compiler can compute floating point numbers. The problem is that when the computation is long, it sometimes display error or hangs in the printf of hyperterminal, seperating it into 2 terms and combining it helps to make it work. The floating point support library is just for converting the int values to float or double then compute using normal C methods. Thanks.
''some chip vendors include their own printf function which will over-ride the compilers library version.''
Indeed (though not the case here). And, in such a situation, the vendor would also include documentation on any limitations of their implementation, and how to integrate it with their supported toolsets. And, of course, it all assumes an adequate 'C' competence in the user...
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
From PC time, how do you get the unix time and use it to set counter of RTC. RTC_SetCounter(PC time). Is there any special command to automatically get this, using ctime() displays time in readable time, but this does not get any value.
You would use y = mx + c, in situations where you have time scales with a different EPOCH, and/or different GRANULARITY, and you wish to convert them. For example NTP or FILETIME.
time() on the PC and UNIX share a common view of time. The value of time() on the STM32 will not contain the RTC value unless your library code hosts it that way, personally I'd just read the RTC register directly, and configure it to tick once per second.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
What do you mean by removing delta and then scale y=mx+c. How did this equation relate to getting the unix time. I tried using visual c++ and it displayed the value. Using Keil, there is no text written in hyperterminal when printf function is used after setting it up using RTC configuration. It only says RTC configured and nothing more when it should display the printf() afterwards. When I input the time manually, it displays the unix time after displaying RTC configured, what could be the problem? Thanks.
#include <time.h>
time_t seconds;
seconds = time (0);
printf (''%d seconds since January 1, 1970'', seconds);
Assuming the RTC counts in seconds the ''time'' function is easily implemented on STM32 like so:
time_t time(time_t *timer) { time_t t; mutex_lock(&rtc_mutex, 0); t = RTC_GetCounter(); mutex_unlock(&rtc_mutex); if (timer) *timer = t; return t; } You need the mutex if you are using a preemptive OS.
You will have to HOST the time() function with RTC_GetCounter() on the STM32, because Keil doesn't have a magic timer hidden anywhere.
Once you have a time value (from RTC_GetCounter()) you can use the library functions localtime(),globaltime(),asctime() and strftime() to decode/display the time, or implement your own. I recover the initial time setting on my system for a) an NTP server, b) a GPS receiver, or c) the cell network. If you have no such connectivity options, then the user will have to set the time into the RTC, or capture the time on a PC and inject it into your device when the user connects it.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..