LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to establish serial communication between Labview and Arduino Duemilanove board

I know it's C. What I don't know is what you want to do. You posted to an old thread about serial communication to a board and then you include some micro code that has nothing to do with serial communiction. Now you ask how to write something to a string indicator. I don't think you want to hear 'wire a string constant to the indicator' but that is the answer to the question you asked. Please rephrase the question into something a little more detailed and explain how your problem relates to serial communication to the Arduino.
0 Kudos
Message 11 of 35
(6,845 Views)

Ok.

I am trying out this example code from Arduino to write to a Serial port.

I think its writing to my computer USB Serial port , Com 5.

I want to read the bytes/hex/dec/bin of the data coming out of the serial to Labview.

I just want to display it on Labview screen for now.

The problems I am having.

1. The Arduino board only have 1 USB cable plugged in, in order for me to upload the Arduino board to the I/O board, Arduino needs to have access to it.

2. When I try it on LAbview, it said that the Com is Valid, but Visa doesn't have access to it? (maybe because the Arduino board is still writing to the serial?

 Can you point me to the right direction on this.

 

// ASCII Table
// by Nicholas Zambetti <http://www.zambetti.com>

void setup()
{
  Serial.begin(9600);

  // prints title with ending line break
  Serial.println("ASCII Table ~ Character Map");

  // wait for the long string to be sent
  delay(100);
}

int number = 33; // first visible character '!' is #33

void loop()
{
  Serial.print(number, BYTE);    // prints value unaltered, first will be '!'

  Serial.print(", dec: ");
  Serial.print(number);          // prints value as string in decimal (base 10)
  // Serial.print(number, DEC);  // this also works

  Serial.print(", hex: ");
  Serial.print(number, HEX);     // prints value as string in hexadecimal (base 16)

  Serial.print(", oct: ");
  Serial.print(number, OCT);     // prints value as string in octal (base 😎

  Serial.print(", bin: ");
  Serial.println(number, BIN);   // prints value as string in binary (base 2)
                                 // also prints ending line break

  // if printed last visible character '~' #126 ...
  if(number == 126) {
    // loop forever
    while(true) {
      continue;
    }
  }

  number++; // to the next character

  delay(100); // allow some time for the Serial data to be sent
}

 

 

 

Message Edited by krispiekream on 04-13-2009 09:42 AM
Best regards,
Krispiekream
0 Kudos
Message 12 of 35
(6,819 Views)

Okay, so you don't want to control the board with LabVIEW? You just want to monitor what a different program is writing? You won't be able to do that because the OS reserves the port for a single process and you get the error.

 

It would make more sense for you to cotnrol what is written with LabVIEW.

0 Kudos
Message 13 of 35
(6,811 Views)

 


Okay, so you don't want to control the board with LabVIEW? You just want to monitor what a different program is writing? You won't be able to do that because the OS reserves the port for a single process and you get the error.

 

It would make more sense for you to cotnrol what is written with LabVIEW.


 

 

Well, the way I was thinking is...If I can get Labview to Read what the other board is reading..I can work around it to Write to the board.

But...

ULTIMATELY, I want to Write the String from  Labview to the LCD Module to the Arduino board. That is my ultimate goal for this project.

That is the reason why I pasted the sample code at the beginning to display the string to the LCD.

 my project is to take a webcam, scan the bar code. and display it on the LCD module. (that's what my teacher wants)

 I already completed the webcam scanning of the bar code...

all I need is to learn how to display it through the USB serial port.

 

 

 

Message Edited by krispiekream on 04-13-2009 10:32 AM
Best regards,
Krispiekream
0 Kudos
Message 14 of 35
(6,800 Views)

Did you read this? It sounds to me that all you have to do is close the serial program you are using and use one of the LabVIEW examples.

 

The sample code at the beginning has nothing whatever to do with serial communication and nothing at all to do with the example serial program you are using.

 

If you want to display an actual bar code, you need to verify whether the LCD supports this. If you want to display the decoded bar code, then that should be just a matter of doing a VISA Write.

0 Kudos
Message 15 of 35
(6,790 Views)

"If you want to display the decoded bar code"

 

Oh yes, thats what I wanted to do...

I have decoded the bar code using Ni Vision and my Region of Interest.

Now, I want to write to VISA and display it on the Arduino board.

I haven't used C in a really really long time.

The first time I used it, i wasn't good at it either..

Best regards,
Krispiekream
0 Kudos
Message 16 of 35
(6,788 Views)
Why are you wanting to use C? If the serial program that comes with Arduino works, there is no reason that the VISA Write will not work as long as you close the Arduino program first. It sounds like you haven't read the earlier post and you haven't tried anything.
0 Kudos
Message 17 of 35
(6,786 Views)

The way I made it work in my circuit, is that my USB is connected to the Arduino board, and I have created a RS-232 connection which communicates between LAbview and the Arduino board. I used maxim 3323 chip to make the RS-232 connection. To display the information in Labview, there is an example that shows you what you get form the arduino board, it is called simple write and read vi under the example folder in Labview. For my project i needed to display some info to an external 2X16 LCD, i used the "hello world" example in the Arduino library and then customized it to my needs (I also used an interrupt to reduce the delay).

 

Hope this helps

 

Max

Max
0 Kudos
Message 18 of 35
(6,780 Views)

I was trying it out during the last hour and didnt get back to you.

Sorry Dennis, but yeah, the post you mentioned for me to read works like a charm.

I got it to Turn on and off the LED using Labview through the Arduino board.

I am on my way of working this to work with the decoded bar code from Labview to the Arduino board.

 

Best regards,
Krispiekream
0 Kudos
Message 19 of 35
(6,765 Views)

Dennis,

I need your help again..

okay, so I got it to write from Labview to Arduino LCD.

From the Arduino software. I can write to LCD 1 time and display it once.

But when I am using the Advanced Serial Write and Read function on labview, it write to the LCD multiple times until i press STOP.

it must be the while loop.

I tried taking that out, but it doesnt let me continuously input in new data through the serial.

do you have any suggestions?

Best regards,
Krispiekream
0 Kudos
Message 20 of 35
(6,746 Views)