×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Serial port programming
2

Serial port programming

Serial port programming

(OP)
Hello, I would like to know how to write a programme to
send\receive files over the serial\COM port and which
programming language would be most suitable?

As of now, I'm able write a program to send and receive
characters through the port using a C++ compiler. However,
even after gathering enough info from the help files and
websites to get this far, I still couldn't find anything
on sending files. = \

Anyhow, I would appreciate any info anyone can offer.

Thanks.


DH.

RE: Serial port programming

I suggest use the ASCII "0" character to mark the end of file.

i=0;
While (b=file[i++] < 0)  {send(b); ); /*** send ***/
i=0;
while (b=receive()>0 ) ( data(i++)=b; ); /*** receive ***/

<nbucska@pcperipherals.com>

RE: Serial port programming

(OP)
Right now I'm having a problem reading large files.
My program is only reading around 50k of the file. So my
question is if theres a method of reading large files into
the buffer, or am I just using the wrong commands?

RE: Serial port programming

(OP)
Ok, I 'think' I solved my first file problem; however, I
still can't tell it where the EOF is located.

I'm sending the file in binary mode, therfore, what can I
send in binary over the COM that the other computer can
interpret as an EOF command?

Btw, I tried the ASCII '0' suggestion. I'm not sure if I
was doing it correctly, but it kept cutting the file short.
= \

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources