LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial sample not work

I am trying to use the sample of 'Basic Serial Write and Read.vi'.

 

There is no error, but cannot read data.

 

Any suggestion, thanks.

0 Kudos
Message 1 of 9
(2,773 Views)

really hard without any specification of your hardware.

- do nyou need to send a command before you receive answer?

- is the hardware just spitting data?

- are com-port settings ok?

- ...

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
Message 2 of 9
(2,771 Views)

It is just listening to receive data, no other hardware.

 

Just want to learn, can I start 2 serial handle for software simulation. One for sending data, one for receive data.

 

Will there be buffer to hold the data of the serial port, how long will it hold. If I start multi serial handle, will it work.

 

Can it be receive and write the data at same time.

 

Thanks.

 

 

 

0 Kudos
Message 3 of 9
(2,754 Views)

Hi =). Im a beginner working reading serial data. Im trying to send serial data from an arduino microcontroller to labview by using VISA read.

 

I constructed a voltage divider circuit that gives an output ranging from 0 to 5V. The output of this circuit is sent to an analog input pin 0 of an Arduino Duemilanove board.

 

1) Firstly I plugged in the cable connecting my laptop USB to the arduino board.

 

2) I went to start->control panel->system->hardware->device manager. Check out Ports(COM & LPT). In my laptop I can see USB Serial Port (COM4). Now I know in Labview I have to read serial data from COM 4.

 

3) For the arduino side, here is the code to read voltage variations inputted to analog pin 0. The last line 'delay' determines the sampling rate of how we want to sample the voltage divider output:

 

int potPin = 0;    // select the input pin for the voltage divider output
int val = 0;       // variable to store the value coming from the sensor

void setup()
{
  Serial.begin(9600);    // opens serial port, sets data rate to 9600 bps
}

void loop() {
  val = analogRead(potPin); // read the value from the voltage divider
  Serial.println(val);
  delay(10);
}

 

I have slightly modified the basic serial read write VI.. I have attached the block diagram used with comments. Basically I tried to read serial data, divide by 1023 and multiply by 5 in order to graph voltage variations from the voltage divider circuit.  However Im not getting the correct voltage output values . The voltage value just keeps going to 0 and coming again as shown in the pic.

 

Could you guys please guide me on what went wrong?

 

Thanks!

Download All
0 Kudos
Message 4 of 9
(2,752 Views)

Jazlan,

 

Don't hijack someone else's message thread.  Start your own new message.

 

Alex,

What kind of device are you trying to read data from?  Have you tried using Hyperterminal or any software that may have come with the device to see if that works?

 

If you want to experiment writing to and reading from a given serial port, try using a loopback adapter.  It connects the transmit and receive pins so that any data that goes out comes right back in.  Otherwise you could use two serial ports and use a null modem cable.

 

For more help, you are going to have to tell us what you are trying to do.  What device are you trying to read?  Does it come with a manual that tells it how it communicates?

0 Kudos
Message 5 of 9
(2,745 Views)

If I need to read some thing from com port, does I need to reading loop all the time or any other function can wait until the data arrive.

0 Kudos
Message 6 of 9
(2,732 Views)

No, it's not necessary to have a loop.

 

Could you answer the questions? What exactly is connected to your serial port? An instrument, a loop back, another serial port?

0 Kudos
Message 7 of 9
(2,713 Views)

You can see an example for analog reading, make a program in LabVIEW to test and verify the correct operation of our program in the Arduino , we will make the reading of data transmitted by the Arduino from the serial port on the card installed , proceed to read the COM port 

https://decibel.ni.com/content/docs/DOC-33278

4.png

0 Kudos
Message 8 of 9
(2,589 Views)

This article presents a procedure for reading the analog ports of Arduino UNO R3 board , on which a Joystick shield was installed. The analog data are related to the position of command and can be monitored from the front panel of our program , for which we use serial communication.

https://decibel.ni.com/content/docs/DOC-33281

 

6.png

0 Kudos
Message 9 of 9
(2,573 Views)