I'm using an AVR-atmega processor which controls a RTC. In the atmega, the time from RTC is saved as a struct:
typedef struct {
uint8_t year;
uint8_t month;
uint8_t hours;
uint8_t minutes;
"and so on..."
} time_t;
I have a global variable "time" (volatile time_t *time;) in the atmega.
I have written a C program to send an array with the current time via USB to the atmega in order to set the correct time on the RTC.
in the USB function on the atmega the code is as follows:
time = (void *) data;
where data is the array sent from my C program with the current time. is this the right way to do it? my problem is now that when I try to read the time from the atmega, i.e. the atmega returns my struct, I get random values now and then but most of the time I get time a actually set.
Hope I explained it somewhat understandable..
Thanks
// Noxet