Hi..!
I need a help to analyse the protocol to transfer a binary file from the host to the
target system. I connected the rs 232 to uSB converter and i monitor the data flow
using the USB monitor.Some of the aspects i dont understand from my observation.
1) What is mean by 'value'in the file 'sample.txt'..?
2) How can i send the request using CVI from the host to target..?
3) When i trasfer the file called dummy.dld how can can read the file with out
corrupting the file formate..?
4) what is mean by pipe handle..?
5) I miss something from the following code to write the file named dummy in
to the comport....
6) What are the interupt handlers do?
7) My protocol works similar like Hyperterminal 1K x-modem protocol....
but using this protocol i could transfer the file size more than 276 kb...
😎 So is there any example which demonstrates the x modem protocol..?
Thanx and regards,
Venki.
#include <rs232.h>
#include <formatio.h>
#include <utility.h>
#include <ansi_c.h>
#include <cvirte.h>
int main (int argc, char *argv[])
{
int fH = 0;
int i, br;
unsigned char msg[256];
int counter=0;
char buffer[1500];
//FILE *fH = NULL;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
OpenComConfig (4, "COM4", 38400, 0, 8, 1, 512, 512);
fH = OpenFile ("dummy.dld", VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_BINARY);
//Delay(2);
while((br=ReadFile(fH,buffer,1))<1024){
//printf("%s","Test String");
//Delay(5);
//printf("%d\n",counter);
if(counter==276){
// break;
}
counter++;
ComWrt(4,buffer,1024);
// printf("%d",br);
Delay(0.5);
}
//printf("%d",fH);
//ComFromFile (4, fH, 0, -1);
Delay (0.2);
br = GetInQLen (4);
DebugPrintf ("Bytes at port 4: %d\n", br);
ComRd (4, msg, br);
CloseCom (4);
if (fH > -1) CloseFile(fH);
return 0;
}