Page 1 of 1

Check progress of WriteSerialPortData()

Posted: Sat Apr 05, 2025 9:23 pm
by matalog
I am using

Code: Select all

WriteSerialPortData(1,*sbuf,16384)
to write 16384 bytes to an old computer, and I can actually list the bytes as they arrive on it.

It is the first time I am trying this with the old computer and I would like to keep an eye on it, and see if it is working correctly, once the bytes are on the old computer, then I don't really have a reliable way to get them off at the minute to check the files, so I would just like to see how far through the 16384 that I currently am on sending in PB, and compare that to where the old computer is at.

Is there any way to see how far in *sbuf that the WriteSerialPortData(1,*sbuf,16384) is at the minute?

I have been using

Code: Select all

 
  For t=0 To Lof(0)-1
  WriteSerialPortData(1,*sbuf+t,1)
  s$=Str(t+1)+"  :  "+Str(PeekA(*sbuf+t))
  Debug s$
  Delay(120)
  Next
But it will drop some bytes if the Delay is too slow, so I was hoping having a constant stream of serial data was going to be more reliable.

Any tips?

Re: Check progress of WriteSerialPortData()

Posted: Sat Apr 05, 2025 9:27 pm
by SnowyDog
Hello, I think you can use Result = AvailableSerialPortOutput(#SerialPort) to find out how many bytes remain in the serial output buffer.

A slightly better approach would be to use handshaking (either hardware or software) assuming that the old computer can support either.