ElliotHC

Hi,

I'm having a little trouble with my serial data program, it only works whilst there is data coming in. I am sure that I require something between opening my port and setting my variable = comport.readbyte, can anyone suggest the short statement required

I thought maybe a do loop and something which looks at the port and allows it to continue if there is incoming data but I don't know the functions



Re: Visual Basic Express Edition No RX Data problem

nobugz

Your program will hang on the ReadByte() method call if the serial device isn't sending any data. You could use the DataReceived event or use the BytesToRead property to see if there's anything to read.





Re: Visual Basic Express Edition No RX Data problem

ElliotHC

Many thanks, do you think you might be able to give me an example of the code required as the help in VB 2005 Express isnt very helpful



Re: Visual Basic Express Edition No RX Data problem

Carsten Kanstrup

ElliotHC

I have already given you the code in one of your previous posts and modified it to your needs. This code both use a DataReceived event to invoke the Receiver routine and a while loop to empty the receive buffer. However, in the future the While loop will probably be changed to a Do - Loop Until construction when I hopefully finds out precisely what goes on below the hood of .Net (complex multithreading question).

Sorry to say it, but you will not succeed this way. You do not even try to understand what goes on, and even if I spend a lot of time and write all the code for you, as I did the last time, you do not even test this code. The only thing, which interests you, is getting your messy My.Computer.Ports.OpenSerialPort constructions to work (see my last post).

OK, the help files in VB are not very helpful for a beginner, but obviously you have not even read the description of our program, which tries to explain thing in a much more understandable way.

We are both in the same business and I fully understand your deadline - that why I wrote all the code for you - but you cannot program without the slightest idea of what goes on.

My advise to you. Use the code modification I send you and finish your project. Then spend a couple of month learning VB as you wrote you would do.





Re: Visual Basic Express Edition No RX Data problem

ElliotHC

You have been very helpful, many thanks. I have almost got it perfected. I will over the next day try to understand the first paragraph of your last post, I'm not too concerned abouit time now as it is almost done.

Thanks again