From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error with data sent with VISA communication

Solved!
Go to solution

Correction:

http://forums.ni.com/t5/LabVIEW/Adding-SOT-and-CR-to-a-message/m-p/2902364#M841577

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 21 of 46
(817 Views)

Hello,

I need another help help with the corrections needed for the attached vi to get 500 samples in 1 second..

As the Microcontroller is sampling at 500Hz that means 500 samples in a second and message format sent from microcontroller is 22bytes.

can someone help me with this

thanks.

 

0 Kudos
Message 22 of 46
(805 Views)

Is it 6 samples per message?

 

At 9600 Baud rate, you are only going to get about 48.5 messages per second.  At 6 samples per message, that comes to 145.5 Samples per second.

If you can increase your Baud Rate to 115200, then that is ~582 messages per second.  That comes out to 3490 samples per second.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 23 of 46
(802 Views)

Hi Crossrulz,

Sorry, I didn’t explain you this clearly.

Each received data of 22 bytes has 18 bytes (if first 2 bytes and last 2 bytes are skipped) each 3bytes representing a sample of a channel so the 18bytes will be having 6 channels samples.

The microcontroller is sampling at 500Hz so I need to get 500 samples in 1 second to get the continuous signal plot of each channel.

My understanding:

Each time microcontroller will send 22 bytes (0x01 0x02 <18 bytes of information data> 0x03 0x0D).

If 115200 baud rate is used then 115200/8(bits) =14400 bytes. Total number of times a set of 22 bytes can be received in 1 second is 14400/22bytes=654.

Each 22 bytes set is containing a 1 sample of a channel so we can get 654 samples of a channel in 1 second.

 

Can I know how the current vi should be changed to get all the samples in a second that were sent from microcontroller using a rate of 500Hz so that I can see the continuous signal plot of a channel.

thanks.

0 Kudos
Message 24 of 46
(777 Views)

Change your Baud Rate to 115200.  It is currently set to the default of 9600.  You also have to make sure the microcontroller is set to 115200.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 25 of 46
(768 Views)

Hi crossrulz,

I changed the vi a bit as per my requirements and changed the baud rate to 115200 in labview (also in microcontroller) but only receiving 1 sample after some seconds.

Can you please let me know how (what changes are to be made to the attached vi) to get all samples in a second and plot them so that I can see the real time signal( I want to plot voltage obtained from each sample).

Thanks.

0 Kudos
Message 26 of 46
(754 Views)

Looking back at the his post #5 and #14, the time out error is coming from the VISA Write. Not from the VISA Read. I do not think I have ever gotten a time out error from a VISA Write for RS232 (GPIB yes, but not RS232)

Could there be a problem with his com port?

 

Are you using the RS232 control lines and does your microcontroller use them. (CTS, DCD, RTS, DSR, DTR etc)

http://en.wikipedia.org/wiki/RS-232_RTS/CTS#RTS.2FCTS_handshaking

 

I do not know what would cause a VISA WRITE to time out. I could not reproduce the error.

 

We know his comport works in loop back from his post #1. 

 

He has the timeout set 10 msec (not 10 sec), but even a time out 0 ms would still not cause a VISA Write timeout error.

Omar
0 Kudos
Message 27 of 46
(745 Views)
The only times I've gotten timeout errors on a writer is when the hand shaking is incorrect. For hardware handshaking, check the physical wiring.
0 Kudos
Message 28 of 46
(732 Views)

 Does it use a termination character?

 

Re-read message #10 from crossrulz and message #15 from johnsold

 

 

termination.png

Omar
0 Kudos
Message 29 of 46
(729 Views)

@Omar:Yes,I am using termination charcter 'D' as crossrulz suggested.

 

0 Kudos
Message 30 of 46
(722 Views)