Serial Port Communications Using Byte Array

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Gary Bronson (garybronson_at_skillmatics.com)
Date: 07/26/04


Date: Mon, 26 Jul 2004 15:36:38 -0400

Hi All,

I have a question regarding the use of the mscomm control or Sax Comm
Objects 8.0. I seem to be getting buffer overflow errors when trying to send
data as a string to older devices through the serial port. I think it may
have something to do with the way I'm sending the data. I have read in the
past that you should send data using byte arrays because of the Unicode
conversion or something like that. Since most of the data files I send
contain strange characters, I want to send data using byte arrays but I'm
not sure how to program it to send a little at a time.

I have tried opening a data file from the hard drive, stuffing it all into a
byte array and sending out the com port. This technique causes all kinds of
problems. My old string routine opens the data file from the hard disk,
loops through the file and sends string data out that is the size of the
output buffer. This works almost all the time.

Does anyone have a good byte array routine that would accomplish the same
thing? I also would like to know what property of the control I should look
at while sending data out the com port.- basically i need help with a
reliable output routine for large files.

Some time ago-maybe years - I bought Richard Grier's book but can't find it
now. I seem to remember that there were a few typos in it regarding this
topic though. I could be wrong.

Thanks in advance,

GaryB



Relevant Pages

  • Re: reading a hash
    ... > I am writing a perl script to handle dictionary data. ... The data file has ... But that doesn't quite match your first explanation. ... A hash of hashes of arrays is one way, ...
    (perl.beginners)
  • Re: storing and manipulating columns of data
    ... Being used to deal with Octave / Matlab, I'm a bit confused by Ruby structures (arrays, hashes, etc). ... I have this data file "data.dat" with ...
    (comp.lang.ruby)
  • Re: opening existing files with OPEN()
    ... and if n is an integer constant and i an integer variable,... ... the first line of your data file giving the value of n ... data into arrays, but if it's a few thousand or less that might be OK ... whether you're using f77 or f95: ...
    (comp.lang.fortran)
  • storing and manipulating columns of data
    ... Being used to deal with Octave / Matlab, I'm a bit confused by Ruby structures (arrays, hashes, etc). ... I have this data file "data.dat" with 3 columns: ...
    (comp.lang.ruby)