LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Serial communication help needed

I have a serial data logging device (Datataker DT50) that I am unable to
communicate with using Labview. I can however communcate directly to the
device using Windows Hyperterminal. The device accepts simple ASCI
commands, for example "D" and "T" should return the current date "Date
11/09/2000" and time "Time 10:17:39" responses respectively. I have tried
using the serial vi's that come with Labview but I keep getting either a
serial error or timeout ?? I have ensured that I send a carriage return
when sending strings using the Labview vi's but it makes no difference. Am
I doing something wrong ? Maybe the returned responses/data is not in
asci/string format ? Can anyone help me with this ?

Cheers

Richard
0 Kudos
Message 1 of 4
(2,693 Views)
"Richard Merifield" writes:

> I have a serial data logging device (Datataker DT50) that I am unable to
> communicate with using Labview. I can however communcate directly to the
> device using Windows Hyperterminal. The device accepts simple ASCI
> commands, for example "D" and "T" should return the current date "Date
> 11/09/2000" and time "Time 10:17:39" responses respectively. I have tried
> using the serial vi's that come with Labview but I keep getting either a
> serial error or timeout ?? I have ensured that I send a carriage return
> when sending strings using the Labview vi's but it makes no difference. Am
> I doing something wrong ? Maybe the returned responses/data is not in
> asci/string format ? Can anyone help me
with this ?
>
> Cheers
>
> Richard

Richard,

At a first glance the concept of VISA looks a bit more complicated
than standard serial VI's. But especially for printable data (like in
your case) it has a lot of advantages.

A standard VISA session is as follows:

Open Session
Please remember that ASRL1 is COM1 in Windows.

Set VISA Properties
Use the serial settings that work in Hyperterminal.

VISA Write
Send e.g. "D\r" or "D\n". Don't get fooled by the default
display settings for strings and set it to "codes". I've sent
something like "D \ n" (3 chars) too many times.

VISA Read
Try to read e.g. 1000 chars. With the default settings for term chars
the VI will return data before a \n or \r. A good hint about
termination charakters is the start of a new line after the response
in Hyperterminal.

Close Session

General Error Handler


Hope that helps

Johannes Niess
0 Kudos
Message 2 of 4
(2,693 Views)
First, make sure you are using the right serial cable. This gave me trouble
when I first started using serial. If you are communicating between two computer
COM ports you need a "null modem" cable. Most hardware uses a "straight through"
cable, which is probably what you need here. They look the same, so they
are easy to mix up.

Also, have you made sure that you are using the right number of "bytes to
read". This is an often overlooked problem. If you are looking for too many
bytes you will get a timeout error even if data is present. The simplest
way to get around this is to wait a set period of time after your command,
then use "read # of bytes at port" then read the number of bytes that are
present.

Simple tips, but I hope they'll help.
0 Kudos
Message 3 of 4
(2,693 Views)
I'm also working with labview and serial instruments and have no problems.
I think the serial-vi's of labview send the same caracters as the windows-hyperterminal.
You can check it, if you read with an other PC running hyperterminal the
caracters sent by labview.
0 Kudos
Message 4 of 4
(2,693 Views)