Page 1 of 1

PIC serial communication with uAlfat -SD chip

PostPosted: Thu Aug 21, 2008 7:26 am
by zj
hi
i hav been trying to setup serial commnication of PIC with UAlfat-SD memory card chip. i hav used serial interrupts for reception. this routine works fine for communication with PC. but in case of memory card ISR is not invoked on reception of data from card. the code is


#include <16F877A.h>
#fuses HS,NOLVP,NOWDT,PUT,NOBROWNOUT
#use delay(clock=10000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

char tester;
char str_ch[30];
int j;

//interrupt service routine
#int_rda
void serial_isr( ){
tester=getc( );
str_ch[j]=tester;
j=j+1;
}


//main programm
void main( )
{
int k;
char del[10];
j=0;
getch( );
enable_interrupts(GLOBAL);
enable_interrupts(int_rda);
enable_interrupts(GLOBAL);
//read data from this file
printf("O 1R>DSAMP.LOGX0d");
while(true){
if (tester=='W'){break;}
}
//write the read data to this file
printf("O 2W>VOLTASTR.LOGX0d");
for(k=0;k<j;k++){
printf("character is %c
",str_ch[k]);
}
delay_ms(1);
printf("C 1X0d");

delay_ms(1);
printf("C 2X0d");
}

any help wud b higly appreciated