Synch_Time( void )
{
// this function waits for a 5 ms timer to expire
if (timer_expired)
loss_of_real_time_error = TRUE;
while (!timer_expired)
; // wait
clear timer interrupt
restart timer
}
void main( void )
{
Synch_Time(); // synch to 5ms timer
// run any functions that must be performed often here
switch (task)
{
// run any functions that don't need to be performed often here
case TASK_1:
Service_Application();
break;
case TASK_2:
Service_Sd_Card();
break;
case TASK_3:
Service_Lcd();
break;
case TASK_4:
break;
case TASK_5:
break;
}
if (++task > TASK_5)
task = TASK_1;
}
void Service_Lcd( void )
{
GOLDraw(); // function from Microchip Graphic's library that causes any objects that need to be drawn to actually be drawn
}
void Service_Application( void )
{
#define SPLASH_DISPLAY_TIME 3000/TASK_DELAY_MS // TASK_DELAY_MS is 25 (each task runs every 25 ms) so this time is 3 seconds
switch (app_state)
{
case APP_STARTUP:
InitLcd();
PutImage( (void *)splash_image );
timer = 0;
app_state = APP_DISPLAY_SPLASH;
break;
case APP_DISPLAY_SPLASH:
if (++timer == SPLASH_DISPLAY_TIME)
app_state = APP_CREATE_WIDGETS;
break;
case APP_CREATE_WIDGETS:
StCreate( ..... );
app_state = APP....;
break;
.
.
.
}
}
I know this will require some good cooperation between the few pics connected. I was thinking about having the master control the slave PICs by using I2C. Mainly because i can assign and use ADDRESSES on the PICs so i can identify them with out having a extra PIN tied up for each slave.
What do you think?
just use a separate one for the display and send it serial data from the main PIC
void main ()
{
unsigned char filename[40] = "TEST2.TXT";
unsigned char res, b1;
unsigned int result;
unsigned int count_in = 10;
unsigned int count_back;
DIR dir; /* Directory object */
FIL file1, file2; /* File object */
FATFS *fs;
//result = disk_initialize(0);
f_mount(0, &fatfs);
res = f_open(&file1, filename, FA_OPEN_EXISTING | FA_READ);
res = f_read(&file1, Buff, count_in, &count_back);
// res = f_open(&file1, filename, FA_CREATE_ALWAYS | FA_WRITE);
// res = f_write(&file1, Buff, count_in, &count_back);
res = f_close(&file1);
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?