I struggle with a fundamental problem...visa serial read/write.
How do I make a program that both sends data and recieves data via visa serial read/write "at the same time"?
I want it to read data whenever there is incoming data(all the time ready to read) and write whenever
there is something to write(for example a "send command" buttom that user pushes).
I have tested to program in some different ways but I get the same problem(tested program between two PC:s via
hyperterminal)
PROBLEM:
Reading data works fine, it answers on incoming data, but to write data the program´s readfunction
must execute first. The readfunction must take its specified number of bytes before the program
sends the "writebytes". In other words: I cant write anything to hardware unless there is incoming data to read!!
I have tested with one loop containing both read and write. I have tested with two parallell separated
loops with read in one and write in the other.
You can take a look at my attached programexample if you want.
Any suggestions how to solve this?
/thanks fredda