Problem with serial port on usbizi100

Hello,

I have some code that sends out a single byte and then waits for it to go out before doing the next thing

COM2.Write(buffer2, sentBytes2, 1);

then waits until COM2.BytesToWrite == 0

this works great, except every now and then the program hangs as COM2.BytesToWrite stays at one and never becomes zero.

do you have any idea why this is, or if my approach is flawed in the first place?

-Peter

Why do you need to wait? Is there some reason you want to?

Does that “blocked” character ever get sent to the recieving end?

Hi Brett,

thanks for your reply - I had abandoned the approach and used direct register access to send out the data through the serial port to solve the problem of the process hanging.

The reason I need to send out one byte at a time is because the hardware at the receiving end handshake has a time delay. I need to wait about a millisecond after sending each byte to check the handshake signal. otherwise the receiving equipment hangs up. (it is an old CNC controller)

-Peter