Hi Gussy,
Thanks for your reply!
I tried to insert some code to show you, but I got ‘you have entered a forbidden word’ warning?!
I’ll try again soon. Anyway, the initialization routine you mentioned - could it be here after Boot up()?
int main (void)
{
CCR &= ~(1<<0); //Disable the RTC
CCR |= (1<<1); //Reset the RTC
YEAR=2009;
MONTH=6;
DOM=9;
DOW=0;
DOY=0;
HOUR=13;
MIN=43;
SEC=0;
CCR &= ~(1<<1); //Enable the RTC
CCR |= (1<<0); //Enable the Clock
boot_up(); //Init LPC, IO pins, and FAT
//log_string(“Log started\r\n”);
set_pin_mode(1, “DI”);
char str_data[128];
string_printf(str_data, “%02d/%02d/%04d,%02d:%02d:%02d Data Goes Here\r\n”, DOM, MONTH, YEAR, HOUR, MIN, SEC);
log_string(str_data);
write_digital_pin(STAT1, ON); //Turn on LED
delay_ms(50);
write_digital_pin(STAT1, OFF); //Turn off LED
delay_ms(250);
delay_ms(700);
fat16_close_file(handle);
}
void log_string(char *buf)
{
int stringSize = strlen(buf);
fat16_write_file(handle, (unsigned char*)buf, stringSize);
sd_raw_sync();
}
//Basic file init and stuff
void boot_up(void)
{
set_pin_mode(STAT0, “DO”); //Set status LEDs as outputs
set_pin_mode(STAT1, “DO”);
rprintf_devopen(putc_serial0); //Open up serial port 0 for debugging
card_init(); //Init SD card interface
//Creat the main log file
char name[32];
string_printf(name,“PKDATA.txt”);
handle = root_open(name);
sd_raw_sync();
//Setup TIMER1 to run
T1TCR = 0; //Reset Timer1
T1PR = 60000; //Set prescalar to 60,000 - every tick is 1ms
T1TCR = 1; //Start Timer1
flash_it(50); //Flash Status Lights
}
Thanks again