AtomSoft
Well-Known Member
Im trying to add this function to my pic to download a file into memory. In hyper terminal it acts like the file was send and all is well but in pic there seems to be no data. Here is what i got so far:
Ill attach the info i have on xmodem also.
Code:
void GetFile(char *buff){
char i; // Length counter
unsigned char dat;
while(!DataRdyUSART()){
if(Btn01 == 1) //I press button to send first NAK to initiate transfer
putcUSART(21);//sends NAK aka NCGByte
Delayms(50); //debounce
}
i = 0;
again:
while(!DataRdyUSART());// Wait for data to be received
dat = getcUSART(); // Get a character from the USART
// and save in the string
if(dat == 4){ //The End of transmision byte
putcUSART(21); //NAK
while(!DataRdyUSART());
dat = getcUSART();
if(dat == 4) //EOT
putcUSART(21);//NAK
} else {
*buff = dat;
buff++;
i++;
if(i==132){ //After the 132 Bytes come in 0-131
putcUSART(6); //ACK
i = 0; //set back to 0
}
goto again;
}
}
Ill attach the info i have on xmodem also.
Attachments
Last edited: