08-21-2014 07:36 AM
Hi GerdW,
First start the receiver (your UART.vi), then send the message data
So that is what I was asking ; is it necessary always to run my receiver (any receiver VI ) first and then transmit?
I know serial cable is not a data buffer; but there are UART buffers on the PC motherboard right???
So can't I retrieve the data from those buffers?
Regards,
Snehal
08-21-2014 07:42 AM
SnehalLVLover wrote:
So can't I retrieve the data from those buffers?
Only data that gets recieved can you get from a buffer. The transmit buffer is purely for the transmitter to read.
Do you have a format figured out for how the data will look like coming from your microcontroller? Are you sending and recieving ASCII data or raw binary data? This makes a big difference in how I would set this up.
08-21-2014 07:44 AM - edited 08-21-2014 07:45 AM
Hi Snehal,
those buffers are maintained in the hardware drivers. When you initialize the serial port the hardware driver initializes the port chip/hardware - this will clear any data in the buffer. Afterwards that buffer is used to minimize CPU load by enabling event based data transfers instead of relying on polling…
You need to start the receiver first!
@Crossrulz:
Look at Snehals yesterdays post on data format…
08-21-2014 07:45 AM
Hi GerdW,
Yes I noticed that function also and when I hovered the mouse over that Wait function it says that- Delay between the write and when read should occur. This gives devices the time to respond.
And this is the same how I interpreted it literally.
So, if I my program flow is not like - Write first and then Read, why would I add a wait function?
Regards,
Snehal
08-21-2014 07:47 AM - edited 08-21-2014 07:48 AM
08-21-2014 08:03 AM
@SuLAB wrote:
Hi GerdW,
Yes I noticed that function also and when I hovered the mouse over that Wait function it says that- Delay between the write and when read should occur. This gives devices the time to respond.
And this is the same how I interpreted it literally.
So, if I my program flow is not like - Write first and then Read, why would I add a wait function?
If you are not writing, then you don't need to wait as much. However, you may have to wait just for data to come in from the microcontroller.
Is the data message from the microcontroller always going to be the same length? If so, there is no need for the wait at all. You just set the VISA Read to read the number of bytes in a message. You will get a timeout error if those bytes don't come in.
So your setup should really be Initialize Serial Port, loop{ read data }, close serial port. You should only initialize the port at the very beginning of your program and the close it at the very end. This will keep you from clearing those buffers and missing data.