hi. I'm trying to porting the code in
Probably the MMC/FAT routines in Swordfish are better than mikroC, or there are errors in my translation/configuration (i'm not a C programmer) ? Could someone give me a hand?
Code:
unsigned short init_ok; unsigned short car_blink; char filename[14] = "TEST8M16WAV" ; // File names
unsigned long i, size; unsigned short caracter;
unsigned int BufferSize = 500 ; // buffer to avoid glitches unsigned int TimerReload = 65036 ; // alter for different sample rates unsigned short TimerReloadH = 0xFE ; unsigned short TimerReloadL = 0x0C ;
unsigned int WritePointer, ReadPointer ; // read/write pointers in unsigned int Buffer[500];
unsigned long DataSize; // size of WAV data in file unsigned long FileLen ;
/* void ScriviLong (unsigned long valore) { char ltxt[12];
LongToStr(valore, ltxt); lcd_out(1,3,ltxt); delay_ms(900);
} */ void GoDac (unsigned short valore) {
PORTE.F1 = 1; PORTE.F0 = 1; Soft_I2C_Start(); Soft_I2C_Write(0x58); Soft_I2C_Write(0); Soft_I2C_Write(valore); Soft_I2C_Stop(); // PORTE.F1 =0; //PORTE.F0 = 0;
//char dactxt[4]; //bytetostr(valore,dactxt); //lcd_out(10,1,dactxt) ;
} void interrupt() {
pie1.TMR1IE=0;
if (PIR1.TMR1IF=1) { TMR1L = TimerReloadL ; TMR1H = TimerReloadH ; if (ReadPointer==WritePointer) { PORTE.F0=1; } else { ReadPointer=ReadPointer+1; if (ReadPointer==BufferSize) { ReadPointer=0; }
PORTD=buffer[ReadPointer]; //godac(buffer[ReadPointer]); } PIR1.TMR1IF=0; }
pie1.TMR1IE=1; // PORTE.F0=0; }
int ReadFmt() { char txt[4];
unsigned short index ; unsigned short dummyByte; unsigned int dummyWord; unsigned long dummylong;
//RIFF header for (index=1;index